Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calibration file overwrites CONSTANTS["AdditionalDropCollectionsREC"] #153

Open
dudarboh opened this issue Dec 25, 2024 · 1 comment
Open
Labels

Comments

@dudarboh
Copy link
Member

dudarboh commented Dec 25, 2024

In ILDReconstruction.py writing edm4hepfiles follows this logic:

    edm4hepOutput = PodioOutput("EDM4hepOutput")
    edm4hepOutput.filename = f"{reco_args.outputFileBase}_REC.edm4hep.root"
    edm4hepOutput.outputCommands = ["keep *"]
    for name in CONSTANTS["AdditionalDropCollectionsREC"].split(" "):
        edm4hepOutput.outputCommands.append(f"drop {name}")

So, naively one assumes that to drop additional collections one needs to add to the CONSTANTS definition at the top a corresponding key, e.g:

CONSTANTS = {
    "CMSEnergy": str(reco_args.cmsEnergy),
    "BeamCalCalibrationFactor": str(reco_args.beamCalCalibFactor),
    "AdditionalDropCollectionsREC" : "BCAL" # This new key is added manually to drop BCAL collection
}


det_calib_constants = import_from(f"Calibration/Calibration_{det_model}.cfg").CONSTANTS
CONSTANTS.update(det_calib_constants)


parseConstants(CONSTANTS)

However, this does not drop the BCAL collection because CONSTANTS.update(det_calib_constants) overwrites this key with a value from the calibration file.

Thus, one must define AdditionalDropCollectionsREC only after the calibration file is read, which overwrites whatever is dropped inside calibration files.

@tmadlener tmadlener added the bug label Jan 6, 2025
@tmadlener
Copy link
Contributor

Thanks for the report. This is indeed unintentional. This most likely also affects the LCIO output, I would assume(?). The way I see it there are different fixes possible

  • Attach more collections to AdditionalDropCollectionsREC only after the CONSTANTS have been loaded (and parsed) as you have proposed it.
  • Add a different key to the top-level CONSTANTS that doesn't get overwritten and use that in addition to the AdditionalDropCollectionsREC when filling the edm4hepOutput.outputCommands.

I would have a slight preference for the second, but you are potentially quicker with fixing this than me, so "first come first merge" (or something along those lines).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants