diff --git a/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py b/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py index 83839b9cba1a4c6a50eef52852ed8ee2127dfaa7..c49770ad2b7e9468eca196af582d2156b9ab977c 100644 --- a/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py +++ b/Calorimeter/CaloRecAlgs/python/CaloRecAlgsConfig.py @@ -19,12 +19,11 @@ def CalorimeterReconstructionCfg(flags, **kwargs): kwargs.setdefault("CaloHitContainerKey", "CaloHits") kwargs.setdefault("PreshowerHitContainerKey", "PreshowerHits") - recoAlg = CompFactory.CaloRecAlg("CaloRecAlg", **kwargs) - acc.addEventAlgo(recoAlg) - - dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") # what should this be set to??? + acc.merge(CaloRecToolCfg(flags, **kwargs)) + kwargs.pop("MC_calibTag") # Remove this if it is specified so it does not get pased to CaloRecAlg - acc.merge(CaloRecToolCfg(flags)) + recoAlg = CompFactory.CaloRecAlg("CaloRecAlg", isMC = flags.Input.isMC, **kwargs) + acc.addEventAlgo(recoAlg) return acc diff --git a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx index f4f78d488d6c542637003e38ea0d8959f89b6b1c..b6df5fed6053f7499a6f45a95e4b51d2e6633ddd 100644 --- a/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx +++ b/Calorimeter/CaloRecAlgs/src/CaloRecAlg.cxx @@ -91,12 +91,11 @@ StatusCode CaloRecAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("calo_hit filled has charge of " << charge << " pC"); float gainRatio = 1.0; - if (m_isMC) { - gainRatio = 1.0; // put dummy value for now, this will end up being ratio of digi scale factors - } else { + if (!m_isMC) { // MC already has correct MIP charge stored in MIPcharge_ref, so only need to to HV extrapolation with reral data gainRatio = extrapolateHVgain(hit->channel()); - ATH_MSG_DEBUG("HV gain ratio = " << gainRatio ); } + ATH_MSG_DEBUG("HV gain ratio = " << gainRatio ); + float Nmip = (charge * gainRatio) / MIPcharge_ref; ATH_MSG_DEBUG("Nmip = " << Nmip ); diff --git a/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py b/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py index 65be875da12b6deee3cbf9f35217cee6f40784ff..473a70f7327a39b4029b0af40045c84b1054cc35 100644 --- a/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py +++ b/Calorimeter/CaloRecTools/python/CaloRecToolConfig.py @@ -19,8 +19,15 @@ def CaloRecToolCfg(flags, name="CaloRecTool", **kwargs): # Probably need to figure this out! dbInstance = kwargs.get("dbInstance", "TRIGGER_OFL") + MC_calibTag = kwargs.get("MC_calibTag", "") + + # MC calibration db folder MIP_ref has version tags + if len(MC_calibTag) > 0: + acc.merge(addFolders(flags, "/WAVE/Calibration/MIP_ref", dbInstance, className="CondAttrListCollection", tag=MC_calibTag)) + else: + acc.merge(addFolders(flags, "/WAVE/Calibration/MIP_ref", dbInstance, className="CondAttrListCollection")) + acc.merge(addFolders(flags, "/WAVE/Calibration/HV", dbInstance, className="CondAttrListCollection")) - acc.merge(addFolders(flags, "/WAVE/Calibration/MIP_ref", dbInstance, className="CondAttrListCollection")) return acc diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py index b470cb3fd20ae482d4cd1aececd535191a35c00e..a4f7207dbdc4e454580cca755a3d63e2cf390d9f 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py @@ -33,6 +33,8 @@ parser.add_argument("-v", "--verbose", action='store_true', help="Turn on DEBUG output") parser.add_argument("--isMC", action='store_true', help="Running on digitised MC rather than data") +parser.add_argument("--MC_calibTag", default="", + help="Specify tag used to reconstruct MC calo energy: (WAVE-Calibration-01-LG-nofilt, WAVE-Calibration-01-LG, WAVE-Calibration-01-HG-nofilt, or WAVE-Calibration-01-HG) ") parser.add_argument("--testBeam", action='store_true', help="Set geometry for 2021 test beam") @@ -194,14 +196,10 @@ if useLHC: from WaveRecAlgs.WaveRecAlgsConfig import WaveformReconstructionCfg acc.merge(WaveformReconstructionCfg(ConfigFlags)) -# Calorimeter reconstruction -if args.isMC: - # Not ready for MC quite yet - pass - -elif useCal: +# Calorimeter Energy reconstruction +if useCal: from CaloRecAlgs.CaloRecAlgsConfig import CalorimeterReconstructionCfg - acc.merge(CalorimeterReconstructionCfg(ConfigFlags)) + acc.merge(CalorimeterReconstructionCfg(ConfigFlags, MC_calibTag=args.MC_calibTag)) # Tracker clusters from TrackerPrepRawDataFormation.TrackerPrepRawDataFormationConfig import FaserSCT_ClusterizationCfg