diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py index 8c8f4a82aac1680f84b5e3c80a2796af13926fb9..be4b88a7edcd360446103ab3bb53dc54fdf0ff77 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoToolsConfig.py @@ -50,6 +50,17 @@ def EGammaCaloIsolationToolCfg(flags, **kwargs): phi_size=7, cells_name=flags.Egamma.Keys.Input.CaloCells) kwargs['CaloFillRectangularClusterTool'] = cfrc + + # default is to read calocaltopoclusters. + # In HI, if subtracted clusters, use them instead, and do not do pu correction + if flags.HeavyIon.Egamma.doSubtractedClusters: + ccict = CompFactory.xAOD.CaloClustersInConeTool( + name="topoiso_CaloClustersInConeTool", + CaloClusterLocation=flags.Egamma.Keys.Input.TopoClusters) + kwargs['ClustersInConeTool'] = ccict + # No pileup correction, and do not save it + kwargs['InitializeReadHandles'] = False + kwargs['saveOnlyRequestedCorrections'] = True kwargs.setdefault('name','egCaloIsolationTool') kwargs.setdefault('ParticleCaloExtensionTool',None) @@ -70,9 +81,17 @@ def MuonCaloIsolationToolCfg(flags, **kwargs): kwargs['FlowElementsInConeTool'] = CompFactory.xAOD.FlowElementsInConeTool( name='FlowElementsInConeTool') - from CaloIdentifier import SUBCALO - kwargs.setdefault('EMCaloNums',[SUBCALO.LAREM]) - kwargs.setdefault('HadCaloNums',[SUBCALO.LARHEC, SUBCALO.TILE]) + # default is to read calocaltopoclusters. + # In HI, if subtracted clusters, use them instead, and do not do pu correction + if flags.HeavyIon.Egamma.doSubtractedClusters: + ccict = CompFactory.xAOD.CaloClustersInConeTool( + name="topoiso_CaloClustersInConeTool", + CaloClusterLocation=flags.Egamma.Keys.Input.TopoClusters) + kwargs['ClustersInConeTool'] = ccict + # No pileup correction, and do not save it + kwargs['InitializeReadHandles'] = False + kwargs['saveOnlyRequestedCorrections'] = True + kwargs.setdefault('ParticleCaloCellAssociationTool',None) kwargs.setdefault('UseEtaDepPUCorr',False) kwargs.setdefault('name','muonCaloIsolationTool') diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py index 41ccb7f89cc7f7728fb7e35522cf2f35e98db5dc..9a69580673245dae5c4da8a1be1691498284a617 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationBuilderConfig.py @@ -52,6 +52,9 @@ def egIsolationCfg(flags, name='egIsolation', **kwargs): [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ]) isoCor.append( [ isoPar.core57cells, isoPar.ptCorrection, isoPar.pileupCorrection ]) + # do not do pileup correction if HI with subtracted clusters + if flags.HeavyIon.Egamma.doSubtractedClusters: + isoCor[-1] = [ x for x in isoCor[-1] if x != isoPar.pileupCorrection ] isoExCor.append([]) if 'CaloTopoIsolationTool' not in kwargs: kwargs['CaloTopoIsolationTool'] = acc.popToolsAndMerge( @@ -96,6 +99,9 @@ def muIsolationCfg(flags, name='muIsolation', **kwargs): isoType.append( [ isoPar.topoetcone20, isoPar.topoetcone30, isoPar.topoetcone40 ]) isoCor.append([ isoPar.coreCone, isoPar.pileupCorrection ]) + # do not do pileup correction if HI with subtracted clusters + if flags.HeavyIon.Egamma.doSubtractedClusters: + isoCor[-1] = [ x for x in isoCor[-1] if x != isoPar.pileupCorrection ] isoExCor.append([]) if ('CaloTopoIsolationTool' not in kwargs) or ( 'PFlowIsolationTool' not in kwargs): @@ -106,6 +112,10 @@ def muIsolationCfg(flags, name='muIsolation', **kwargs): isoType.append( [ isoPar.neflowisol20, isoPar.neflowisol30, isoPar.neflowisol40 ]) isoCor.append([ isoPar.coreCone, isoPar.pileupCorrection ]) + # do not do pileup correction for HI reco... + # and pflow iso is more than experimental in such reco anyway + if flags.HeavyIon.Egamma.doSubtractedClusters: + isoCor[-1] = [ x for x in isoCor[-1] if x != isoPar.pileupCorrection ] isoExCor.append([]) kwargs['PFlowIsolationTool'] = cisoTool diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py index fcc402252159de7a5ff39cb7e9329a384018d34e..7651e72f1d3bd473517566ab623eddb2bf66b16a 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py +++ b/Reconstruction/RecoAlgs/IsolationAlgs/python/IsolationSteeringConfig.py @@ -18,9 +18,13 @@ def IsolationSteeringCfg(flags, name = 'IsolationSteering'): EMTopoInputAlgCfg, NFlowInputAlgCfg, DensityForIsoAlgCfg) if flags.Reco.EnableEgamma or flags.Reco.EnableCombinedMuon: if flags.Detector.EnableCalo: - acc.merge(EMTopoInputAlgCfg(flags)) - acc.merge(DensityForIsoAlgCfg(flags)) - acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForTopoIso')) + # do not compute density if HI with subtracted clusters + # since no pu correction in this case + if not flags.HeavyIon.Egamma.doSubtractedClusters: + acc.merge(EMTopoInputAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags)) + acc.merge(DensityForIsoAlgCfg(flags,name='ForwardDensityForTopoIso')) + # should be switch off also for HI, but if done, crash sowewhere else... if flags.Reco.EnablePFlow: acc.merge(NFlowInputAlgCfg(flags)) acc.merge(DensityForIsoAlgCfg(flags,name='CentralDensityForNFlowIso')) diff --git a/Reconstruction/RecoAlgs/IsolationAlgs/src/IsolationBuilder.cxx b/Reconstruction/RecoAlgs/IsolationAlgs/src/IsolationBuilder.cxx index 10323a0ed286b05ca0a4625c6f111d5d853024b5..8d893d4f550da0f80fdb6ce0bfb09afc584d7ced 100644 --- a/Reconstruction/RecoAlgs/IsolationAlgs/src/IsolationBuilder.cxx +++ b/Reconstruction/RecoAlgs/IsolationAlgs/src/IsolationBuilder.cxx @@ -29,56 +29,60 @@ IsolationBuilder::initialize() std::set<xAOD::Iso::IsolationFlavour> runIsoType; - ATH_MSG_DEBUG("Initializing central electrons"); - ATH_CHECK(initializeIso(runIsoType, - &m_elCaloIso, - &m_elTrackIso, - m_ElectronContainerName, - m_elisoInts, - m_elcorInts, - m_elcorIntsExtra, - m_customConfigEl)); - - ATH_MSG_DEBUG("Initializing central photons"); - ATH_CHECK(initializeIso(runIsoType, - &m_phCaloIso, - &m_phTrackIso, - m_PhotonContainerName, - m_phisoInts, - m_phcorInts, - m_phcorIntsExtra, - m_customConfigPh)); - - ATH_MSG_DEBUG("Initializing forward electrons"); - ATH_CHECK(initializeIso(runIsoType, - &m_feCaloIso, - nullptr, - m_FwdElectronContainerName, - m_feisoInts, - m_fecorInts, - m_fecorIntsExtra, - m_customConfigFwd)); - - ATH_MSG_DEBUG("Initializing muons"); - ATH_CHECK(initializeIso(runIsoType, - &m_muCaloIso, - &m_muTrackIso, - m_MuonContainerName, - m_muisoInts, - m_mucorInts, - m_mucorIntsExtra, - m_customConfigMu)); - - // declare the dependencies - // (need to do this since the WriteDecorHandleKeys are not properties - declareIso(m_elCaloIso); - declareIso(m_phCaloIso); - declareIso(m_feCaloIso); - declareIso(m_muCaloIso); - - declareIso(m_elTrackIso); - declareIso(m_phTrackIso); - declareIso(m_muTrackIso); + if (m_elisoInts.size()) { + ATH_MSG_DEBUG("Initializing central electrons"); + ATH_CHECK(initializeIso(runIsoType, + &m_elCaloIso, + &m_elTrackIso, + m_ElectronContainerName, + m_elisoInts, + m_elcorInts, + m_elcorIntsExtra, + m_customConfigEl)); + declareIso(m_elCaloIso); + declareIso(m_elTrackIso); + } + + if (m_phisoInts.size()) { + ATH_MSG_DEBUG("Initializing central photons"); + ATH_CHECK(initializeIso(runIsoType, + &m_phCaloIso, + &m_phTrackIso, + m_PhotonContainerName, + m_phisoInts, + m_phcorInts, + m_phcorIntsExtra, + m_customConfigPh)); + declareIso(m_phCaloIso); + declareIso(m_phTrackIso); + } + + if (m_feisoInts.size()) { + ATH_MSG_DEBUG("Initializing forward electrons"); + ATH_CHECK(initializeIso(runIsoType, + &m_feCaloIso, + nullptr, + m_FwdElectronContainerName, + m_feisoInts, + m_fecorInts, + m_fecorIntsExtra, + m_customConfigFwd)); + declareIso(m_feCaloIso); + } + + if (m_muisoInts.size()) { + ATH_MSG_DEBUG("Initializing muons"); + ATH_CHECK(initializeIso(runIsoType, + &m_muCaloIso, + &m_muTrackIso, + m_MuonContainerName, + m_muisoInts, + m_mucorInts, + m_mucorIntsExtra, + m_customConfigMu)); + declareIso(m_muCaloIso); + declareIso(m_muTrackIso); + } // Retrieve the tools (there three Calo ones are the same in fact) if (!m_cellIsolationTool.empty() && @@ -143,21 +147,35 @@ IsolationBuilder::execute(const EventContext& ctx) const } // Compute isolations - ATH_MSG_DEBUG("About to execute Electron calo iso"); - ATH_CHECK(executeCaloIso(m_elCaloIso, cellColl)); - ATH_MSG_DEBUG("About to execute Photon calo iso"); - ATH_CHECK(executeCaloIso(m_phCaloIso, cellColl)); - ATH_MSG_DEBUG("About to execute Forwerd Electron calo iso"); - ATH_CHECK(executeCaloIso(m_feCaloIso, cellColl)); - ATH_MSG_DEBUG("About to execute muon calo iso"); - ATH_CHECK(executeCaloIso(m_muCaloIso, cellColl)); - - ATH_MSG_DEBUG("About to execute Electron track iso"); - ATH_CHECK(executeTrackIso(m_elTrackIso)); - ATH_MSG_DEBUG("About to execute Photon track iso"); - ATH_CHECK(executeTrackIso(m_phTrackIso)); - ATH_MSG_DEBUG("About to execute Muon track iso"); - ATH_CHECK(executeTrackIso(m_muTrackIso)); + if (m_elCaloIso.size()) { + ATH_MSG_DEBUG("About to execute Electron calo iso"); + ATH_CHECK(executeCaloIso(m_elCaloIso, cellColl)); + } + if (m_phCaloIso.size()) { + ATH_MSG_DEBUG("About to execute Photon calo iso"); + ATH_CHECK(executeCaloIso(m_phCaloIso, cellColl)); + } + if (m_feCaloIso.size()) { + ATH_MSG_DEBUG("About to execute Forward Electron calo iso"); + ATH_CHECK(executeCaloIso(m_feCaloIso, cellColl)); + } + if (m_muCaloIso.size()) { + ATH_MSG_DEBUG("About to execute muon calo iso"); + ATH_CHECK(executeCaloIso(m_muCaloIso, cellColl)); + } + + if (m_elTrackIso.size()) { + ATH_MSG_DEBUG("About to execute Electron track iso"); + ATH_CHECK(executeTrackIso(m_elTrackIso)); + } + if (m_phTrackIso.size()) { + ATH_MSG_DEBUG("About to execute Photon track iso"); + ATH_CHECK(executeTrackIso(m_phTrackIso)); + } + if (m_muTrackIso.size()) { + ATH_MSG_DEBUG("About to execute Muon track iso"); + ATH_CHECK(executeTrackIso(m_muTrackIso)); + } return StatusCode::SUCCESS; } diff --git a/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx b/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx index e89132f5144090bff133d4ad74d01c8cb036de74..d824108de57dcdf077af96d71aabb7d889100994 100644 --- a/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx +++ b/Reconstruction/RecoTools/IsolationTool/Root/CaloIsolationTool.cxx @@ -519,9 +519,11 @@ namespace xAOD { } // do pile-up correction - std::string type = "PFlow"; - if (!EDCorrection(result,isoTypes,eta,type,nullptr)) - ATH_MSG_WARNING("Could not apply ED correction to eflow isolation for muon"); + if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) { + std::string type = "PFlow"; + if (!EDCorrection(result,isoTypes,eta,type,nullptr)) + ATH_MSG_WARNING("Could not apply ED correction to eflow isolation for muon"); + } return true; }