ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::CaloIsolationTool Class Reference

#include <CaloIsolationTool.h>

Inheritance diagram for xAOD::CaloIsolationTool:

Public Member Functions

 CaloIsolationTool (const std::string &name)
 ~CaloIsolationTool (void)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode finalize () override
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 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 decreasing order (etcone40 -> etcone20) Internally it reorders the cones so the output isolation values are also in the same order.
virtual bool neutralEflowIsolation (CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections) const override
 INeutralEFlowIsolationTool interface:
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef std::map< const IParticle *, const IParticle * > derefMap_t
 map to the orignal particle
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool caloCellIsolation (CaloIsolation &result, const Muon &muon, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, double coneCoreSize, const derefMap_t &derefMap) const
 cast for Muon (etcone muon)
bool caloCellIsolation (CaloIsolation &result, const Egamma &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloCellContainer *container) const
 cast for egamma (etcone egamma)
bool caloTopoClusterIsolation (CaloIsolation &result, const TrackParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloClusterContainer *container, double coneCoreSize, derefMap_t &derefMap) const
 cast for TrackParticle (topoetcone muon)
bool caloTopoClusterIsolation (CaloIsolation &result, const Egamma &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, const CaloClusterContainer *container, double coreConeSize) const
 cast for egamma (topoetcone egamma)
bool neutralEflowIsolation (CaloIsolation &result, const Egamma &eg, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, double coneCoreSize) const
 cast for egamma (pflowetcone egamma)
bool neutralEflowIsolation (CaloIsolation &result, const TrackParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections, double coneCoreSize, derefMap_t &derefMap) const
 cast for egamma (pflowetcone egamma)
bool etConeIsolation (CaloIsolation &result, const TrackParticle &tp, const std::vector< Iso::IsolationType > &isoTypes, const CaloCellContainer *container, double coneCoreSize, const derefMap_t &derefMap) const
bool etConeIsolation (CaloIsolation &result, const Muon &muon, const std::vector< Iso::IsolationType > &isoTypes, double coneCoreSize, const derefMap_t &derefMap) const
bool etConeIsolation (CaloIsolation &result, const Egamma &eg, const std::vector< Iso::IsolationType > &isoTypes, const CaloCellContainer *container) const
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
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 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.
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 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_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.
bool correctIsolationEnergy_Eeg57 (CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, const Egamma *eg) const
bool correctIsolationEnergy_MuonCore (CaloIsolation &result, const TrackParticle &tp, const derefMap_t &derefMap) const
bool GetExtrapEtaPhi (const TrackParticle *tp, float &eta, float &phi, derefMap_t &derefMap) const
bool PtCorrection (CaloIsolation &result, const Egamma &eg, const std::vector< Iso::IsolationType > &isoTypes) const
bool EDCorrection (CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, float eta, const std::string &type, const CaloCluster *fwdClus) const
const IParticlegetReferenceParticle (const IParticle &particle) const
 get reference particle
void decorateTrackCaloPosition (const IParticle &particle, float eta, float phi) const
float Phi_mpi_pi (float x) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void initresult (CaloIsolation &result, const CaloCorrection &corrlist, unsigned int typesize)

Private Attributes

ToolHandle< Rec::IParticleCaloCellAssociationToolm_assoTool
ToolHandle< Trk::IParticleCaloExtensionToolm_caloExtTool
Trk::TrackParametersIdHelper m_parsIdHelper
ToolHandle< ICaloClustersInConeToolm_clustersInConeTool
ToolHandle< IFlowElementsInConeToolm_pflowObjectsInConeTool
ToolHandle< CaloClusterProcessorm_caloFillRectangularTool
 Property: calo cluster filling tool.
Gaudi::Property< boolm_useCaloExtensionCaching
 Property: Use cached caloExtension if avaliable.
SG::ReadHandleKey< CaloExtensionCollectionm_caloExtensionKey
 The input calorimeter extensions.
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
 CaloDetDescrManager from ConditionStore.
ToolHandle< CP::IIsolationCorrectionToolm_IsoLeakCorrectionTool
 Tool for pt-corrected isolation calculation (new)
Gaudi::Property< std::vector< int > > m_EMCaloNums
 vector of calo-id to treat
Gaudi::Property< std::vector< int > > m_HadCaloNums
 vector of calo-id to treat
std::string m_CaloCalTopoCluster
 Topo Calo cluster location in event store.
Gaudi::Property< boolm_useEMScale
 Property: Use TopoClusters at the EM scale.
Gaudi::Property< boolm_doEnergyDensityCorrection
 Property: do the ED corrections to topoisolation.
Gaudi::Property< boolm_saveOnlyRequestedCorrections
 Property: save only requested corrections (trigger usage mainly)
Gaudi::Property< boolm_ExcludeTG3
 Property: exclude tile scintillator.
SG::ReadHandleKey< EventShapem_tpEDCentral
 Property: Name of the central topocluster energy-density container.
SG::ReadHandleKey< EventShapem_tpEDForward
 Property: Name of the forward topocluster energy-density container.
SG::ReadHandleKey< EventShapem_efEDCentral
 Property: Name of the central neutral energy flow energy-density container.
SG::ReadHandleKey< EventShapem_efEDForward
 Property: Name of the forward neutral energy flow energy-density container.
Gaudi::Property< doublem_coneCoreSizeEg
 Property: The size of the coneCore core energy calculation.
Gaudi::Property< doublem_coneCoreSizeMu
std::map< const IParticle *, const IParticle * > m_derefMap
 map to the orignal particle
Gaudi::Property< boolm_InitializeReadHandles
 Property: Initialize read Handles.
Gaudi::Property< boolm_isMC {this, "isMC", false, "is MC"}
 Property: need to know if this is MC (from rec.doTruth) for eta dep pileup corr.
Gaudi::Property< boolm_useEtaDepPU
 Property: use pileup dependent correction.
Gaudi::Property< std::string > m_puZetaCorrectionFileName
 name of the root file for the eta dependant pileup correction
Gaudi::Property< std::string > m_puZetaMCCorrectionFileName
std::map< Iso::IsolationType, std::unique_ptr< TGraph > > m_puZetaCorrection
 map of the zeta corrections (one / cone size)
std::map< Iso::IsolationType, std::unique_ptr< TGraph > > m_puZetaMCCorrection
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 49 of file CaloIsolationTool.h.

Member Typedef Documentation

◆ derefMap_t

typedef std::map<const IParticle*, const IParticle*> xAOD::CaloIsolationTool::derefMap_t
private

map to the orignal particle

Definition at line 96 of file CaloIsolationTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CaloIsolationTool()

xAOD::CaloIsolationTool::CaloIsolationTool ( const std::string & name)

Definition at line 55 of file CaloIsolationTool.cxx.

55 :
56 asg::AsgTool(name)
57 {
58#ifndef XAOD_ANALYSIS
59 declareInterface<ICaloCellIsolationTool>(this);
60 declareInterface<ICaloTopoClusterIsolationTool>(this);
61 declareInterface<INeutralEFlowIsolationTool>(this);
62#endif // XAOD_ANALYSIS
63 }

◆ ~CaloIsolationTool()

xAOD::CaloIsolationTool::~CaloIsolationTool ( void )
default

Member Function Documentation

◆ caloCellIsolation() [1/3]

bool xAOD::CaloIsolationTool::caloCellIsolation ( CaloIsolation & result,
const Egamma & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
const CaloCellContainer * container ) const
private

cast for egamma (etcone egamma)

Definition at line 307 of file CaloIsolationTool.cxx.

313 {
314 if( isoTypes.empty() ) {
315 ATH_MSG_WARNING("Empty list passed, failing calculation");
316 return false;
317 }
318
319 unsigned int typesize = isoTypes.size();
320 initresult(result, corrlist, typesize);
321
322 std::vector<float> coneSizes;
323 coneSizes.resize(isoTypes.size());
324 for (unsigned int is = 0; is < isoTypes.size(); is++)
325 coneSizes[is] = Iso::coneSize(isoTypes[is]);
326
327 // get cones
328 Iso::IsolationFlavour theFlavour = Iso::isolationFlavour(isoTypes.front());
329
330 if (theFlavour == Iso::etcone){
331#ifndef XAOD_ANALYSIS
332 etConeIsolation(result, eg, isoTypes, container);
333#else
334 return true;
335#endif
336 }else{
337 ATH_MSG_WARNING("Unsupported isolation flavour passed, cannot calculate isolation " << static_cast<int>(theFlavour));
338 return false;
339 }
340
341 // Apply corrections
342 // core energy subtraction
343 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))) {
344 if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg))
345 ATH_MSG_WARNING("Could not compute core cell energy for egamma in etcone");
346 }
347
348 // leakage correction
349 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) {
350 if (!PtCorrection(result, eg, isoTypes))
351 ATH_MSG_WARNING("Could not apply pt correction to etcone isolation");
352 }
353
354 return true;
355 }
#define ATH_MSG_WARNING(x)
bool PtCorrection(CaloIsolation &result, const Egamma &eg, const std::vector< Iso::IsolationType > &isoTypes) const
bool etConeIsolation(CaloIsolation &result, const TrackParticle &tp, const std::vector< Iso::IsolationType > &isoTypes, const CaloCellContainer *container, double coneCoreSize, const derefMap_t &derefMap) const
bool correctIsolationEnergy_Eeg57(CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, const Egamma *eg) const
static void initresult(CaloIsolation &result, const CaloCorrection &corrlist, unsigned int typesize)
Gaudi::Property< bool > m_saveOnlyRequestedCorrections
Property: save only requested corrections (trigger usage mainly)
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
@ etcone
Calorimeter isolation.
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size

◆ caloCellIsolation() [2/3]

bool xAOD::CaloIsolationTool::caloCellIsolation ( CaloIsolation & result,
const IParticle & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
const CaloCellContainer * container = 0 ) const
overridevirtual

ICaloCellIsolationTool interface for cell isolation: The tool expects the cones to be order in decreasing order (etcone40 -> etcone20) Internally it reorders the cones so the output isolation values are also in the same order.

Parameters
[in]resultoutput object to be filled
[in]tpinput iparticle
[in]conesvector of input cones to be used
[in]correctionsbitset specifying which corrections to apply to isolation
[in]containercell contrainer (for trigger only)
Returns
true if the calculation was successfull

get track particle

Implements xAOD::ICaloCellIsolationTool.

Definition at line 161 of file CaloIsolationTool.cxx.

164 {
165#ifdef XAOD_ANALYSIS
166 (void) result;
167 (void) particle;
168 (void) cones;
169 (void) corrlist;
170 (void) container;
171 return false;
172#else // XAOD_ANALYSIS
173 derefMap_t derefMap;
175 const IParticle* ip = getReferenceParticle(particle);
176 if( !ip ){
177 ATH_MSG_WARNING("Failed to obtain reference particle");
178 return false;
179 }
180 derefMap[ip] = &particle;
181
182 double coneCoreSize = m_coneCoreSizeEg;
183 if (particle.type() == Type::Muon)
184 coneCoreSize = m_coneCoreSizeMu;
185
186 // muon etcone isolation
187 const Muon* muon = dynamic_cast<const Muon*>(&particle);
188 if(muon) return caloCellIsolation(result,*muon,cones,corrlist,coneCoreSize,derefMap);
189
190 // egamma etcone isolation
191 const Egamma* egam = dynamic_cast<const Egamma*>(ip);
192 if( egam ) return caloCellIsolation(result,*egam,cones,corrlist,container);
193
194 ATH_MSG_WARNING("CaloCellIsolation only supported for Muons and Egamma");
195
196 return true;
197#endif // not XAOD_ANALYSIS
198 }
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...
Gaudi::Property< double > m_coneCoreSizeEg
Property: The size of the coneCore core energy calculation.
std::map< const IParticle *, const IParticle * > derefMap_t
map to the orignal particle
const IParticle * getReferenceParticle(const IParticle &particle) const
get reference particle
Gaudi::Property< double > m_coneCoreSizeMu
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Egamma_v1 Egamma
Definition of the current "egamma version".
Definition Egamma.h:17
Muon_v1 Muon
Reference the current persistent version:

