Skip to content

Conversation

@SanghyunKo
Copy link

Fix trivial cmsRun runtime error

@SanghyunKo SanghyunKo closed this Nov 20, 2020
@SanghyunKo
Copy link
Author

Sorry, nevermind, I see this already in #42

@kdlong kdlong reopened this Nov 20, 2020
@kdlong
Copy link
Owner

kdlong commented Nov 20, 2020

Thanks! I still need a bit to review dylan's PR before merging, we could just make this change in the meantime?

@SanghyunKo SanghyunKo force-pushed the GenWeightRefactor_master branch from 948f2ee to 7fd9c2c Compare November 20, 2020 12:45
@kdlong
Copy link
Owner

kdlong commented Nov 20, 2020

@SanghyunKo can you list some samples affected by your latest fix?

@SanghyunKo
Copy link
Author

@kdlong Oh gosh... I didn't notice that you re-opened the PR and I added another commit... Forgive me :(

If you allow it, then let me explain here about the additional commit:
Some samples occasionally have extra < or > after the last </weightgroup>, and this crashes entire XML parsing.
Unfortunately, this seems to happen quite often, even in the some of the DY samples e.g. /DYJetsToLL_M-50_TuneCP5_13TeV-amcatnloFXFX-pythia8/RunIIFall17MiniAODv2-PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/MINIAODSIM.

    <weightgroup combine="none" name="PDF_variation">
      <weight id="2079"> PDF=  262000 NNPDF30_lo_as_0118 </weight>
    </weightgroup>
    <weightgroup combine="none" name="PDF_variation">
      <weight id="2080"> PDF=  263000 NNPDF30_lo_as_0130 </weight>
    </weightgroup>
  <

Since LHEEventProduct themselves are OK, this can be simply fixed by deleting extra strings after the last </weightgroup> in the LHERunInfoProduct (indeed any kind of extra strings after the very last ket wouldn't make any sense for XML format)

@kdlong
Copy link
Owner

kdlong commented Nov 20, 2020

No worries! IF you want you can close and open a new one. This looks like a good idea to me. Otherwise the samples fail, right?

Can you collect this together with the other conditions that depend on failIfInvalidXML_ and GetError() != 0 and make the logic a bit cleaner? Right now there are several if statements that could be collected in a more clear/logical order. It might also be worth making these lines you've added into a short function named removeTrailingCharsFromHeader, for example

@SanghyunKo
Copy link
Author

Done. Although this may not be the most compact way, it should prevent repeating if (failIfInvalidXML_) over and over again.

@kdlong
Copy link
Owner

kdlong commented Nov 24, 2020

Thanks Sanghyun, this looks much better to me. One quick thing, can you run scram b code-checks and scram b code-format?

@SanghyunKo
Copy link
Author

Hi @kdlong, indeed there was a couple of warnings from code format check. Fixed it!

@kdlong kdlong merged commit d09e64d into kdlong:GenWeightRefactor_master Nov 24, 2020
@kdlong
Copy link
Owner

kdlong commented Nov 24, 2020

Thanks!

kdlong pushed a commit that referenced this pull request Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants