ATLAS Offline Software
Loading...
Searching...
No Matches
CaloIsolationTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ISOLATIONTOOL_CALOISOLATIONTOOL_H
6#define ISOLATIONTOOL_CALOISOLATIONTOOL_H
7
8#include "AsgTools/AsgTool.h"
10#include "AsgTools/ToolHandle.h"
12
13#ifndef XAOD_ANALYSIS
14// #include "GaudiKernel/ToolHandle.h"
24#endif // XAOD_ANALYSIS
25
31
34#include "xAODBase/IParticle.h"
36#include "xAODEgamma/Egamma.h"
37#include "xAODMuon/Muon.h"
41
42#include <vector>
43
44#include <map>
45#include <TGraph.h>
46
47namespace xAOD {
48
50 virtual public ICaloTopoClusterIsolationTool,
51 virtual public ICaloCellIsolationTool,
52 virtual public INeutralEFlowIsolationTool,
53 public asg::AsgTool {
55 public:
56 CaloIsolationTool(const std::string& name);
57 ~CaloIsolationTool(void); // destructor
58
59 virtual StatusCode initialize() override;
60 virtual StatusCode finalize()
61#ifndef XAOD_ANALYSIS
62 override
63#endif
64 ;
65
67 virtual
69 const IParticle& tp,
70 const std::vector<Iso::IsolationType>& cones,
71 const CaloCorrection& corrections,
72 const CaloClusterContainer* container = 0) const override;
74
76 virtual
77 bool caloCellIsolation(CaloIsolation& result, const IParticle& particle,
78 const std::vector<Iso::IsolationType>& cones,
79 const CaloCorrection& corrections,
80 const CaloCellContainer* container = 0) const override;
82
83
85 virtual
87 const IParticle& tp,
88 const std::vector<Iso::IsolationType>& cones,
89 const CaloCorrection& corrections) const override;
90
92
93 private:
95 // This never seems to have more than one entry???
96 typedef std::map<const IParticle*, const IParticle*> derefMap_t;
97
100#ifndef XAOD_ANALYSIS
101 const Muon& muon,
102#endif
103 const std::vector<Iso::IsolationType>& cones, const CaloCorrection& corrections
104#ifndef XAOD_ANALYSIS
105 , double coneCoreSize
106 , const derefMap_t& derefMap
107#endif
108 ) const;
109
111 bool caloCellIsolation( CaloIsolation& result, const Egamma& tp, const std::vector<Iso::IsolationType>& cones, const CaloCorrection& corrections
112#ifndef XAOD_ANALYSIS
114#endif
115 ) const;
116
120 const TrackParticle& tp,
121 const std::vector<Iso::IsolationType>& cones,
122 const CaloCorrection& corrections,
124 double coneCoreSize,
125 derefMap_t& derefMap) const;
126
130 const Egamma& tp,
131 const std::vector<Iso::IsolationType>& cones,
132 const CaloCorrection& corrections,
134 double coreConeSize) const;
135
138 const Egamma& eg,
139 const std::vector<Iso::IsolationType>& cones,
140 const CaloCorrection& corrections,
141 double coneCoreSize) const ;
142
145 const TrackParticle& tp,
146 const std::vector<Iso::IsolationType>& cones,
147 const CaloCorrection& corrections,
148 double coneCoreSize,
149 derefMap_t& derefMap) const;
150
151 // etcone computation for TrackParticle
152#ifndef XAOD_ANALYSIS
154 const std::vector<Iso::IsolationType>& isoTypes,
156 double coneCoreSize,
157 const derefMap_t& derefMap) const;
158#endif
159
160 // etcone computation for TrackParticle
161#ifndef XAOD_ANALYSIS
163 const std::vector<Iso::IsolationType>& isoTypes,
164 double coneCoreSize,
165 const derefMap_t& derefMap) const;
166#endif
167
168 // etcone computation for Egamma
169#ifndef XAOD_ANALYSIS
170 bool etConeIsolation( CaloIsolation& result, const Egamma& eg,
171 const std::vector<Iso::IsolationType>& isoTypes,
172 const CaloCellContainer* container ) const;
173#endif
174
175
176 // topoetcone computation (common for TrackParticle and Egamma)
177 bool topoConeIsolation(CaloIsolation& result, float eta, float phi,
178 std::vector<float>& coneSizes,
179 bool coreEMonly,
181 const CaloCluster* fwdClus,
182 const Egamma* egObj,
183 double coneCoreSize) const;
184
185 // sum of topo cluster in a cone
187 float eta,
188 float phi,
189 std::vector<float>& m_coneSizes,
190 const std::vector<const CaloCluster*>& clusts) const;
191
196 float eta,
197 float phi,
198 float dEtaMax_core,
199 float dPhiMax_core,
200 float dR2Max_core,
201 const std::vector<const CaloCluster*>& clusts,
202 bool onlyEM,
203 const CaloCluster* fwdClus,
204 const Egamma* egObj) const;
205
206 // pflow etcone computation (common for TrackParticle and Egamma)
208 float eta,
209 float phi,
210 std::vector<float>& m_coneSizes,
211 bool coreEMonly,
213 double coneCoreSize,
214 const Egamma *egObj = nullptr) const;
215
216 // sum of pt of pflow objects in a cone
218 float eta,
219 float phi,
220 std::vector<float>& m_coneSizes,
221 const std::vector<const FlowElement*>& clusts) const;
222
226 float eta,
227 float phi,
228 float detaMax,
229 float dphiMax,
230 float dR2Max,
231 const std::vector<const FlowElement*>& clusts,
232 bool onlyEM = false,
233 const Egamma *egObj = nullptr) const;
234
235 // core eg 5x7 egamma subtraction
238 const std::vector<Iso::IsolationType>& isoTypes,
239 const Egamma* eg) const;
240 // core for muon subtraction
242 const TrackParticle& tp,
243 const derefMap_t& derefMap) const;
244
245 // helper to get eta,phi of muon extrap
246 bool GetExtrapEtaPhi(const TrackParticle* tp, float& eta, float& phi,
247 derefMap_t& derefMap) const;
248
249 // pt correction (egamma)
251 const Egamma& eg,
252 const std::vector<Iso::IsolationType>& isoTypes) const;
253
254 // Correction for the underlying event
256 const std::vector<Iso::IsolationType>& isoTypes,
257 float eta,
258 const std::string& type,
259 const CaloCluster* fwdClus) const;
260
261 // init result structure
262 static void initresult(CaloIsolation& result, const CaloCorrection& corrlist, unsigned int typesize) ;
263
265 const IParticle* getReferenceParticle(const IParticle& particle) const;
266
267 // add the calo decoration -- FIXME! Change to use standard caching
268 void decorateTrackCaloPosition(const IParticle& particle, float eta, float phi) const;
269
270#ifndef XAOD_ANALYSIS
271 ToolHandle<Rec::IParticleCaloCellAssociationTool> m_assoTool {this,
272 "ParticleCaloCellAssociationTool",
273 "Rec::ParticleCaloCellAssociationTool/ParticleCaloCellAssociationTool"};
274
275 ToolHandle<Trk::IParticleCaloExtensionTool> m_caloExtTool {this,
276 "ParticleCaloExtensionTool",
277 "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"};
279
280 // clusters in cone tool
281 ToolHandle<ICaloClustersInConeTool> m_clustersInConeTool {this,
282 "ClustersInConeTool",
283 "xAOD::CaloClustersInConeTool/CaloClustersInConeTool"};
284
285 // pflow objects in cone tool
286 ToolHandle<IFlowElementsInConeTool> m_pflowObjectsInConeTool {this,
287 "FlowElementsInConeTool", ""};
288
290 ToolHandle<CaloClusterProcessor> m_caloFillRectangularTool {this,
291 "CaloFillRectangularClusterTool", "",
292 "Handle of the CaloFillRectangularClusterTool"};
293
295 Gaudi::Property<bool> m_useCaloExtensionCaching {this,
296 "UseCaloExtensionCaching", true,
297 "Use cached caloExtension if avaliable."};
298
301 this, "InputCaloExtension", "", "The calorimeter extensions of the tracks"};
302
304 SG::ReadCondHandleKey<CaloDetDescrManager> m_caloMgrKey{this,"CaloDetDescrManager", "CaloDetDescrManager"};
305#endif // XAOD_ANALYSIS
306
308 ToolHandle<CP::IIsolationCorrectionTool> m_IsoLeakCorrectionTool {this,
309 "IsoLeakCorrectionTool", "",
310 "Handle on the leakage correction tool"};
311
313 Gaudi::Property<std::vector<int> > m_EMCaloNums {this,
314 "EMCaloNums", {}, "list of EM calo to treat"};
315
317 Gaudi::Property<std::vector<int> > m_HadCaloNums {this,
318 "HadCaloNums", {}, "list of Had calo to treat"};
319
322
324 Gaudi::Property<bool> m_useEMScale {this,
325 "UseEMScale", true,
326 "Use TopoClusters at the EM scale."};
327
329 Gaudi::Property<bool> m_doEnergyDensityCorrection {this,
330 "doEnergyDensityCorrection", true,
331 "Correct isolation variables based on energy density estimations"};
332
334 Gaudi::Property<bool> m_saveOnlyRequestedCorrections {this,
335 "saveOnlyRequestedCorrections", false,
336 "save only requested corrections (trigger usage mainly)"};
337
339 Gaudi::Property<bool> m_ExcludeTG3 {this,
340 "ExcludeTG3", true, "Exclude the TileGap3 cells"};
341
344 "TopoClusterEDCentralContainer", "TopoClusterIsoCentralEventShape",
345 "Name of TopoCluster ED Central"};
346
349 "TopoClusterEDForwardContainer", "TopoClusterIsoForwardEventShape",
350 "Name of TopoCluster ED Forward"};
351
354 "EFlowEDCentralContainer", "NeutralParticleFlowIsoCentralEventShape",
355 "Name of energy flow ED Central"};
356
359 "EFlowEDForwardContainer", "NeutralParticleFlowIsoForwardEventShape",
360 "Name of energy flow ED Forward"};
361
363 Gaudi::Property<double> m_coneCoreSizeEg {this,
364 "coneCoreSizeEg", 0.1,
365 "size of the coneCore core energy correction for egamma objects"};
366
367 Gaudi::Property<double> m_coneCoreSizeMu {this,
368 "coneCoreSizeMu", 0.05,
369 "size of the coneCore core energy correction for muons"};
370
372 std::map<const IParticle*, const IParticle*> m_derefMap;
373
375 Gaudi::Property<bool> m_InitializeReadHandles {this,
376 "InitializeReadHandles", true,
377 "Initialize all ReadHandles."};
378
380 Gaudi::Property<bool> m_isMC {this, "isMC", false, "is MC"};
381
383 Gaudi::Property<bool> m_useEtaDepPU {this,
384 "UseEtaDepPUCorr", true, "Use the eta dependent pileup correction"};
385
387 Gaudi::Property<std::string> m_puZetaCorrectionFileName {this,
388 "EtaDependentPileupCorrectionFileName", "IsolationCorrections/v4/zetas.root",
389 "File name for the eta dependant pileup correction to isolation"};
390 Gaudi::Property<std::string> m_puZetaMCCorrectionFileName {this,
391 "EtaDependentPileupMCCorrectionFileName", "IsolationCorrections/v4/zetas_correction.root",
392 "File name for the eta dependant pileup correction to isolation, small mc correction"};
393
395 std::map<Iso::IsolationType,std::unique_ptr<TGraph>> m_puZetaCorrection;
396 std::map<Iso::IsolationType,std::unique_ptr<TGraph>> m_puZetaMCCorrection;
397
398#ifdef XAOD_ANALYSIS // particlesInCone tool will not be avaible. Write our own...
399 bool particlesInCone( float eta, float phi, float dr, std::vector<const CaloCluster*>& clusts ) const;
400 bool particlesInCone( float eta, float phi, float dr, std::vector<const FlowElement*>& clusts ) const;
401#endif // XAOD_ANALYSIS
402 float Phi_mpi_pi(float x) const {
403 while (x >= M_PI) x -= 2.*M_PI;
404 while (x < -M_PI) x += 2.*M_PI;
405 return x;
406 }
407 };
408
409} // end of namespace
410
411#endif
412
413
#define M_PI
Scalar eta() const
pseudorapidity method
#define ASG_TOOL_CLASS3(CLASSNAME, INT1, INT2, INT3)
Property holding a SG store/key/clid from which a ReadHandle is made.
Base class for cluster processing tools called from CaloClusterMaker that operate on individual clust...
Definition of CaloDetDescrManager.
#define x
Container class for CaloCell.
Property holding a SG store/key/clid from which a ReadHandle is made.
helper class to encode and decode a TrackParametersIdentifier
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
virtual bool caloCellIsolation(CaloIsolation &result, const IParticle &particle, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloCellContainer *container=0) const override
ICaloCellIsolationTool interface for cell isolation: The tool expects the cones to be order in decrea...
bool PtCorrection(CaloIsolation &result, const Egamma &eg, const std::vector< Iso::IsolationType > &isoTypes) const
bool GetExtrapEtaPhi(const TrackParticle *tp, float &eta, float &phi, derefMap_t &derefMap) const
Gaudi::Property< bool > m_doEnergyDensityCorrection
Property: do the ED corrections to topoisolation.
Gaudi::Property< std::vector< int > > m_HadCaloNums
vector of calo-id to treat
bool pflowObjCones(CaloIsolation &result, float eta, float phi, std::vector< float > &m_coneSizes, const std::vector< const FlowElement * > &clusts) const
Calculate isolation cones in pflow objects around eg.
bool correctIsolationEnergy_MuonCore(CaloIsolation &result, const TrackParticle &tp, const derefMap_t &derefMap) const
bool etConeIsolation(CaloIsolation &result, const TrackParticle &tp, const std::vector< Iso::IsolationType > &isoTypes, const CaloCellContainer *container, double coneCoreSize, const derefMap_t &derefMap) const
Gaudi::Property< bool > m_InitializeReadHandles
Property: Initialize read Handles.
bool pflowConeIsolation(CaloIsolation &result, float eta, float phi, std::vector< float > &m_coneSizes, bool coreEMonly, const FlowElementContainer *container, double coneCoreSize, const Egamma *egObj=nullptr) const
bool correctIsolationEnergy_Eeg57(CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, const Egamma *eg) const
void decorateTrackCaloPosition(const IParticle &particle, float eta, float phi) const
SG::ReadHandleKey< EventShape > m_efEDForward
Property: Name of the forward neutral energy flow energy-density container.
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool
ToolHandle< IFlowElementsInConeTool > m_pflowObjectsInConeTool
ToolHandle< CaloClusterProcessor > m_caloFillRectangularTool
Property: calo cluster filling tool.
Trk::TrackParametersIdHelper m_parsIdHelper
SG::ReadHandleKey< EventShape > m_efEDCentral
Property: Name of the central neutral energy flow energy-density container.
std::map< Iso::IsolationType, std::unique_ptr< TGraph > > m_puZetaCorrection
map of the zeta corrections (one / cone size)
Gaudi::Property< bool > m_useEtaDepPU
Property: use pileup dependent correction.
Gaudi::Property< double > m_coneCoreSizeEg
Property: The size of the coneCore core energy calculation.
bool correctIsolationEnergy_pflowCore(CaloIsolation &result, float eta, float phi, float detaMax, float dphiMax, float dR2Max, const std::vector< const FlowElement * > &clusts, bool onlyEM=false, const Egamma *egObj=nullptr) const
Correct the pflow isolation using sum of pflow objects in core region.
virtual StatusCode finalize() override
SG::ReadHandleKey< CaloExtensionCollection > m_caloExtensionKey
The input calorimeter extensions.
float Phi_mpi_pi(float x) const
static void initresult(CaloIsolation &result, const CaloCorrection &corrlist, unsigned int typesize)
virtual bool caloTopoClusterIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloClusterContainer *container=0) const override
ICaloTopoClusterIsolationTool interface:
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::map< const IParticle *, const IParticle * > derefMap_t
map to the orignal particle
ToolHandle< Rec::IParticleCaloCellAssociationTool > m_assoTool
CaloIsolationTool(const std::string &name)
Gaudi::Property< std::string > m_puZetaCorrectionFileName
name of the root file for the eta dependant pileup correction
Gaudi::Property< bool > m_ExcludeTG3
Property: exclude tile scintillator.
SG::ReadHandleKey< EventShape > m_tpEDForward
Property: Name of the forward topocluster energy-density container.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
CaloDetDescrManager from ConditionStore.
Gaudi::Property< bool > m_useEMScale
Property: Use TopoClusters at the EM scale.
SG::ReadHandleKey< EventShape > m_tpEDCentral
Property: Name of the central topocluster energy-density container.
Gaudi::Property< std::string > m_puZetaMCCorrectionFileName
const IParticle * getReferenceParticle(const IParticle &particle) const
get reference particle
ToolHandle< ICaloClustersInConeTool > m_clustersInConeTool
Gaudi::Property< bool > m_saveOnlyRequestedCorrections
Property: save only requested corrections (trigger usage mainly)
Gaudi::Property< double > m_coneCoreSizeMu
bool correctIsolationEnergy_TopoCore(CaloIsolation &result, float eta, float phi, float dEtaMax_core, float dPhiMax_core, float dR2Max_core, const std::vector< const CaloCluster * > &clusts, bool onlyEM, const CaloCluster *fwdClus, const Egamma *egObj) const
Correct the topo cluster isolation using sum of topo cluster in core region.
Gaudi::Property< bool > m_isMC
Property: need to know if this is MC (from rec.doTruth) for eta dep pileup corr.
Gaudi::Property< bool > m_useCaloExtensionCaching
Property: Use cached caloExtension if avaliable.
Gaudi::Property< std::vector< int > > m_EMCaloNums
vector of calo-id to treat
bool topoClustCones(CaloIsolation &result, float eta, float phi, std::vector< float > &m_coneSizes, const std::vector< const CaloCluster * > &clusts) const
Calculate isolation cones in topo clusters around eg.
bool EDCorrection(CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, float eta, const std::string &type, const CaloCluster *fwdClus) const
virtual bool neutralEflowIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections) const override
INeutralEFlowIsolationTool interface:
std::map< Iso::IsolationType, std::unique_ptr< TGraph > > m_puZetaMCCorrection
ToolHandle< CP::IIsolationCorrectionTool > m_IsoLeakCorrectionTool
Tool for pt-corrected isolation calculation (new)
bool topoConeIsolation(CaloIsolation &result, float eta, float phi, std::vector< float > &coneSizes, bool coreEMonly, const CaloClusterContainer *container, const CaloCluster *fwdClus, const Egamma *egObj, double coneCoreSize) const
std::string m_CaloCalTopoCluster
Topo Calo cluster location in event store.
std::map< const IParticle *, const IParticle * > m_derefMap
map to the orignal particle
interface for tools calculating track isolation
virtual bool caloCellIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloCellContainer *container=0) const =0
ICaloCellIsolationTool interface for cell isolation: The tool expects the cones to be order in decrea...
interface for tools calculating topo cluster isolation
virtual bool caloTopoClusterIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloClusterContainer *container=0) const =0
ICaloTopoClusterIsolationTool interface for cluster isolation: The tool expects the cones to be order...
interface for tools calculating neutral eflow isolation
virtual bool neutralEflowIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections) const =0
INeutralEFlowIsolationTool interface for eflow isolation: The tool expects the cones to be order in d...
Class providing the definition of the 4-vector interface.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
FlowElementContainer_v1 FlowElementContainer
Definition of the current "pfo container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.