◆ caloCellIsolation() [3/3]

bool xAOD::CaloIsolationTool::caloCellIsolation ( CaloIsolation & result,
const Muon & muon,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
double coneCoreSize,
const derefMap_t & derefMap ) const
private

cast for Muon (etcone muon)

Definition at line 272 of file CaloIsolationTool.cxx.

281 {
282 if( isoTypes.empty() ) {
283 ATH_MSG_WARNING("Empty list passed, failing calculation");
284 return false;
285 }
286
287 unsigned int typesize = isoTypes.size();
288 initresult(result, corrlist, typesize);
289
290 // get cones
291 Iso::IsolationFlavour theFlavour = Iso::isolationFlavour(isoTypes.front());
292
293 if (theFlavour == Iso::etcone)
294#ifndef XAOD_ANALYSIS
295 return etConeIsolation(result, muon, isoTypes, coneCoreSize, derefMap);
296#else
297 return true;
298#endif
299
300 ATH_MSG_WARNING("Unsupported isolation flavour passed, cannot calculate isolation " <<
301 static_cast<int>(theFlavour));
302
303 return false;
304 }

◆ caloTopoClusterIsolation() [1/3]

bool xAOD::CaloIsolationTool::caloTopoClusterIsolation ( CaloIsolation & result,
const Egamma & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
const CaloClusterContainer * container,
double coreConeSize ) const
private

cast for egamma (topoetcone egamma)

Definition at line 358 of file CaloIsolationTool.cxx.

364 {
365
366 if( isoTypes.empty() ) {
367 ATH_MSG_WARNING("Empty list passed, failing calculation");
368 return false;
369 }
370
371 unsigned int typesize = isoTypes.size();
372 initresult(result, corrlist, typesize);
373
374 std::vector<float> coneSizes;
375 coneSizes.reserve(isoTypes.size());
376
377 for( auto isoType : isoTypes ){
378 coneSizes.push_back(Iso::coneSize(isoType));
379 }
380
381 float phi = eg.caloCluster()->phi();
382 float eta = eg.caloCluster()->eta();
383
384 const CaloCluster* fwdClus = eg.author(xAOD::EgammaParameters::AuthorFwdElectron) ? eg.caloCluster() : nullptr;
385
386 if (!topoConeIsolation(result, eta, phi, coneSizes, true, container, fwdClus, &eg, coneCoreSize)) {
387 ATH_MSG_WARNING("topoConeIsolation failed for egamma");
388 return false;
389 }
390
391 // 5x7 : no meaning for fwd electron
392 if (fwdClus == nullptr && (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells)))) {
393 // Apply core energy subtraction
394 if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg))
395 ATH_MSG_WARNING("Could not compute core cell energy for egamma in topoetcone");
396 }
397
398 // leakage : at least for the time being, no meaning for fwd electron
399 if ((!m_saveOnlyRequestedCorrections && fwdClus == nullptr) || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) {
400 // do pt correction
401 if (!PtCorrection(result, eg, isoTypes))
402 ATH_MSG_WARNING("Could not apply pt correction to topoetcone isolation");
403 }
404 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) {
405 // do pile-up correction
406 if (!EDCorrection(result,isoTypes,eta,"topo",fwdClus))
407 ATH_MSG_WARNING("Could not apply ED correction to topo isolation");
408 }
409
410 return true;
411
412 }
Scalar eta() const
pseudorapidity method
bool EDCorrection(CaloIsolation &result, const std::vector< Iso::IsolationType > &isoTypes, float eta, const std::string &type, const CaloCluster *fwdClus) const
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
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ caloTopoClusterIsolation() [2/3]

bool xAOD::CaloIsolationTool::caloTopoClusterIsolation ( CaloIsolation & result,
const IParticle & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
const CaloClusterContainer * container = 0 ) const
overridevirtual

ICaloTopoClusterIsolationTool interface:

get track particle

Implements xAOD::ICaloTopoClusterIsolationTool.

Definition at line 201 of file CaloIsolationTool.cxx.

204 {
205
206 if ( cones.empty() ) {
207 ATH_MSG_DEBUG("No isolation required");
208 return false;
209 }
210
211 double coneCoreSize = m_coneCoreSizeEg;
212 if (particle.type() == Type::Muon)
213 coneCoreSize = m_coneCoreSizeMu;
214
215 derefMap_t derefMap;
217 const IParticle* ip = getReferenceParticle(particle);
218 if( !ip ){
219 ATH_MSG_WARNING("Failed to obtain reference particle");
220 return false;
221 }
222 derefMap[ip] = &particle;
223
224 // muon topoetcone isolation
225 const TrackParticle* trkp = dynamic_cast<const TrackParticle*>(ip);
226 if( trkp ) return caloTopoClusterIsolation(result,*trkp,cones,corrlist,container,coneCoreSize,derefMap);
227
228 // egamma topoetcone isolation
229 const Egamma* egam = dynamic_cast<const Egamma*>(ip);
230 if( egam ) return caloTopoClusterIsolation(result,*egam,cones,corrlist,container, coneCoreSize);
231
232 ATH_MSG_WARNING("CaloTopoClusterIsolation only supported for TrackParticles and Egamma");
233
234 return true;
235 }
#define ATH_MSG_DEBUG(x)
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:
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ caloTopoClusterIsolation() [3/3]

bool xAOD::CaloIsolationTool::caloTopoClusterIsolation ( CaloIsolation & result,
const TrackParticle & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
const CaloClusterContainer * container,
double coneCoreSize,
derefMap_t & derefMap ) const
private

cast for TrackParticle (topoetcone muon)

Definition at line 629 of file CaloIsolationTool.cxx.

635 {
636 if( isoTypes.empty() ) {
637 ATH_MSG_WARNING("Empty list passed, failing calculation");
638 return false;
639 }
640
641 unsigned int typesize = isoTypes.size();
642 initresult(result, corrlist, typesize);
643 std::vector<float> coneSizes;
644 coneSizes.reserve(isoTypes.size());
645
646for( auto isoType : isoTypes ){
647 coneSizes.push_back(Iso::coneSize(isoType));
648 }
649
650 float phi = tp.phi();
651 float eta = tp.eta();
652 if(!GetExtrapEtaPhi(&tp,eta,phi,derefMap)) ATH_MSG_WARNING("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << " not updated from extraplation!");
653 ATH_MSG_DEBUG("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << ", extrap eta = " << eta << ", phi = " << phi);
654
655 // get energy in cones
656 if (!topoConeIsolation(result, eta, phi, coneSizes, false, container, nullptr, nullptr, coneCoreSize)) {
657 ATH_MSG_WARNING("Could not compute topo isolation for muons");
658 return false;
659 }
660
661 // core energy subtraction
662 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))) {
663 if (!correctIsolationEnergy_MuonCore(result, tp, derefMap))
664 ATH_MSG_WARNING("Could not compute muon core energy (cells) from topoetcone");
665 }
666
667 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) {
668 if (!EDCorrection(result,isoTypes,eta,"topo",nullptr))
669 ATH_MSG_WARNING("Could not apply ED correction to topo isolation");
670 }
671
672 return true;
673 }
bool GetExtrapEtaPhi(const TrackParticle *tp, float &eta, float &phi, derefMap_t &derefMap) const
bool correctIsolationEnergy_MuonCore(CaloIsolation &result, const TrackParticle &tp, const derefMap_t &derefMap) const

◆ correctIsolationEnergy_Eeg57()

bool xAOD::CaloIsolationTool::correctIsolationEnergy_Eeg57 ( CaloIsolation & result,
const std::vector< Iso::IsolationType > & isoTypes,
const Egamma * eg ) const
private

Definition at line 1123 of file CaloIsolationTool.cxx.

1126 {
1127
1128 float coreV = 0;
1129 bool gotIso = eg->isolationCaloCorrection(coreV,Iso::etcone, Iso::core57cells, Iso::coreEnergy);
1130 if (gotIso)
1131 ATH_MSG_DEBUG("core57cells available = " << coreV);
1132 else
1133 ATH_MSG_DEBUG("core57cells not available");
1134 if ((gotIso && fabs(coreV) < 1e-3) || !gotIso) {
1135#ifndef XAOD_ANALYSIS
1136 const CaloCluster *cleg = eg->caloCluster();
1137 // now correct the isolation energy for the core cluster energy
1138 float eraw57=0., eta=0.;
1139
1140 if(cleg && cleg->getCellLinks()){
1141 double seedEta = cleg->eta0(), seedPhi = cleg->phi0();
1142 std::unique_ptr<CaloCluster> egcCloneFor57 = CaloClusterStoreHelper::makeCluster(cleg->getCellLinks()->getCellContainer(),
1143 seedEta,seedPhi,
1144 cleg->clusterSize());
1145
1146 if (!m_caloFillRectangularTool->execute (Gaudi::Hive::currentContext(),
1147 egcCloneFor57.get()).isSuccess())
1148 {
1149 return false;
1150 }
1151 if(egcCloneFor57->size()==0){
1152 ATH_MSG_WARNING("Size of Created Cluster is 0 aka no cells");
1153 return false;
1154 }
1155
1156 eraw57 = egcCloneFor57->e();
1157 eta = cleg->eta(); //FillRectangularCluster doesn't recalculated the overall cluster eta (only per-sampling)
1158 coreV = eraw57/cosh(eta);
1159 ATH_MSG_DEBUG("Number of cells in 5x7 " << egcCloneFor57->size()
1160 << " seed eta,phi " << cleg->eta0() << " " << cleg->phi0()
1161 << " eraw = " << eraw57 << " etraw = " << coreV
1162 );
1163 }
1164#else
1165 return false;
1166#endif // XAOD_ANALYSIS
1167 }
1168
1169 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1170 corecorr[Iso::coreEnergy] = coreV;
1171 corecorr[Iso::coreArea] = 5*0.025*7*TMath::Pi()/128;
1172 result.coreCorrections[Iso::core57cells] = corecorr;
1173 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))) {
1174 for (unsigned int i = 0; i < isoTypes.size(); i++){
1175 result.etcones[i] -= coreV;
1176 }
1177 }
1178
1179 return true;
1180 }
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
double eta0() const
Returns raw of cluster seed.
virtual double eta() const
Retrieve eta independent of signal state.
double phi0() const
Returns raw of cluster seed.
const CaloCellContainer * getCellContainer(const CaloCell *pCell) const
Retrieve the pointer to the original cell container for a given cell.
ToolHandle< CaloClusterProcessor > m_caloFillRectangularTool
Property: calo cluster filling tool.
@ coreArea
area used to calculate this correction

◆ correctIsolationEnergy_MuonCore()

bool xAOD::CaloIsolationTool::correctIsolationEnergy_MuonCore ( CaloIsolation & result,
const TrackParticle & tp,
const derefMap_t & derefMap ) const
private

Definition at line 1438 of file CaloIsolationTool.cxx.

