diff --git a/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h b/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h index b80589e4319aa775959886797c8bf63d1e4e2eea..2c9669c8c5a54876131b638fc1970be52f5a16aa 100644 --- a/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h +++ b/Reconstruction/eflowRec/eflowRec/PFMomentCalculatorTool.h @@ -37,9 +37,15 @@ class PFMomentCalculatorTool : public extends<AthAlgTool, IPFBaseTool> { /** Tool to calculate cluster moments */ ToolHandle<CaloClusterCollectionProcessor> m_clusterMomentsMaker{this,"CaloClusterMomentsMaker","CaloClusterMomentsMaker","Tool to calculate cluster moments"}; + /** Tool to calculate cluster moments */ + ToolHandle<CaloClusterCollectionProcessor> m_clusterCalibHitMomentsMaker2{this,"CaloCalibClusterMomentsMaker2","CaloCalibClusterMomentsMaker2","Tool to calculate calibration hit cluster moments"}; + /** Toggle whether we are in LC mode - false by default */ Gaudi::Property<bool> m_LCMode{this,"LCMode",false,"Toggle whether we are in LC mode - false by default"}; + /** Toggle usage of calibration hit truth - false by default */ + Gaudi::Property<bool> m_useCalibHitTruth{this,"UseCalibHitTruth",false,"Toggle usage of calibration hit truth - false by default"}; + }; #endif diff --git a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h index d9b96de5c322a64e5f8f6501fb502c578f8db652..c242cafb43e00ed6f1ba72b16e7822d358fcb369 100644 --- a/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h +++ b/Reconstruction/eflowRec/eflowRec/PFONeutralCreatorAlgorithm.h @@ -38,6 +38,9 @@ private: /** Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input */ Gaudi::Property<bool> m_LCMode{this,"LCMode",false,"Bool to toggle which jetetmiss configuration we are in - EM cluster input or LC cluster input"}; + /** Toggle usage of calibration hit truth - false by default */ + Gaudi::Property<bool> m_useCalibHitTruth{this,"UseCalibHitTruth",false,"Toggle usage of calibration hit truth - false by default"}; + /** ReadHandleKey for eflowCaloObjectContainer */ SG::ReadHandleKey<eflowCaloObjectContainer> m_eflowCaloObjectContainerReadHandleKey{this,"eflowCaloObjectContainerName","eflowCaloObjects","ReadHandleKey for eflowCaloObjectContainer"}; diff --git a/Reconstruction/eflowRec/python/eflowRecFlags.py b/Reconstruction/eflowRec/python/eflowRecFlags.py index 02b2f603d80f61237341f0f6f895e58c5137c465..3ba8ad0477cb64eda176c830a9ede7b1edf6b1b5 100644 --- a/Reconstruction/eflowRec/python/eflowRecFlags.py +++ b/Reconstruction/eflowRec/python/eflowRecFlags.py @@ -106,6 +106,13 @@ class useAODReductionClusterMomentList(JobProperty): statusOn = True allowedTypes = ['bool'] StoredValue = True + +class useCalibHitTruth(JobProperty): + """ Flag to toggle use of calibration hit truth, which is off by default because most Monte Carlo samples do not contain the calibration hit truth information + """ + statusOn = True + allowedTypes = ['bool'] + StoredValue = False # Defines the container for the eflowRec flags @@ -117,7 +124,7 @@ class eflowRecFlags(JobPropertyContainer): # add the flags container to the top container jobproperties.add_Container(eflowRecFlags) -eflowJobProperties = [eflowAlgType,CalType,useLocalHadWeightsOOCC,useOverLapShowerCells,useSplitShowers,useEEtaFirstInt,recoverIsolatedTracks,UseElectronHadronID,runTauMode, useLeptons,storeLeptonCells, useLCInput, useUpdated2015ChargedShowerSubtraction,useAODReductionClusterMomentList] +eflowJobProperties = [eflowAlgType,CalType,useLocalHadWeightsOOCC,useOverLapShowerCells,useSplitShowers,useEEtaFirstInt,recoverIsolatedTracks,UseElectronHadronID,runTauMode, useLeptons,storeLeptonCells, useLCInput, useUpdated2015ChargedShowerSubtraction,useAODReductionClusterMomentList,useCalibHitTruth] for i in eflowJobProperties : jobproperties.eflowRecFlags.add_JobProperty(i) diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py index d66a7a19d599e328a984d3ec084fb465ba6ef962..3df674de3d76a4e195fda9e110fe7e9d3cf390b0 100644 --- a/Reconstruction/eflowRec/share/PFlowMTConfig.py +++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py @@ -149,6 +149,44 @@ PFClusterMomentsMaker.MomentsNames = [ PFMomentCalculatorTool.CaloClusterMomentsMaker = PFClusterMomentsMaker + +from eflowRec.eflowRecFlags import jobproperties + +if jobproperties.eflowRecFlags.useCalibHitTruth: + + PFMomentCalculatorTool.UseCalibHitTruth=True + + from CaloCalibHitRec.CaloCalibHitRecConf import CaloCalibClusterMomentsMaker2 + PFCalibClusterMomentsMaker = CaloCalibClusterMomentsMaker2("PFCalibClusterMomentsMaker") + PFCalibClusterMomentsMaker.MomentsNames = ["ENG_CALIB_TOT" + ,"ENG_CALIB_OUT_L" + ,"ENG_CALIB_EMB0" + ,"ENG_CALIB_EME0" + ,"ENG_CALIB_TILEG3" + ,"ENG_CALIB_DEAD_TOT" + ,"ENG_CALIB_DEAD_EMB0" + ,"ENG_CALIB_DEAD_TILE0" + ,"ENG_CALIB_DEAD_TILEG3" + ,"ENG_CALIB_DEAD_EME0" + ,"ENG_CALIB_DEAD_HEC0" + ,"ENG_CALIB_DEAD_FCAL" + ,"ENG_CALIB_DEAD_LEAKAGE" + ,"ENG_CALIB_DEAD_UNCLASS" + ,"ENG_CALIB_FRAC_EM" + ,"ENG_CALIB_FRAC_HAD" + ,"ENG_CALIB_FRAC_REST"] + + PFCalibClusterMomentsMaker.CalibrationHitContainerNames = ["LArCalibrationHitInactive" + ,"LArCalibrationHitActive" + ,"TileCalibHitActiveCell" + ,"TileCalibHitInactiveCell"] + PFCalibClusterMomentsMaker.DMCalibrationHitContainerNames = ["LArCalibrationHitDeadMaterial" + ,"TileCalibHitDeadMaterial"] + + PFMomentCalculatorTool.CaloCalibClusterMomentsMaker2=PFCalibClusterMomentsMaker + + + from eflowRec.eflowRecConf import PFClusterCollectionTool PFClusterCollectionTool_default = PFClusterCollectionTool("PFClusterCollectionTool") @@ -191,5 +229,7 @@ topSequence += PFOChargedCreatorAlgorithm from eflowRec.eflowRecConf import PFONeutralCreatorAlgorithm PFONeutralCreatorAlgorithm = PFONeutralCreatorAlgorithm("PFONeutralCreatorAlgorithm") - +if jobproperties.eflowRecFlags.useCalibHitTruth: + PFONeutralCreatorAlgorithm.UseCalibHitTruth=True + topSequence += PFONeutralCreatorAlgorithm diff --git a/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx b/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx index bf26621b8df6e75a125cb7353dde585a64f8e77f..f1a570e199915a3c39910b44f5b61766f6d8b2df 100644 --- a/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx +++ b/Reconstruction/eflowRec/src/PFMomentCalculatorTool.cxx @@ -23,6 +23,13 @@ StatusCode PFMomentCalculatorTool::initialize(){ ATH_MSG_WARNING("Cannot find CaloClusterMomentsMaker Tool"); return StatusCode::SUCCESS; } + + /* Retrieve the cluster calib hit moments maker */ + if ( m_clusterCalibHitMomentsMaker2.retrieve().isFailure() ) { + ATH_MSG_WARNING("Cannot find CaloCalibClusterMomentsMaker2 Tool"); + return StatusCode::SUCCESS; + } + return StatusCode::SUCCESS; } @@ -40,6 +47,11 @@ void PFMomentCalculatorTool::execute(const eflowCaloObjectContainer& theEflowCal /* Remake the cluster moments */ if (m_clusterMomentsMaker->execute(tempClusterContainer.get()).isFailure()) ATH_MSG_WARNING("Could not execute ClusterMomentsMaker"); + if (m_useCalibHitTruth){ + if (m_clusterCalibHitMomentsMaker2->execute(tempClusterContainer.get()).isFailure()) ATH_MSG_WARNING("Could not execute CaloCalibClusterMomentsMaker2"); + } + + } StatusCode PFMomentCalculatorTool::finalize(){ return StatusCode::SUCCESS; } diff --git a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx index f23cb5836960a8580273c9200f8e15b2ab1a005d..453c1103ed7ccf0d3d671a64971878289037b858 100644 --- a/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx +++ b/Reconstruction/eflowRec/src/PFONeutralCreatorAlgorithm.cxx @@ -120,6 +120,12 @@ void PFONeutralCreatorAlgorithm::createNeutralPFO(const eflowCaloObject& energyF this->addMoment(xAOD::CaloCluster::ISOLATION,xAOD::PFODetails::PFOAttributes::eflowRec_ISOLATION,*cluster, *thisPFO); this->addMoment(xAOD::CaloCluster::SECOND_LAMBDA,xAOD::PFODetails::PFOAttributes::eflowRec_SECOND_LAMBDA,*cluster, *thisPFO); this->addMoment(xAOD::CaloCluster::EM_PROBABILITY,xAOD::PFODetails::PFOAttributes::eflowRec_EM_PROBABILITY,*cluster, *thisPFO); + if (m_useCalibHitTruth){ + this->addMoment(xAOD::CaloCluster::ENG_CALIB_TOT,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_TOT,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_EM,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_HAD,*cluster, *thisPFO); + this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_REST,xAOD::PFODetails::PFOAttributes::eflowRec_ENG_CALIB_FRAC_REST,*cluster, *thisPFO); + } } //First set all the layer energies