1440 {
1441
1442 ATH_MSG_DEBUG("in CaloIsolationTool::correctIsolationEnergy_MuonCore ");
1443
1444 // initialize varialbes
1445 double ecore = 0.;
1446 auto muI = derefMap.find(&tp);
1447 static const SG::ConstAccessor<float> ET_CoreAcc ("ET_Core");
1448 if(muI!=derefMap.end()){
1449 ecore = ET_CoreAcc.withDefault (*muI->second, 0);
1450 }else{
1451 ATH_MSG_WARNING("ET_Core of muon not found! coreMuon isolation correction will not be applied!!!");
1452 return false;
1453 }
1454
1455 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1456 corecorr[Iso::coreEnergy] = ecore;
1457 corecorr[Iso::coreArea] = 0;
1458 result.coreCorrections[Iso::coreMuon] = corecorr;
1459
1460 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))) {
1461 for( unsigned int i=0;i<result.etcones.size();++i ) {
1462 result.etcones[i] -= ecore;
1463 ATH_MSG_DEBUG("MuonCore i=" << i << " cone [before] " << result.etcones[i]+ecore << " cone [after] " << result.etcones[i]);
1464 }
1465 }
1466
1467 return true;
1468 }
@ ecore
core energy in em calo E(core) = E0(3x3) + E1(15x2) + E2(5x5) + E3(3x5)

◆ correctIsolationEnergy_pflowCore()

bool xAOD::CaloIsolationTool::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
private

Correct the pflow isolation using sum of pflow objects in core region.

get energy

add to the core

get energy

add to the core

set results

Definition at line 1327 of file CaloIsolationTool.cxx.

1333 {
1334
1335 float pflowCore(0.);
1336 for (const FlowElement* cl : clusts) {
1337 ATH_MSG_DEBUG("pflo: eta " << cl->eta() << " phi " << cl->phi() << " pt " << cl->pt() << " charge " << cl->charge());
1338 float dphi = Phi_mpi_pi(cl->phi()-phi);
1339 if (detaMax > 0 && fabs(dphi) > dphiMax) continue;
1340 float deta = cl->eta()-eta;
1341 if (dphiMax > 0 && fabs(deta) > detaMax) continue;
1342 if (dR2Max > 0 && dphi*dphi+deta*deta > dR2Max) continue;
1343
1345 float et = cl->pt();
1346 if (et <= 0 || fabs(cl->eta()) > 7.0) continue;
1347
1348 double emfrac = 1.;
1349 if (onlyEM) {
1350 const xAOD::CaloCluster *ocl = dynamic_cast<const xAOD::CaloCluster*>(cl->otherObject(0));
1351 if(ocl) {
1352 double eEM = ocl->energyBE(0)+ocl->energyBE(1)+ocl->energyBE(2)+ocl->energyBE(3);
1353 emfrac = std::min(1.,eEM / cl->e());
1354 }
1355 }
1356 et *= emfrac;
1357
1359 pflowCore += et;
1360 ATH_MSG_DEBUG("pflow to be added to core: et = " << et << " (em frac = " << emfrac << "), total = " << pflowCore);
1361 }
1362
1363 if (egObj) {
1364 float pflowCoreSC(0.);
1365 // These are the original FE, before origin correction, before CSSK... But the index should still match
1366 // for the corresponding FE in the post-processed container
1367 std::vector<const xAOD::FlowElement*> fes = EgammaHelpers::getAssociatedFlowElements(egObj);
1368 ATH_MSG_DEBUG("Number of associated neutral FE = " << fes.size());
1369 for (const FlowElement *fe : fes) {
1370 if (fe == nullptr) {
1371 ATH_MSG_DEBUG("null pointer to associated neutral");
1372 continue;
1373 }
1374 ATH_MSG_DEBUG("asso pflo: eta " << fe->eta() << " phi " << fe->phi() << " pt " << fe->pt() << " charge " << fe->charge() << " index = " << fe->index());
1375 const FlowElement *afe(nullptr);
1376 for (const FlowElement *cl : clusts) {
1377 if (fe->index() == cl->index()) {
1378 afe = cl;
1379 break;
1380 }
1381 }
1382 if (afe == nullptr)
1383 continue;
1384 ATH_MSG_DEBUG("asso pflo after vertex correction : eta " << afe->eta() << " phi " << afe->phi() << " pt " << afe->pt());
1386 float et = afe->pt();
1387 if (et <= 0 || fabs(afe->eta()) > 7.0) continue;
1388
1389 double emfrac = 1.;
1390 if (m_ExcludeTG3 || onlyEM) {
1391 std::vector<float> allEne = FEHelpers::getEnergiesPerSampling(*afe);
1392
1393 if (m_ExcludeTG3)
1394 et -= allEne.at(17)/cosh(afe->eta());
1395
1396 if (onlyEM) {
1397 double eEM = 0;
1398 for (int i = 0; i <= 7; i++) eEM += allEne.at(i);
1399 double eAll = fe->e();
1400 if (m_ExcludeTG3)
1401 eAll -= allEne.at(17);
1402 emfrac = std::min(1.,eEM / eAll);
1403 }
1404 et *= emfrac;
1405 }
1407 pflowCoreSC += et;
1408 ATH_MSG_DEBUG("asso pflow to be added to core " << fe << " et = " << et << " (em frac = " << emfrac << "), total = " << pflowCoreSC);
1409 }
1410 std::map<Iso::IsolationCorrectionParameter,float> corecorrSC;
1411 corecorrSC[Iso::coreEnergy] = pflowCoreSC;
1412 corecorrSC[Iso::coreArea] = 0;
1413 result.coreCorrections[Iso::coreConeSC] = corecorrSC;
1414 }
1415
1417 float areacore = -999.;
1418 if (detaMax > 0 && dphiMax > 0) areacore = 4*detaMax*dphiMax;
1419 else if (dR2Max > 0) areacore = M_PI*dR2Max;
1420
1421 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1422 corecorr[Iso::coreEnergy] = pflowCore;
1423 corecorr[Iso::coreArea] = areacore;
1424 result.coreCorrections[Iso::coreCone] = corecorr;
1425
1426 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))) {
1427 for (unsigned int i = 0; i < result.etcones.size(); i++) {
1428 ATH_MSG_DEBUG("pflow, cone type " << i << ", in cone " << result.etcones[i] << ", subtracted " << result.etcones[i]-pflowCore);
1429 result.etcones[i] -= pflowCore;
1430 }
1431 }
1432
1433 return true;
1434 }
#define M_PI
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
float Phi_mpi_pi(float x) const
Gaudi::Property< bool > m_ExcludeTG3
Property: exclude tile scintillator.
std::vector< float > getEnergiesPerSampling(const xAOD::FlowElement &fe)
Definition FEHelpers.cxx:78
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
std::vector< const xAOD::FlowElement * > getAssociatedFlowElements(const xAOD::Egamma *eg, bool neutral=true, bool charged=false)
Return a vector of the flow elements associated with the egamma cluster (only neutral for default)
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16

◆ correctIsolationEnergy_TopoCore()

bool xAOD::CaloIsolationTool::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
private

Correct the topo cluster isolation using sum of topo cluster in core region.

check distance

get enenrgy

remove TileGap3

if only EM

add to the core

remove TileGap3

if only EM

Definition at line 1183 of file CaloIsolationTool.cxx.

1188 {
1189 ATH_MSG_DEBUG("In CaloIsolationTool::correctIsolationEnergy_TopoCore");
1190 ATH_MSG_DEBUG("particle: eta " << eta << " phi " << phi);
1191
1192
1193 // I do not remember why I put areacore = 0 for fwdClus !!
1194 float areacore = -999.;
1195 if (fwdClus == nullptr) {
1196 if (dEtaMax_core>0 && dPhiMax_core>0) areacore = 4*dEtaMax_core*dPhiMax_core;
1197 else if (dR2Max_core>0) areacore = M_PI*dR2Max_core;
1198 } else
1199 areacore = 0;
1200
1201 double topoCore(0.);
1202 if (fwdClus) {
1203 topoCore = fwdClus->p4(CaloCluster::State::UNCALIBRATED).Et();
1204 ATH_MSG_DEBUG("Including " << topoCore << " in the core transverse energy of the fwd electron");
1205 } else {
1206 for (const CaloCluster* cl : clusts) {
1207 ATH_MSG_DEBUG("cl: eta " << cl->eta() << " phi " << cl->phi()
1208 << " E " << cl->p4(CaloCluster::State::UNCALIBRATED).E()
1209 << " pt " << cl->p4(CaloCluster::State::UNCALIBRATED).Et()
1210 << " cal E " << cl->e());
1212 float dPhi = Phi_mpi_pi(cl->phi()-phi);
1213 if(dEtaMax_core>0 && fabs(dPhi) > dPhiMax_core) continue;
1214 float dEta = cl->eta()-eta;
1215 if(dPhiMax_core>0 && fabs(dEta) > dEtaMax_core) continue;
1216 if(dR2Max_core>0 && dPhi*dPhi+dEta*dEta > dR2Max_core) continue;
1217 ATH_MSG_DEBUG("dist: dPhi " << dPhi << " dEta " << dEta << " dR2 " << dPhi*dPhi+dEta*dEta);
1218
1220 float et = (m_useEMScale ? cl->p4(CaloCluster::State::UNCALIBRATED).Et() : cl->pt() );
1221 if(et <= 0 || fabs(cl->eta()) > 7.0) continue;
1222
1224 double ettg3 = cl->eSample(CaloSampling::TileGap3)/cosh(cl->p4(CaloCluster::State::UNCALIBRATED).Eta());
1225 et -= ettg3;
1226 if (fabs(ettg3) > 1)
1227 ATH_MSG_DEBUG("After TG3 removal, pt = " << et);
1228
1230 double emfrac = 1.;
1231 if(onlyEM){
1232 double eEM = cl->energyBE(0)+cl->energyBE(1)+cl->energyBE(2)+cl->energyBE(3);
1233 emfrac = std::min(1., eEM / cl->p4(CaloCluster::State::UNCALIBRATED).E());
1234 }
1235 et *= emfrac;
1236
1238 topoCore += et;
1239 ATH_MSG_DEBUG("adding in core et: " << et << " (em frac = " << emfrac << " dR = " << sqrt(dPhi*dPhi+dEta*dEta) << ") total " << topoCore);
1240 }
1241 }
1242
1243 double topoCoreSC(0.);
1244 double test = 0;
1245 double topoCoreSCem = 0;
1246 if (egObj && egObj->caloCluster()->clusterSize() == CaloCluster::ClusterSize::SuperCluster) {
1247 const std::vector<const CaloCluster*> assocClus = EgammaHelpers::getAssociatedTopoClusters(egObj->caloCluster());
1248 for (unsigned int ic = 0; ic < assocClus.size(); ic++) {
1249 const CaloCluster* cl = assocClus.at(ic);
1250 test += cl->pt();
1251 topoCoreSC += cl->p4(CaloCluster::State::UNCALIBRATED).Et();
1252 ATH_MSG_DEBUG("Adding topo " << ic << " ptr = " << cl << " contrib, pt = " << cl->pt()
1253 << " uncal pt = " << cl->p4(CaloCluster::State::UNCALIBRATED).Et()
1254 << " eta,phi = " << cl->eta() << " " << cl->phi()
1255 << " uncal eta,phi = " << cl->p4(CaloCluster::State::UNCALIBRATED).Eta()
1256 << " " << cl->p4(CaloCluster::State::UNCALIBRATED).Phi()
1257 << " nCells = " << cluster_size(cl)
1258 );
1259
1261 double ettg3 = cl->eSample(CaloSampling::TileGap3)/cosh(cl->p4(CaloCluster::State::UNCALIBRATED).Eta());
1262 topoCoreSCem -= ettg3;
1263
1265 double emfrac = 1.;
1266 if(onlyEM){
1267 double eEM = cl->energyBE(0)+cl->energyBE(1)+cl->energyBE(2)+cl->energyBE(3);
1268 emfrac = std::min(1., eEM / cl->p4(CaloCluster::State::UNCALIBRATED).E());
1269 }
1270 topoCoreSCem += emfrac*cl->p4(CaloCluster::State::UNCALIBRATED).Et();
1271
1272 //auto itc = assocClus.at(ic)->begin();
1273 //for (; itc != assocClus.at(ic)->end(); itc++)
1274 // std::cout << "A cell " << (*itc) << " eta = " << (*itc)->eta() << std::endl;
1275 }
1276 ATH_MSG_DEBUG("Including " << topoCore << " only em, no tg3 " << topoCoreSCem << " calibrated " << test << " in the core transverse energy of the super cluster egamma object made of "
1277 << assocClus.size() << " clusters with corresponding pT = " << egObj->pt()
1278 << " cluster pT = " << egObj->caloCluster()->pt() << " cluster un cal pT = "
1279 << egObj->caloCluster()->p4(CaloCluster::State::UNCALIBRATED).Et()
1280 << " nCells = " << cluster_size(egObj->caloCluster())
1281 );
1282 //auto itc = egObj->caloCluster()->begin();
1283 //for (; itc != egObj->caloCluster()->end(); itc++)
1284 //std::cout << "A cell in the SC " << (*itc) << " eta = " << (*itc)->eta() << std::endl;
1285
1286 std::map<Iso::IsolationCorrectionParameter,float> corecorrSC;
1287 corecorrSC[Iso::coreEnergy] = topoCoreSCem;
1288 corecorrSC[Iso::coreArea] = areacore;
1289 result.coreCorrections[Iso::coreConeSC] = corecorrSC;
1290
1291 }
1292
1293 ATH_MSG_DEBUG("core energy, std = " << topoCore << " topo-assoc (full) = " << topoCoreSC << " topo-assoc (only em, no tg3) = " << topoCoreSCem);
1294
1295 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1296 corecorr[Iso::coreEnergy] = topoCore;
1297 corecorr[Iso::coreArea] = areacore;
1298 result.coreCorrections[Iso::coreCone] = corecorr;
1299
1300 float toSub = 0;
1301 bool doSub = false;
1302 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone)) ||
1303 result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreConeSC))) {
1304 doSub = true;
1305 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone)) &&
1306 !result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreConeSC)))
1307 toSub = topoCore;
1308 else if (!result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone)) &&
1309 result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreConeSC)))
1310 toSub = topoCoreSCem;
1311 else {
1312 ATH_MSG_WARNING("Cannot do two core subtraction ! Using coreCone");
1313 toSub = topoCore;
1314 }
1315 }
1316
1317 if (doSub) {
1318 for (unsigned int i = 0; i < result.etcones.size(); i++){
1319 result.etcones[i] -= toSub;
1320 ATH_MSG_DEBUG("TopoCore correction i=" << i << " cone [before] " << result.etcones[i]+toSub << " cone [after] " << result.etcones[i]);
1321 }
1322 }
1323
1324 return true;
1325 }
Gaudi::Property< bool > m_useEMScale
Property: Use TopoClusters at the EM scale.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
int ic
Definition grepfile.py:33
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ decorateTrackCaloPosition()

void xAOD::CaloIsolationTool::decorateTrackCaloPosition ( const IParticle & particle,
float eta,
float phi ) const
private

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ EDCorrection()

bool xAOD::CaloIsolationTool::EDCorrection ( CaloIsolation & result,
const std::vector< Iso::IsolationType > & isoTypes,
float eta,
const std::string & type,
const CaloCluster * fwdClus ) const
private

Definition at line 1500 of file CaloIsolationTool.cxx.

1506 {
1507 std::vector<float> corrvec;
1508 corrvec.resize(isoTypes.size(),0.);
1509
1510 // assume two densities for the time being
1511 const SG::ReadHandleKey<EventShape>* esKey = (fabs(eta) < 1.5 || m_useEtaDepPU) ? &m_tpEDCentral : &m_tpEDForward;
1512 if (type == "PFlow") {
1513 esKey = (fabs(eta) < 1.5) ? &m_efEDCentral : &m_efEDForward;
1514 } else if (fwdClus != nullptr) {
1515 ATH_MSG_DEBUG("No pileup correction for forward electron isolation yet");
1516 result.noncoreCorrections[Iso::pileupCorrection] = corrvec;
1517 return true;
1518 }
1519
1520 SG::ReadHandle<EventShape> edShape(*esKey);
1521 // check is only used for serial running; remove when MT scheduler used
1522 if(!edShape.isValid()) {
1523 ATH_MSG_FATAL("Failed to retrieve "<< esKey->key());
1524 return false;
1525 }
1526
1527 double rho = 0;
1528 bool gotDensity = edShape->getDensity(EventShape::Density,rho);
1529 if (!gotDensity) {
1530 ATH_MSG_WARNING("Cannot retrieve density " << esKey->key() << " for isolation correction. No ED correction");
1531 return false;
1532 }
1533
1534 // Get the core size
1535 float areacore = 0;
1536 std::map<xAOD::Iso::IsolationCorrectionParameter,float> ecore;
1537 if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))){
1538 ecore = result.coreCorrections.find(Iso::coreMuon)->second;
1539 }else if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))){
1540 ecore = result.coreCorrections.find(Iso::core57cells)->second;
1541 }else if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))){
1542 ecore = result.coreCorrections.find(Iso::coreCone)->second;
1543 }
1544
1545 auto iter = ecore.find(xAOD::Iso::coreArea);
1546 if (iter != ecore.end())
1547 areacore = ecore.find(xAOD::Iso::coreArea)->second;
1548
1549 for (unsigned int i = 0; i < isoTypes.size(); i++) {
1550 float dR = Iso::coneSize(isoTypes.at(i));
1551 float toSub = rho*(dR*dR*M_PI - areacore);
1552 // The improved PU correction is only for central EGamma objects, and topoetcone
1553 if (m_useEtaDepPU && fwdClus == nullptr && Iso::isolationFlavour(isoTypes.at(i)) == Iso::topoetcone) {
1554 double areaCorr = 0;
1555 auto puZeta = m_puZetaCorrection.find(isoTypes.at(i));
1556 if (puZeta != m_puZetaCorrection.end()) {
1557 areaCorr = puZeta->second->Eval(std::abs(eta)); // CW might have done it vs etaBE(2). This eta here is caloCluster eta...
1558 } else {
1559 ATH_MSG_WARNING("Requested refined eta dependent pileup correction but no zeta correction provided " << Iso::toCString(isoTypes.at(i)));
1560 }
1561 if (m_isMC) {
1562 auto puZetaMC = m_puZetaMCCorrection.find(isoTypes.at(i));
1563 if (puZetaMC != m_puZetaMCCorrection.end()) {
1564 areaCorr -= puZetaMC->second->Eval(std::abs(eta));
1565 } else {
1566 ATH_MSG_WARNING("Requested refined eta dependent pileup correction for mc but no zeta correction provided " << Iso::toCString(isoTypes.at(i)));
1567 }
1568 }
1569 toSub *= areaCorr;
1570 }
1571 corrvec[i] = toSub;
1572 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))){
1573 result.etcones[i] -= toSub;
1574 }
1575 ATH_MSG_DEBUG("ED correction ("<< type << ")for size " << dR << " = " << toSub << " (areacore=" << areacore << ")");
1576 }
1577
1578 result.noncoreCorrections[Iso::pileupCorrection] = corrvec;
1579 return true;
1580 }
#define ATH_MSG_FATAL(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
SG::ReadHandleKey< EventShape > m_efEDForward
Property: Name of the forward neutral energy flow energy-density container.
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.
SG::ReadHandleKey< EventShape > m_tpEDForward
Property: Name of the forward topocluster energy-density container.
SG::ReadHandleKey< EventShape > m_tpEDCentral
Property: Name of the central topocluster energy-density container.
Gaudi::Property< bool > m_isMC
Property: need to know if this is MC (from rec.doTruth) for eta dep pileup corr.
std::map< Iso::IsolationType, std::unique_ptr< TGraph > > m_puZetaMCCorrection
@ topoetcone
Topo-cluster ET-sum.
static const char * toCString(IsolationConeSize conesize)

◆ etConeIsolation() [1/3]

bool xAOD::CaloIsolationTool::etConeIsolation ( CaloIsolation & result,
const Egamma & eg,
const std::vector< Iso::IsolationType > & isoTypes,
const CaloCellContainer * container ) const
private

Definition at line 877 of file CaloIsolationTool.cxx.

879 {
880 if( isoTypes.empty() ) {
881 ATH_MSG_WARNING("Empty list passed, failing calculation");
882 return false;
883 }
884
885 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
886 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
887
888 std::vector<float> coneSizes; coneSizes.resize(3);
889 std::vector<float> coneSizesSquared; coneSizesSquared.resize(3);
890 for (unsigned int i = 0; i < isoTypes.size(); i++) {
891 float dR = Iso::coneSize(isoTypes.at(i));
892 coneSizes[i] = dR;
893 coneSizesSquared[i] = dR*dR;
894 }
895
896 float phi = eg.caloCluster()->phi();
897 float eta = eg.caloCluster()->eta();
898
899 // Define a new Calo Cell list corresponding to EM Calo
900 std::vector<CaloCell_ID::SUBCALO> Vec_EMCaloEnums;
901 for (unsigned int n=0; n < m_EMCaloNums.size(); ++n) {
902 Vec_EMCaloEnums.push_back(static_cast<CaloCell_ID::SUBCALO>( m_EMCaloNums[n] ));
903 }
904 CaloCellList EMccl(caloDDMgr,container, Vec_EMCaloEnums);
905
906 std::vector<CaloCell_ID::SUBCALO> Vec_HadCaloEnums;
907 for (unsigned int n=0; n < m_HadCaloNums.size(); ++n) {
908 Vec_HadCaloEnums.push_back(static_cast<CaloCell_ID::SUBCALO>( m_HadCaloNums[n] ));
909 }
910 CaloCellList HADccl(caloDDMgr,container, Vec_HadCaloEnums);
911
912 // Let's determine some values based on the input specs
913 // Search for largest radius
914 double Rmax = 0.0;
915 for (unsigned int n=0; n< coneSizes.size(); n++)
916 if (coneSizes[n] > Rmax) Rmax = coneSizes[n];
917
918 // get the cells for the first one; by convention, it must be bigger than all the other cones.
919 EMccl.select(eta,phi,Rmax);
920
921 for (const auto *it: EMccl) {
922 double etacel=it->eta();
923 double phicel=it->phi();
924
925 double deleta = eta-etacel;
926 float delphi = Phi_mpi_pi(phi-phicel);
927 double drcel2 = (deleta*deleta) + (delphi*delphi);
928
929 for (unsigned int i = 0; i < coneSizes.size(); i++) {
930 if (drcel2 < coneSizesSquared[i])
931 result.etcones[i] += it->et();
932 }
933 }//end loop over cell-list
934
935
936 // get the cells for the first one; by convention, it must be bigger than all the other cones.
937 HADccl.select(eta, phi, Rmax);
938
939 for (const auto *it: HADccl) {
940 // Optionally remove TileGap cells
941 if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == it->caloDDE()->getSampling()) {
942 ATH_MSG_DEBUG("Excluding cell with Et = " << it->et());
943 continue;
944 }
945
946 // if no TileGap cells excluded, log energy of all cells
947 double etacel = it->eta();
948 double phicel = it->phi();
949
950 double deleta = eta-etacel;
951 float delphi = Phi_mpi_pi(phi-phicel);
952 double drcel2 = (deleta*deleta) + (delphi*delphi);
953
954 for (unsigned int i = 0; i < coneSizes.size(); i++) {
955 if (drcel2 < coneSizesSquared[i])
956 result.etcones[i] += it->et();
957 }
958 }//end loop over cell-list
959
960 return true;
961 }
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
Gaudi::Property< std::vector< int > > m_HadCaloNums
vector of calo-id to treat
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
CaloDetDescrManager from ConditionStore.
Gaudi::Property< std::vector< int > > m_EMCaloNums
vector of calo-id to treat

◆ etConeIsolation() [2/3]

bool xAOD::CaloIsolationTool::etConeIsolation ( CaloIsolation & result,
const Muon & muon,
const std::vector< Iso::IsolationType > & isoTypes,
double coneCoreSize,
const derefMap_t & derefMap ) const
private

add coreCone if asked – make sure it's the last one! or a better

apply the correction if required.

start the calculation

do coreCone

apply the correction if required.

Definition at line 770 of file CaloIsolationTool.cxx.

773 {
774
775 std::vector<double> conesf;
776 double maxConeSize = -1;
777 for( auto isoType : isoTypes ){
778 if( Iso::isolationFlavour(isoType) != Iso::etcone ) {
779 ATH_MSG_WARNING("Unsupported isolation type passed, cannot calculate isolation " << static_cast<int>(isoType));
780 return false;
781 }
782 double cone = Iso::coneSize(isoType);
783 conesf.push_back(cone);
784 if(cone>maxConeSize) maxConeSize = cone;
785 }
787 const double coreConeDR = coneCoreSize;
788 bool doCoreCone = (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone)));
789 if(doCoreCone && maxConeSize<coreConeDR) maxConeSize = coreConeDR;
790
791 if(!muon.clusterLink().isValid()){
792 ATH_MSG_DEBUG("no valid cluster link");
793 //no cluster, set everything to 0
794 for(unsigned int i=0; i<conesf.size(); i++) result.etcones[i] = 0;
795 if(doCoreCone){
796 ATH_MSG_DEBUG("starting etcone, coreCone");
797 double totE = 0.;
798 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
799 corecorr[Iso::coreEnergy] = totE;
800 corecorr[Iso::coreArea] = coreConeDR*coreConeDR*M_PI;
801 result.coreCorrections[Iso::coreCone] = corecorr;
802 ATH_MSG_DEBUG("done etcone, coreCone");
804 if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))){
805 double ecore = totE;
806 ATH_MSG_DEBUG("Applying coreCone correction for trackParticle etcone isolation.");
807 for( unsigned int i=0;i<result.etcones.size();++i ) {
808 result.etcones[i] -= ecore;
809 ATH_MSG_DEBUG("i: " << i << " cone [before] " << result.etcones[i]+ecore << " cone [after] " << result.etcones[i]);
810 }
811 }
812 }
813 }
814 else{
815 const xAOD::CaloCluster* muonCluster=*muon.clusterLink();
817 ATH_MSG_DEBUG("calculating etcone for # " << conesf.size() << " cones");
818 Trk::CaloCellSelectorLayerdR selector(maxConeSize);
819 selector.preSelectAction(*muonCluster);
820 ATH_MSG_DEBUG("looping over cells " << muonCluster->size());
821 for(unsigned int i=0; i<conesf.size(); i++){
822 double totE = 0.;
823 selector.setConeSize(conesf[i]);
824 xAOD::CaloCluster::const_cell_iterator cell_itr=muonCluster->begin();
825 for(; cell_itr!=muonCluster->end(); ++cell_itr){
826 if( !selector.select(**cell_itr) ) continue;
827 if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == (*cell_itr)->caloDDE()->getSampling()) continue;
828 totE += (*cell_itr)->et();
829 }
830 result.etcones[i] = totE;
831 ATH_MSG_DEBUG("etcone raw: coneSize = " << conesf[i] << "; etcone = " << result.etcones[i]);
832 }
833 ATH_MSG_DEBUG("done looping over cells ");
835 if(doCoreCone){
836 ATH_MSG_DEBUG("starting etcone, coreCone");
837 double totE = 0.;
838 selector.setConeSize(coreConeDR);
839 xAOD::CaloCluster::const_cell_iterator cell_itr=muonCluster->begin();
840 for(; cell_itr!=muonCluster->end(); ++cell_itr){
841 if( !selector.select(**cell_itr) ) continue;
842 if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == (*cell_itr)->caloDDE()->getSampling()) continue;
843 totE += (*cell_itr)->et();
844 }
845 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
846 corecorr[Iso::coreEnergy] = totE;
847 corecorr[Iso::coreArea] = coreConeDR*coreConeDR*M_PI;
848 result.coreCorrections[Iso::coreCone] = corecorr;
849 ATH_MSG_DEBUG("done etcone, coreCone");
850
852 if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))){
853 double ecore = totE;
854 ATH_MSG_DEBUG("Applying coreCone correction for trackParticle etcone isolation.");
855 for( unsigned int i=0;i<result.etcones.size();++i ) {
856 result.etcones[i] -= ecore;
857 ATH_MSG_DEBUG("i: " << i << " cone [before] " << result.etcones[i]+ecore << " cone [after] " << result.etcones[i]);
858 }
859 }
860 }
861 }
862 // calculate etcore
864 result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))){
865 const TrackParticle* tp = nullptr;
866 if(muon.primaryTrackParticleLink().isValid() && muon.author()!=2) tp = *muon.primaryTrackParticleLink();
867 if( !tp) tp = *muon.inDetTrackParticleLink();
868 correctIsolationEnergy_MuonCore(result, *tp, derefMap);
869 }
870
871 return true;
872 }
const_iterator end() const
const_iterator begin() const
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)

◆ etConeIsolation() [3/3]

bool xAOD::CaloIsolationTool::etConeIsolation ( CaloIsolation & result,
const TrackParticle & tp,
const std::vector< Iso::IsolationType > & isoTypes,
const CaloCellContainer * container,
double coneCoreSize,
const derefMap_t & derefMap ) const
private

add coreCone if asked – make sure it's the last one! or a better

start the calculation

do coreCone

apply the correction if required.

Definition at line 677 of file CaloIsolationTool.cxx.

681 {
682
683 // for now always use track, should move to extrapolation to calo entrance
684 const Trk::Track* track = tp.track();
685 if( !track ) {
686 ATH_MSG_WARNING("Failed to access track");
687 return false;
688 }
689
690 std::vector<double> conesf;
691 double maxConeSize = -1;
692 for( auto isoType : isoTypes ){
693 if( Iso::isolationFlavour(isoType) != Iso::etcone ) {
694 ATH_MSG_WARNING("Unsupported isolation type passed, cannot calculate isolation " << static_cast<int>(isoType));
695 return false;
696 }
697 double cone = Iso::coneSize(isoType);
698 conesf.push_back(cone);
699 if(cone>maxConeSize) maxConeSize = cone;
700 }
701
703 const double coreConeDR = coneCoreSize;
704 bool doCoreCone = (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone)));
705 if(doCoreCone && maxConeSize<coreConeDR) maxConeSize = coreConeDR;
706
708 ATH_MSG_DEBUG("calculating etcone for # " << conesf.size() << " cones");
709 std::unique_ptr<const Rec::ParticleCellAssociation> association=m_assoTool->particleCellAssociation(tp,maxConeSize,container);
710 if( !association) {
711 ATH_MSG_DEBUG("failed to obtain the ParticleCellAssociation");
712 return false;
713 }
714
715 Trk::CaloCellSelectorLayerdR selector(maxConeSize);
716 selector.preSelectAction(association->caloExtension());
717 ATH_MSG_DEBUG("looping over cells " << association->data().size());
718 for(unsigned int i=0; i<conesf.size(); i++){
719 double totE = 0.;
720 selector.setConeSize(conesf[i]);
721 for (const auto *aCell : association->data()){
722 if( !selector.select(*aCell) ) continue;
723 if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling()) continue;
724 totE += aCell->et();
725 }
726 result.etcones[i] = totE;
727 ATH_MSG_DEBUG("etcone raw: coneSize = " << conesf[i] << "; etcone = " << result.etcones[i]);
728 }
729 ATH_MSG_DEBUG("done looping over cells ");
730
732 if(doCoreCone){
733 ATH_MSG_DEBUG("starting etcone, coreCone");
734 double totE = 0.;
735 selector.setConeSize(coreConeDR);
736 for (const auto *aCell : association->data()){
737 if( !selector.select(*aCell) ) continue;
738 if (m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling()) continue;
739 totE += aCell->et();
740 }
741 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
742 corecorr[Iso::coreEnergy] = totE;
743 corecorr[Iso::coreArea] = coreConeDR*coreConeDR*M_PI;
744 result.coreCorrections[Iso::coreCone] = corecorr;
745 ATH_MSG_DEBUG("done etcone, coreCone");
746
748 if(result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))){
749 double ecore = totE;
750 ATH_MSG_DEBUG("Applying coreCone correction for trackParticle etcone isolation.");
751 for( unsigned int i=0;i<result.etcones.size();++i ) {
752 result.etcones[i] -= ecore;
753 ATH_MSG_DEBUG("i: " << i << " cone [before] " << result.etcones[i]+ecore << " cone [after] " << result.etcones[i]);
754 }
755 }
756 }
757
758 // calculate etcore
760 result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))){
761 correctIsolationEnergy_MuonCore(result, tp, derefMap);
762 }
763
764 return true;
765 }
ToolHandle< Rec::IParticleCaloCellAssociationTool > m_assoTool

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode xAOD::CaloIsolationTool::finalize ( )
overridevirtual

Definition at line 155 of file CaloIsolationTool.cxx.

155 {
156 return StatusCode::SUCCESS;
157 }

◆ GetExtrapEtaPhi()

bool xAOD::CaloIsolationTool::GetExtrapEtaPhi ( const TrackParticle * tp,
float & eta,
float & phi,
derefMap_t & derefMap ) const
private

get it from decoration

get it from calo-cluster if it's muon

try the extention in athena if it's not obtained from muon yet.

if still not got the updated eta & phi

Definition at line 532 of file CaloIsolationTool.cxx.

534 {
536 static const SG::AuxElement::ConstAccessor< char > Decorated("caloExt_Decorated");
537 static const SG::AuxElement::ConstAccessor< float > Eta("caloExt_eta");
538 static const SG::AuxElement::ConstAccessor< float > Phi("caloExt_phi");
539 if(Decorated.isAvailable(*tp) && Decorated(*tp)){
540 eta = Eta(*tp);
541 phi = Phi(*tp);
542 return true;
543 }
544
546 const Muon* mu = dynamic_cast<const Muon*>(derefMap[tp]);
547 if(mu){
548 const auto *cluster = mu->cluster();
549 if(cluster){
550 float etaT = 0, phiT = 0, dphiT = 0.;
551 int nSample = 0;
552 for(unsigned int i=0; i<CaloSampling::Unknown; i++) // dangerous?
553 {
554 auto s = static_cast<CaloSampling::CaloSample>(i);
555 if(!cluster->hasSampling(s)) continue;
556 ATH_MSG_DEBUG("Sampling: " << i << "eta-phi (" << cluster->etaSample(s) << ", " << cluster->phiSample(s) << ")");
557 etaT += cluster->etaSample(s);
558 if( nSample == 0 ){
559 phiT = cluster->phiSample(s);
560 }
561 else{
562 dphiT += xAOD::P4Helpers::deltaPhi( cluster->phiSample(s), phiT ) ;
563 }
564 nSample++;
565 }
566 if(nSample>0){
567 eta = etaT/nSample;
568 phi = phiT + dphiT/nSample;
569 return true;
570 }else{
571 ATH_MSG_WARNING("Muon calo cluster is empty????");
572 }
573 }else{
574 ATH_MSG_DEBUG("Muon calo cluster not found.");
575 }
576 }
577
578#ifndef XAOD_ANALYSIS
580 ATH_MSG_DEBUG("Geting calo extension caloExtension tool.");
581 // If we have an extension cache then it owns the extension, otherwise we own it
582 // Therefore we have to prepare both an owning and a non-owning pointer
583 std::unique_ptr<Trk::CaloExtension> caloExtensionUPtr;
584 const Trk::CaloExtension* caloExtension = nullptr;
585 if (m_caloExtensionKey.empty())
586 {
587 caloExtensionUPtr =
588 m_caloExtTool->caloExtension(Gaudi::Hive::currentContext(), *tp);
589 caloExtension = caloExtensionUPtr.get();
590 }
591 else
592 {
594 if (!cache.isValid())
595 {
596 ATH_MSG_WARNING("Failed to retrieve calo extension cache " << m_caloExtensionKey);
597 return false;
598 }
599 caloExtension = m_caloExtTool->caloExtension(*tp, *cache);
600 }
601 if(!caloExtension){
602 ATH_MSG_WARNING("Can not get caloExtension.");
603 return false;
604 };
605
606 const std::vector<Trk::CurvilinearParameters>& intersections = caloExtension->caloLayerIntersections();
607 if(!intersections.empty()){
608 Amg::Vector3D avePoint(0,0,0);
609 for (unsigned int i = 0; i < intersections.size(); ++i){
610 const Amg::Vector3D& point = intersections[i].position();
611 ATH_MSG_DEBUG("Intersection: " << i << " ID: " << m_parsIdHelper.caloSample(intersections[i].cIdentifier())
612 << " eta-phi (" << point.eta() << ", " << point.phi() << ")");
613 avePoint += point;
614 }
615 avePoint = (1./intersections.size())*avePoint;
616 eta = avePoint.eta();
617 phi = avePoint.phi();
618 return true;
619 }else{
620 ATH_MSG_WARNING("Muon Calo extension got no intersection!!!");
621 }
622#endif // xAOD
624 ATH_MSG_WARNING("Calo extension can not be obtained!!!");
625 return false;
626 }
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool
Trk::TrackParametersIdHelper m_parsIdHelper
SG::ReadHandleKey< CaloExtensionCollection > m_caloExtensionKey
The input calorimeter extensions.
Eigen::Matrix< double, 3, 1 > Vector3D
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getReferenceParticle()

const IParticle * xAOD::CaloIsolationTool::getReferenceParticle ( const IParticle & particle) const
private

get reference particle

Definition at line 1593 of file CaloIsolationTool.cxx.

1593 {
1594 const TrackParticle* tp = dynamic_cast<const TrackParticle*>(&particle);
1595 if( tp ) return tp;
1596 const Muon* muon = dynamic_cast<const Muon*>(&particle);
1597 if( muon ) {
1598 ATH_MSG_DEBUG("muon with author "<<muon->author()<<" and pT "<<muon->pt());
1599 const TrackParticle* tp = nullptr;
1600 //note: if STACO, the track particle has no Trk::Track associated, so use the ID track
1601 if(muon->primaryTrackParticleLink().isValid() && muon->author()!=2) tp = *muon->primaryTrackParticleLink();
1602 if( !tp) tp = *muon->inDetTrackParticleLink();
1603 if( !tp ) {
1604 ATH_MSG_WARNING(" No TrackParticle found for muon " );
1605 return nullptr;
1606 }
1607 return tp;
1608 }
1609 return &particle;
1610 }

◆ initialize()

StatusCode xAOD::CaloIsolationTool::initialize ( void )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 67 of file CaloIsolationTool.cxx.

67 {
68#ifndef XAOD_ANALYSIS
69 if (!m_assoTool.empty())
70 ATH_CHECK(m_assoTool.retrieve());
71
72 if (!m_caloExtTool.empty())
73 ATH_CHECK(m_caloExtTool.retrieve());
74
75 if (!m_clustersInConeTool.empty())
77
78 if (!m_pflowObjectsInConeTool.empty())
80
81 if (!m_caloFillRectangularTool.empty()) {
83 }
84
85 //check calo number specified for EM Calos
86 unsigned int nSubCalo=static_cast<int>(CaloCell_ID::NSUBCALO);
87 if (m_EMCaloNums.size()>nSubCalo || m_HadCaloNums.size()>nSubCalo) {
88 ATH_MSG_ERROR(" More than " << nSubCalo << " calo specified. Required for EM =" << m_EMCaloNums.size()<< ", and for HCAL = " << m_HadCaloNums.size() << ". Must be wrong. Stop.");
89 return StatusCode::FAILURE;
90 }
91
92 for (unsigned int index=0; index < m_EMCaloNums.size() ; ++index) {
93 if (m_EMCaloNums[index]<0 || m_EMCaloNums[index]>=(int)nSubCalo ) {
94 ATH_MSG_ERROR("Invalid calo specification:" << m_EMCaloNums[index] << "Stop.");
95 return StatusCode::FAILURE;
96 } else
97 ATH_MSG_DEBUG("Select calorimeter " << m_EMCaloNums[index]);
98 }
99
100 for (unsigned int index=0; index < m_HadCaloNums.size() ; ++index) {
101 if (m_HadCaloNums[index]<0 || m_HadCaloNums[index]>=(int)nSubCalo) {
102 ATH_MSG_ERROR("Invalid calo specification:" << m_HadCaloNums[index] << "Stop.");
103 return StatusCode::FAILURE;
104 } else
105 ATH_MSG_DEBUG("Select calorimeter " << m_HadCaloNums[index]);
106 }
107
109 ATH_CHECK(m_caloMgrKey.initialize());
110#endif // XAOD_ANALYSIS
111
112 if (!m_IsoLeakCorrectionTool.empty())
114
115 // initialize the read handles (for now do all of them in all cases)
116
121
122 if (m_useEtaDepPU) {
124 if (filename.empty()){
125 ATH_MSG_ERROR ( "Could NOT resolve file name " << m_puZetaCorrectionFileName );
126 return StatusCode::FAILURE ;
127 }
128 ATH_MSG_INFO("Path found for pileup correction = "<< filename);
129 std::unique_ptr<TFile> f(TFile::Open(filename.c_str(), "READ"));
130 m_puZetaCorrection[xAOD::Iso::topoetcone20] = std::unique_ptr<TGraph>((TGraph*)f->Get("topoetcone20"));
131 m_puZetaCorrection[xAOD::Iso::topoetcone30] = std::unique_ptr<TGraph>((TGraph*)f->Get("topoetcone30"));
132 m_puZetaCorrection[xAOD::Iso::topoetcone40] = std::unique_ptr<TGraph>((TGraph*)f->Get("topoetcone40"));
133 f->Close();
134
135 if (m_isMC) {
137 if (filename.empty()){
138 ATH_MSG_ERROR ( "Could NOT resolve file name " << m_puZetaMCCorrectionFileName );
139 return StatusCode::FAILURE ;
140 }
141 ATH_MSG_INFO("Path found for mc additional correction of pileup correction = "<< filename);
142 std::unique_ptr<TFile> g(TFile::Open(filename.c_str(), "READ"));
143 m_puZetaMCCorrection[xAOD::Iso::topoetcone20] = std::unique_ptr<TGraph>((TGraph*)g->Get("topoetcone20"));
144 m_puZetaMCCorrection[xAOD::Iso::topoetcone30] = std::unique_ptr<TGraph>((TGraph*)g->Get("topoetcone30"));
145 m_puZetaMCCorrection[xAOD::Iso::topoetcone40] = std::unique_ptr<TGraph>((TGraph*)g->Get("topoetcone40"));
146 g->Close();
147 }
148 }
149
150 // Exit function
151 return StatusCode::SUCCESS;
152 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< bool > m_InitializeReadHandles
Property: Initialize read Handles.
ToolHandle< IFlowElementsInConeTool > m_pflowObjectsInConeTool
Gaudi::Property< std::string > m_puZetaCorrectionFileName
name of the root file for the eta dependant pileup correction
Gaudi::Property< std::string > m_puZetaMCCorrectionFileName
ToolHandle< ICaloClustersInConeTool > m_clustersInConeTool
ToolHandle< CP::IIsolationCorrectionTool > m_IsoLeakCorrectionTool
Tool for pt-corrected isolation calculation (new)
str index
Definition DeMoScan.py:362
@ topoetcone20
Topo-cluster ET-sum.

◆ initresult()

void xAOD::CaloIsolationTool::initresult ( CaloIsolation & result,
const CaloCorrection & corrlist,
unsigned int typesize )
staticprivate

Definition at line 1582 of file CaloIsolationTool.cxx.

1584 {
1585
1586 result.corrlist = corrlist;
1587 result.coreCorrections.clear();
1588 result.noncoreCorrections.clear();
1589 result.etcones.resize(typesize,0.);
1590
1591 }

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ neutralEflowIsolation() [1/3]

bool xAOD::CaloIsolationTool::neutralEflowIsolation ( CaloIsolation & result,
const Egamma & eg,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
double coneCoreSize ) const
private

cast for egamma (pflowetcone egamma)

Definition at line 415 of file CaloIsolationTool.cxx.

420 {
421
422 if( isoTypes.empty() ) {
423 ATH_MSG_WARNING("Empty list passed, failing calculation");
424 return false;
425 }
426 if(!m_useEMScale){
427 ATH_MSG_WARNING("Only EM scale is supported by neutralEflowIsolation");
428 return false;
429 }
430
431 unsigned int typesize = isoTypes.size();
432 initresult(result, corrlist, typesize);
433
434 std::vector<float> coneSizes;
435 coneSizes.reserve(isoTypes.size());
436
437 for( auto isoType : isoTypes ){
438 coneSizes.push_back(Iso::coneSize(isoType));
439 }
440
441 // neutral pflow are pv-corrected
442 // ==> use electron eta/phi (not associated SC eta/phi)
443 // ==> for photons, there is a mismatch...
444 float phi = eg.phi();
445 float eta = eg.eta();
446
447 ATH_MSG_DEBUG("eg pt eta phi " << eg.pt() << " " << eta << " " << phi
448 << " cluster eta, phi = " << eg.caloCluster()->eta() << " " << eg.caloCluster()->phi());
449
450 if (!pflowConeIsolation(result, eta, phi, coneSizes, true, nullptr, coneCoreSize, &eg)) {
451 ATH_MSG_WARNING("pflowConeIsolation failed");
452 return false;
453 }
454
455 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::core57cells))) {
456 // Apply core energy subtraction
457 if (!correctIsolationEnergy_Eeg57(result,isoTypes,&eg))
458 ATH_MSG_WARNING("Could not compute core cell energy for egamma in neflowisol");
459 }
460
461 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) {
462 // do pt correction
463 if (!PtCorrection(result, eg, isoTypes))
464 ATH_MSG_WARNING("Could not apply pt correction to isolation");
465 }
466
467 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) {
468 // do pile-up correction
469 std::string type = "PFlow";
470 if (!EDCorrection(result,isoTypes,eta,type,nullptr))
471 ATH_MSG_WARNING("Could not apply ED correction to topo isolation");
472 }
473
474 return true;
475 }
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

◆ neutralEflowIsolation() [2/3]

bool xAOD::CaloIsolationTool::neutralEflowIsolation ( CaloIsolation & result,
const IParticle & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections ) const
overridevirtual

INeutralEFlowIsolationTool interface:

get track particle

Implements xAOD::INeutralEFlowIsolationTool.

Definition at line 239 of file CaloIsolationTool.cxx.

241 {
242
243 //
244 double coneCoreSize = m_coneCoreSizeEg;
245 if (particle.type() == Type::Muon)
246 coneCoreSize = m_coneCoreSizeMu;
247
248 derefMap_t derefMap;
250 const IParticle* ip = getReferenceParticle(particle);
251 if( !ip ){
252 ATH_MSG_WARNING("Failed to obtain reference particle");
253 return false;
254 }
255 derefMap[ip] = &particle;
256
257 // muon pflowetcone isolation
258 const TrackParticle* trkp = dynamic_cast<const TrackParticle*>(ip);
259 if ( trkp ) return neutralEflowIsolation(result,*trkp,cones,corrlist,coneCoreSize,derefMap);
260
261 // egamma pflowetcone isolation
262 const Egamma* egam = dynamic_cast<const Egamma*>(ip);
263 if ( egam ) return neutralEflowIsolation(result,*egam,cones,corrlist,coneCoreSize);
264
265 ATH_MSG_WARNING("FlowElementIsolation only supported for Egamma and TrackParticle");
266
267 return true;
268 }
virtual bool neutralEflowIsolation(CaloIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, const CaloCorrection &corrections) const override
INeutralEFlowIsolationTool interface:

◆ neutralEflowIsolation() [3/3]

bool xAOD::CaloIsolationTool::neutralEflowIsolation ( CaloIsolation & result,
const TrackParticle & tp,
const std::vector< Iso::IsolationType > & cones,
const CaloCorrection & corrections,
double coneCoreSize,
derefMap_t & derefMap ) const
private

cast for egamma (pflowetcone egamma)

Definition at line 479 of file CaloIsolationTool.cxx.

486 {
487
488 if( isoTypes.empty() ) {
489 ATH_MSG_WARNING("Empty list passed, failing calculation");
490 return false;
491 }
492
493 unsigned int typesize = isoTypes.size();
494 initresult(result, corrlist, typesize);
495
496 std::vector<float> coneSizes;
497 coneSizes.reserve(isoTypes.size());
498
499 for( auto isoType : isoTypes ){
500 coneSizes.push_back(Iso::coneSize(isoType));
501 }
502
503 float phi = tp.phi();
504 float eta = tp.eta();
505 if(!GetExtrapEtaPhi(&tp,eta,phi,derefMap)) {
506 ATH_MSG_WARNING("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << " not updated from extraplation!");
507 }
508 ATH_MSG_DEBUG("TrackParticle eta = " << tp.eta() << ", phi = " << tp.phi() << ", extrap eta = " << eta << ", phi = " << phi);
509
510 // The core subtraction with pflow removal is done in the method below
511 if (!pflowConeIsolation(result, eta, phi, coneSizes, false, nullptr, coneCoreSize)) {
512 ATH_MSG_WARNING("pflowConeIsolation failed for muon");
513 return false;
514 }
515
516 // core energy subtraction
517 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreMuon))) {
518 if (!correctIsolationEnergy_MuonCore(result, tp, derefMap))
519 ATH_MSG_WARNING("Could not compute muon core energy (cells) from neflowisol");
520 }
521
522 // do pile-up correction
523 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::pileupCorrection))) {
524 std::string type = "PFlow";
525 if (!EDCorrection(result,isoTypes,eta,type,nullptr))
526 ATH_MSG_WARNING("Could not apply ED correction to eflow isolation for muon");
527 }
528
529 return true;
530 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ pflowConeIsolation()

bool xAOD::CaloIsolationTool::pflowConeIsolation ( CaloIsolation & result,
float eta,
float phi,
std::vector< float > & m_coneSizes,
bool coreEMonly,
const FlowElementContainer * container,
double coneCoreSize,
const Egamma * egObj = nullptr ) const
private

Definition at line 1012 of file CaloIsolationTool.cxx.

1020 {
1021
1022 // container is large: preselect only those in max cone size
1023 auto max_cone_iter=std::max_element(coneSizes.begin(), coneSizes.end());
1024 float max_cone = (*max_cone_iter);
1025 std::vector<const FlowElement*> clusts;
1026 if (!container) {
1027#ifndef XAOD_ANALYSIS
1029 m_pflowObjectsInConeTool->particlesInCone(eta,phi,max_cone,clusts);
1030 } else {
1031 ATH_MSG_WARNING("No FlowElementsInConeTool available");
1032 }
1033#else
1034 if(!particlesInCone(eta,phi,max_cone,clusts)) ATH_MSG_WARNING("Failed to get particles in cone.");
1035#endif
1036 } else { // trigger container is small enough
1037 auto clItr = container->begin();
1038 auto clItrE = container->end();
1039 for(; clItr != clItrE; ++clItr){
1040 clusts.push_back (*clItr);
1041 }
1042 }
1043
1044 // Calculate isolation for pflow objects
1045 if (!pflowObjCones (result,eta,phi,coneSizes,clusts)) {
1046 ATH_MSG_WARNING("Could not compute pflow isolation");
1047 return false;
1048 }
1049
1050 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))) {
1051 // Core subtraction
1052 // be careful, require a certain tag of eflowRec, below which eSample are not always filled
1053 if (!correctIsolationEnergy_pflowCore(result, eta, phi, -1, -1, coneCoreSize*coneCoreSize, clusts, coreEMonly, egObj))
1054 ATH_MSG_WARNING("Could not compure pflow core");
1055 }
1056
1057 return true;
1058 }
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_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.

◆ pflowObjCones()

bool xAOD::CaloIsolationTool::pflowObjCones ( CaloIsolation & result,
float eta,
float phi,
std::vector< float > & m_coneSizes,
const std::vector< const FlowElement * > & clusts ) const
private

Calculate isolation cones in pflow objects around eg.

Definition at line 1097 of file CaloIsolationTool.cxx.

1100 {
1101
1102 ATH_MSG_DEBUG("In pflowObjCones obj eta = " << eta << " phi = " << phi);
1103
1104 for (const FlowElement* cl : clusts) {
1105 float et = cl->pt();
1106 if (et <= 0 || fabs(cl->eta()) > 7.0) continue;
1107
1108 float dPhi = Phi_mpi_pi(cl->phi()-phi);
1109 float dEta = cl->eta()-eta;
1110 float dR = sqrt(dPhi*dPhi+ dEta*dEta);
1111
1112 for (unsigned int i = 0; i < coneSizes.size(); i++) {
1113 if (dR < coneSizes[i]) {
1114 result.etcones[i] += et;
1115 }
1116 }
1117 }
1118
1119 return true;
1120 }

◆ Phi_mpi_pi()

float xAOD::CaloIsolationTool::Phi_mpi_pi ( float x) const
inlineprivate

Definition at line 402 of file CaloIsolationTool.h.

402 {
403 while (x >= M_PI) x -= 2.*M_PI;
404 while (x < -M_PI) x += 2.*M_PI;
405 return x;
406 }
#define x

◆ print()

◆ PtCorrection()

bool xAOD::CaloIsolationTool::PtCorrection ( CaloIsolation & result,
const Egamma & eg,
const std::vector< Iso::IsolationType > & isoTypes ) const
private

FIX LATER

Definition at line 1470 of file CaloIsolationTool.cxx.

1473 {
1474// #ifndef XAOD_ANALYSIS
1475 if(m_IsoLeakCorrectionTool.empty()) return false;
1476// #endif // XAOD_ANALYSIS
1477
1478 std::vector<float> corrvec;
1479 corrvec.resize(isoTypes.size(),0.);
1480 for (unsigned int i = 0; i < isoTypes.size(); i++) {
1481
1482// #ifndef XAOD_ANALYSIS
1483 corrvec[i] = m_IsoLeakCorrectionTool->GetPtCorrection(eg, isoTypes[i]);
1484// #else
1485// corrvec[i] = eg.isolationCaloCorrection (isoTypes[i], Iso::ptCorrection);
1486// #endif // XAOD_ANALYSIS
1487 if (result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::ptCorrection))) {
1488 result.etcones[i] -= corrvec[i];
1489 ATH_MSG_DEBUG("eta = " << eg.eta() << ", phi = " << eg.phi() << ", pt = " << eg.pt() << ", isoType = " << Iso::toCString(isoTypes[i])
1490 << ", ptcorr = " << corrvec[i] << ", isol pt corrected = " << result.etcones[i] );
1491 }
1492 }
1493 result.noncoreCorrections[Iso::ptCorrection] = corrvec;
1495 // get the correction from xAOD file
1496
1497 return true;
1498 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ topoClustCones()

bool xAOD::CaloIsolationTool::topoClustCones ( CaloIsolation & result,
float eta,
float phi,
std::vector< float > & m_coneSizes,
const std::vector< const CaloCluster * > & clusts ) const
private

Calculate isolation cones in topo clusters around eg.

Definition at line 1063 of file CaloIsolationTool.cxx.

1066 {
1067
1068 ATH_MSG_DEBUG("In CaloIsolationTool::topoClustCones");
1069
1070 for (const CaloCluster* cl : clusts) {
1071 float et = (m_useEMScale ? cl->p4(CaloCluster::State::UNCALIBRATED).Et() : cl->pt() );
1072 if(et <= 0 || fabs(cl->eta()) > 7.0) continue;
1073
1074 float st = 1./cosh(cl->p4(CaloCluster::State::UNCALIBRATED).Eta());
1075 float tilegap3_et = cl->eSample(CaloSampling::TileGap3)*st;
1076 et -= tilegap3_et;
1077
1078 float dPhi = Phi_mpi_pi(cl->phi()-phi);
1079 float dEta = cl->eta()-eta;
1080 float dr=sqrt(dPhi*dPhi+ dEta*dEta);
1081
1082 for (unsigned int i = 0; i < coneSizes.size(); i++) {
1083 if (dr < coneSizes[i]) {
1084 ATH_MSG_DEBUG("Adding topo " << cl << " dR = " << dr << " et of a topo clust et = " << et
1085 << " (calibrated " << cl->pt() << ", tilegap et = " << tilegap3_et << ")");
1086 result.etcones[i] += et;
1087 }
1088 }
1089 }
1090
1091 return true;
1092 }

◆ topoConeIsolation()

bool xAOD::CaloIsolationTool::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
private

Definition at line 964 of file CaloIsolationTool.cxx.

971 {
972
973 // offline topocluster container is large: preselect only those in max cone size
974 auto max_cone_iter=std::max_element(coneSizes.begin(), coneSizes.end());
975 float max_cone= (*max_cone_iter);
976 std::vector<const CaloCluster*> clusts;
977 if(!container){
978#ifndef XAOD_ANALYSIS
980 m_clustersInConeTool->particlesInCone(eta,phi,max_cone,clusts);
981 }else{
982 ATH_MSG_WARNING("No CaloClustersInConeTool available");
983 }
984#else
985 if(!particlesInCone(eta,phi,max_cone,clusts))
986 ATH_MSG_WARNING("No CaloClustersInConeTool available");
987#endif
988 }else{ // trigger container is small enough
989 auto clItr = container->begin();
990 auto clItrE = container->end();
991 for(; clItr != clItrE; ++clItr){
992 clusts.push_back (*clItr);
993 }
994 }
995
996 // Calculate isolation for topo cluster
997 if (!topoClustCones (result,eta,phi, coneSizes, clusts)) {
998 ATH_MSG_WARNING("Could not compute topo isolation");
999 return false;
1000 }
1001
1002 if (!m_saveOnlyRequestedCorrections || result.corrlist.calobitset.test(static_cast<unsigned int>(Iso::coreCone))) {
1003 // Subtract core (easier to do that here than outside like other core corrections)
1004 if (!correctIsolationEnergy_TopoCore(result, eta, phi, -1, -1, coneCoreSize*coneCoreSize, clusts, coreEMonly, fwdClus, egObj))
1005 ATH_MSG_WARNING("Could not compute topo core");
1006 }
1007
1008 return true;
1009 }
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
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.
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.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_assoTool

ToolHandle<Rec::IParticleCaloCellAssociationTool> xAOD::CaloIsolationTool::m_assoTool
private
Initial value:
{this,
"ParticleCaloCellAssociationTool",
"Rec::ParticleCaloCellAssociationTool/ParticleCaloCellAssociationTool"}

Definition at line 271 of file CaloIsolationTool.h.

271 {this,
272 "ParticleCaloCellAssociationTool",
273 "Rec::ParticleCaloCellAssociationTool/ParticleCaloCellAssociationTool"};

◆ m_CaloCalTopoCluster

std::string xAOD::CaloIsolationTool::m_CaloCalTopoCluster
private

Topo Calo cluster location in event store.

Definition at line 321 of file CaloIsolationTool.h.

◆ m_caloExtensionKey

SG::ReadHandleKey<CaloExtensionCollection> xAOD::CaloIsolationTool::m_caloExtensionKey
private
Initial value:
{
this, "InputCaloExtension", "", "The calorimeter extensions of the tracks"}

The input calorimeter extensions.

Definition at line 300 of file CaloIsolationTool.h.

300 {
301 this, "InputCaloExtension", "", "The calorimeter extensions of the tracks"};

◆ m_caloExtTool

ToolHandle<Trk::IParticleCaloExtensionTool> xAOD::CaloIsolationTool::m_caloExtTool
private
Initial value:
{this,
"ParticleCaloExtensionTool",
"Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"}

Definition at line 275 of file CaloIsolationTool.h.

275 {this,
276 "ParticleCaloExtensionTool",
277 "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool"};

◆ m_caloFillRectangularTool

ToolHandle<CaloClusterProcessor> xAOD::CaloIsolationTool::m_caloFillRectangularTool
private
Initial value:
{this,
"CaloFillRectangularClusterTool", "",
"Handle of the CaloFillRectangularClusterTool"}

Property: calo cluster filling tool.

Definition at line 290 of file CaloIsolationTool.h.

290 {this,
291 "CaloFillRectangularClusterTool", "",
292 "Handle of the CaloFillRectangularClusterTool"};

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> xAOD::CaloIsolationTool::m_caloMgrKey {this,"CaloDetDescrManager", "CaloDetDescrManager"}
private

CaloDetDescrManager from ConditionStore.

Definition at line 304 of file CaloIsolationTool.h.

304{this,"CaloDetDescrManager", "CaloDetDescrManager"};

◆ m_clustersInConeTool

ToolHandle<ICaloClustersInConeTool> xAOD::CaloIsolationTool::m_clustersInConeTool
private
Initial value:
{this,
"ClustersInConeTool",
"xAOD::CaloClustersInConeTool/CaloClustersInConeTool"}

Definition at line 281 of file CaloIsolationTool.h.

281 {this,
282 "ClustersInConeTool",
283 "xAOD::CaloClustersInConeTool/CaloClustersInConeTool"};

◆ m_coneCoreSizeEg

Gaudi::Property<double> xAOD::CaloIsolationTool::m_coneCoreSizeEg
private
Initial value:
{this,
"coneCoreSizeEg", 0.1,
"size of the coneCore core energy correction for egamma objects"}

Property: The size of the coneCore core energy calculation.

Definition at line 363 of file CaloIsolationTool.h.

363 {this,
364 "coneCoreSizeEg", 0.1,
365 "size of the coneCore core energy correction for egamma objects"};

◆ m_coneCoreSizeMu

Gaudi::Property<double> xAOD::CaloIsolationTool::m_coneCoreSizeMu
private
Initial value:
{this,
"coneCoreSizeMu", 0.05,
"size of the coneCore core energy correction for muons"}

Definition at line 367 of file CaloIsolationTool.h.

367 {this,
368 "coneCoreSizeMu", 0.05,
369 "size of the coneCore core energy correction for muons"};

◆ m_derefMap

std::map<const IParticle*, const IParticle*> xAOD::CaloIsolationTool::m_derefMap
private

map to the orignal particle

Definition at line 372 of file CaloIsolationTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doEnergyDensityCorrection

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_doEnergyDensityCorrection
private
Initial value:
{this,
"doEnergyDensityCorrection", true,
"Correct isolation variables based on energy density estimations"}

Property: do the ED corrections to topoisolation.

Definition at line 329 of file CaloIsolationTool.h.

329 {this,
330 "doEnergyDensityCorrection", true,
331 "Correct isolation variables based on energy density estimations"};

◆ m_efEDCentral

SG::ReadHandleKey<EventShape> xAOD::CaloIsolationTool::m_efEDCentral
private
Initial value:
{this,
"EFlowEDCentralContainer", "NeutralParticleFlowIsoCentralEventShape",
"Name of energy flow ED Central"}

Property: Name of the central neutral energy flow energy-density container.

Definition at line 353 of file CaloIsolationTool.h.

353 {this,
354 "EFlowEDCentralContainer", "NeutralParticleFlowIsoCentralEventShape",
355 "Name of energy flow ED Central"};

◆ m_efEDForward

SG::ReadHandleKey<EventShape> xAOD::CaloIsolationTool::m_efEDForward
private
Initial value:
{this,
"EFlowEDForwardContainer", "NeutralParticleFlowIsoForwardEventShape",
"Name of energy flow ED Forward"}

Property: Name of the forward neutral energy flow energy-density container.

Definition at line 358 of file CaloIsolationTool.h.

358 {this,
359 "EFlowEDForwardContainer", "NeutralParticleFlowIsoForwardEventShape",
360 "Name of energy flow ED Forward"};

◆ m_EMCaloNums

Gaudi::Property<std::vector<int> > xAOD::CaloIsolationTool::m_EMCaloNums
private
Initial value:
{this,
"EMCaloNums", {}, "list of EM calo to treat"}

vector of calo-id to treat

Definition at line 313 of file CaloIsolationTool.h.

313 {this,
314 "EMCaloNums", {}, "list of EM calo to treat"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_ExcludeTG3

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_ExcludeTG3
private
Initial value:
{this,
"ExcludeTG3", true, "Exclude the TileGap3 cells"}

Property: exclude tile scintillator.

Definition at line 339 of file CaloIsolationTool.h.

339 {this,
340 "ExcludeTG3", true, "Exclude the TileGap3 cells"};

◆ m_HadCaloNums

Gaudi::Property<std::vector<int> > xAOD::CaloIsolationTool::m_HadCaloNums
private
Initial value:
{this,
"HadCaloNums", {}, "list of Had calo to treat"}

vector of calo-id to treat

Definition at line 317 of file CaloIsolationTool.h.

317 {this,
318 "HadCaloNums", {}, "list of Had calo to treat"};

◆ m_InitializeReadHandles

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_InitializeReadHandles
private
Initial value:
{this,
"InitializeReadHandles", true,
"Initialize all ReadHandles."}

Property: Initialize read Handles.

Default True. For HLT these need to be off.

Definition at line 375 of file CaloIsolationTool.h.

375 {this,
376 "InitializeReadHandles", true,
377 "Initialize all ReadHandles."};

◆ m_isMC

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_isMC {this, "isMC", false, "is MC"}
private

Property: need to know if this is MC (from rec.doTruth) for eta dep pileup corr.

Definition at line 380 of file CaloIsolationTool.h.

380{this, "isMC", false, "is MC"};

◆ m_IsoLeakCorrectionTool

ToolHandle<CP::IIsolationCorrectionTool> xAOD::CaloIsolationTool::m_IsoLeakCorrectionTool
private
Initial value:
{this,
"IsoLeakCorrectionTool", "",
"Handle on the leakage correction tool"}

Tool for pt-corrected isolation calculation (new)

Definition at line 308 of file CaloIsolationTool.h.

308 {this,
309 "IsoLeakCorrectionTool", "",
310 "Handle on the leakage correction tool"};

◆ m_parsIdHelper

Trk::TrackParametersIdHelper xAOD::CaloIsolationTool::m_parsIdHelper
private

Definition at line 278 of file CaloIsolationTool.h.

◆ m_pflowObjectsInConeTool

ToolHandle<IFlowElementsInConeTool> xAOD::CaloIsolationTool::m_pflowObjectsInConeTool
private
Initial value:
{this,
"FlowElementsInConeTool", ""}

Definition at line 286 of file CaloIsolationTool.h.

286 {this,
287 "FlowElementsInConeTool", ""};

◆ m_puZetaCorrection

std::map<Iso::IsolationType,std::unique_ptr<TGraph> > xAOD::CaloIsolationTool::m_puZetaCorrection
private

map of the zeta corrections (one / cone size)

Definition at line 395 of file CaloIsolationTool.h.

◆ m_puZetaCorrectionFileName

Gaudi::Property<std::string> xAOD::CaloIsolationTool::m_puZetaCorrectionFileName
private
Initial value:
{this,
"EtaDependentPileupCorrectionFileName", "IsolationCorrections/v4/zetas.root",
"File name for the eta dependant pileup correction to isolation"}

name of the root file for the eta dependant pileup correction

Definition at line 387 of file CaloIsolationTool.h.

387 {this,
388 "EtaDependentPileupCorrectionFileName", "IsolationCorrections/v4/zetas.root",
389 "File name for the eta dependant pileup correction to isolation"};

◆ m_puZetaMCCorrection

std::map<Iso::IsolationType,std::unique_ptr<TGraph> > xAOD::CaloIsolationTool::m_puZetaMCCorrection
private

Definition at line 396 of file CaloIsolationTool.h.

◆ m_puZetaMCCorrectionFileName

Gaudi::Property<std::string> xAOD::CaloIsolationTool::m_puZetaMCCorrectionFileName
private
Initial value:
{this,
"EtaDependentPileupMCCorrectionFileName", "IsolationCorrections/v4/zetas_correction.root",
"File name for the eta dependant pileup correction to isolation, small mc correction"}

Definition at line 390 of file CaloIsolationTool.h.

390 {this,
391 "EtaDependentPileupMCCorrectionFileName", "IsolationCorrections/v4/zetas_correction.root",
392 "File name for the eta dependant pileup correction to isolation, small mc correction"};

◆ m_saveOnlyRequestedCorrections

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_saveOnlyRequestedCorrections
private
Initial value:
{this,
"saveOnlyRequestedCorrections", false,
"save only requested corrections (trigger usage mainly)"}

Property: save only requested corrections (trigger usage mainly)

Definition at line 334 of file CaloIsolationTool.h.

334 {this,
335 "saveOnlyRequestedCorrections", false,
336 "save only requested corrections (trigger usage mainly)"};

◆ m_tpEDCentral

SG::ReadHandleKey<EventShape> xAOD::CaloIsolationTool::m_tpEDCentral
private
Initial value:
{this,
"TopoClusterEDCentralContainer", "TopoClusterIsoCentralEventShape",
"Name of TopoCluster ED Central"}

Property: Name of the central topocluster energy-density container.

Definition at line 343 of file CaloIsolationTool.h.

343 {this,
344 "TopoClusterEDCentralContainer", "TopoClusterIsoCentralEventShape",
345 "Name of TopoCluster ED Central"};

◆ m_tpEDForward

SG::ReadHandleKey<EventShape> xAOD::CaloIsolationTool::m_tpEDForward
private
Initial value:
{this,
"TopoClusterEDForwardContainer", "TopoClusterIsoForwardEventShape",
"Name of TopoCluster ED Forward"}

Property: Name of the forward topocluster energy-density container.

Definition at line 348 of file CaloIsolationTool.h.

348 {this,
349 "TopoClusterEDForwardContainer", "TopoClusterIsoForwardEventShape",
350 "Name of TopoCluster ED Forward"};

◆ m_useCaloExtensionCaching

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_useCaloExtensionCaching
private
Initial value:
{this,
"UseCaloExtensionCaching", true,
"Use cached caloExtension if avaliable."}

Property: Use cached caloExtension if avaliable.

Definition at line 295 of file CaloIsolationTool.h.

295 {this,
296 "UseCaloExtensionCaching", true,
297 "Use cached caloExtension if avaliable."};

◆ m_useEMScale

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_useEMScale
private
Initial value:
{this,
"UseEMScale", true,
"Use TopoClusters at the EM scale."}

Property: Use TopoClusters at the EM scale.

Definition at line 324 of file CaloIsolationTool.h.

324 {this,
325 "UseEMScale", true,
326 "Use TopoClusters at the EM scale."};

◆ m_useEtaDepPU

Gaudi::Property<bool> xAOD::CaloIsolationTool::m_useEtaDepPU
private
Initial value:
{this,
"UseEtaDepPUCorr", true, "Use the eta dependent pileup correction"}

Property: use pileup dependent correction.

Definition at line 383 of file CaloIsolationTool.h.

383 {this,
384 "UseEtaDepPUCorr", true, "Use the eta dependent pileup correction"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: