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

#include <TrackIsolationTool.h>

Inheritance diagram for xAOD::TrackIsolationTool:
Collaboration diagram for xAOD::TrackIsolationTool:

Classes

struct  TrackIsolationInput

Public Types

typedef std::vector< const TrackParticle * > TPVec
 Create a constructor for Athena.

Public Member Functions

 TrackIsolationTool (const std::string &name)
 constructor
virtual ~TrackIsolationTool (void)
 destructor
virtual StatusCode initialize () override
 initialize
virtual bool trackIsolation (TrackIsolation &result, const IParticle &tp, const std::vector< Iso::IsolationType > &cones, TrackCorrection corrections, const Vertex *vertex=0, const std::set< const TrackParticle * > *exclusionSet=0, const TrackParticleContainer *indetTrackParticles=0) const override
 ITrackIsolationTool 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 ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

float phiInRange (float phi) const
 hepler function to ensure phi is within +-Pi
bool simpleIsolation (TrackIsolationInput &input, TrackIsolation &result, const TrackParticleContainer *indetTrackParticles=0) const
 simple isolation (loop)
bool binnedIsolation (TrackIsolationInput &input, TrackIsolation &result) const
 using TracksInConeTool
void add (TrackIsolationInput &input, const TrackParticle &tp2, TrackIsolation &result) const
 add track particle to isolation calculation
const IParticlegetReferenceParticle (const IParticle &particle) const
 get reference particle
const VertexretrieveIDBestPrimaryVertex (const VertexContainer *vtxC) const
 retrieve pvx if not given
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 (TrackIsolation &result, TrackCorrection corrlist, unsigned int typesize)
 init result struct

Private Attributes

SG::ReadHandleKey< TrackParticleContainerm_indetTrackParticleLocation
 track particle location
Gaudi::Property< boolm_simpleIsolation {this, "SimpleIsolation", false}
 flag to select calculation type
Gaudi::Property< floatm_overlapCone {this, "OverlapCone", 0.1}
Gaudi::Property< floatm_maxTime {this, "IsoTimeRemoval", 2.5}
float m_overlapCone2 = 0.0F
Gaudi::Property< floatm_coreTrackEtaRange
 overlap cone size squared
bool m_useLooseTrackCore {false}
 Whether the loose core track eta range is used.
ToolHandle< ITrackParticlesInConeToolm_tracksInConeTool
 tracks in cone tool
ToolHandle< InDet::IInDetTrackSelectionToolm_trkselTool
 selection of tracks
ToolHandle< CP::ITrackVertexAssociationToolm_ttvaTool
 Select tracks associated to the vertex.
bool m_useTTVATool {false}
 Use the ttva tool. Set to true if one was provided.
SG::ReadHandleKey< VertexContainerm_vertexLocation
Gaudi::Property< boolm_DoTimingSel {this, "DoForwardIsoTiming",false,"Apply the timing selection on the track Isolation"}
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

Static Private Attributes

static constexpr float m_2PI = 2*M_PI
 define 2*Pi

Detailed Description

Definition at line 38 of file TrackIsolationTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TPVec

Create a constructor for Athena.

Definition at line 43 of file TrackIsolationTool.h.

Constructor & Destructor Documentation

◆ TrackIsolationTool()

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

constructor

Definition at line 28 of file TrackIsolationTool.cxx.

28 :
29 asg::AsgTool(name)
30 {
31#ifndef XAOD_ANALYSIS
32 declareInterface<ITrackIsolationTool>(this);
33#endif // XAOD_ANALYSIS
34 }

◆ ~TrackIsolationTool()

xAOD::TrackIsolationTool::~TrackIsolationTool ( void )
virtualdefault

destructor

Member Function Documentation

◆ add()

void xAOD::TrackIsolationTool::add ( TrackIsolationInput & input,
const TrackParticle & tp2,
TrackIsolation & result ) const
private

add track particle to isolation calculation

sum up particle to the different cones

Definition at line 245 of file TrackIsolationTool.cxx.

246 {
247 // check if track pointer matches the one of input or one of the exclusion set
248 // Jon Burr: I'm not completely convinced by the use of CoreTrackEtaRange.
249 // With this setup, if you're running in simple isolation mode any track
250 // within the same eta slice (even on the other side of the detector) will
251 // be included in the eta code. If you manually provide a track particle
252 // container then the tool automatically runs in this simple mode...
253 // This is fine in IsolationBuilder (the main client) but could produce
254 // unexpected results with other users
255 if(input.corrections.trackbitset.test(static_cast<unsigned int>(Iso::coreTrackPtr))){
256 if(input.particle == &tp2 ||
257 (input.exclusionSet && input.exclusionSet->count(&tp2)) ||
258 (m_useLooseTrackCore && std::abs(input.particle->eta() - tp2.eta()) < m_coreTrackEtaRange)){
259 ATH_MSG_DEBUG("track pointer " << &tp2 << ", track pt = " << tp2.pt() << ", input pt = " << input.particle->pt()) ;
260 result.coreCorrections[Iso::coreTrackPtr] += tp2.pt();
261 return;
262 }
263 }
264
265 // check eta
266 float deta = input.particle->eta()-tp2.eta();
267 if( fabs(deta) > input.maxRadius ) return;
268
269 // check phi
270 float dphi = phiInRange(input.particle->phi()-tp2.phi());
271 if( fabs(dphi) > input.maxRadius ) return;
272
273 // check dr2
274 float dr2 = deta*deta + dphi*dphi;
275
276 float dT_Sig=0;
277 //CheckTiming for ForwardElectron case
279 {
280 const xAOD::TrackParticle* tp = static_cast<const xAOD::TrackParticle*>(input.particle);
281 if(tp->hasValidTime() && tp2.hasValidTime()) {
282 dT_Sig = abs(tp->time() - tp2.time()) / sqrt( pow(tp2.timeResolution(),2)+pow(tp->timeResolution(),2));
283 } else {
284 ATH_MSG_DEBUG("No valid time for the track while doing track->time()" );
285 dT_Sig=0;
286 }
287 }
288 if( dT_Sig > m_maxTime) return;
289
290 // check cone if using cone based overlap removal
291 if(input.corrections.trackbitset.test(static_cast<unsigned int>(Iso::coreTrackCone))
292 && dr2 < m_overlapCone2 ) {
293 result.coreCorrections[Iso::coreTrackCone] += tp2.pt();
294 return;
295 }
296
298 for( unsigned int k=0;k<input.coneSizesSquared.size();++k ){
299 if( dr2 >= input.coneSizesSquared[k] ) return;
300 result.ptcones[k] += tp2.pt();
301 if( dr2 <= input.ptvarconeRadiusSquared ){
302 result.ptvarcones_10GeVDivPt[k] += tp2.pt();
303 }
304 }
305 }
#define ATH_MSG_DEBUG(x,...)
Gaudi::Property< float > m_coreTrackEtaRange
overlap cone size squared
bool m_useLooseTrackCore
Whether the loose core track eta range is used.
Gaudi::Property< bool > m_DoTimingSel
float phiInRange(float phi) const
hepler function to ensure phi is within +-Pi
Gaudi::Property< float > m_maxTime
float timeResolution() const
Returns the time resolution.
float time() const
Returns the time.
uint8_t hasValidTime() const
Returns whether or not the track has a valid time.
constexpr int pow(int x)
Definition conifer.h:27
@ TrackParticle
The object is a charged track particle.
Definition ObjectType.h:43
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ binnedIsolation()

bool xAOD::TrackIsolationTool::binnedIsolation ( TrackIsolationInput & input,
TrackIsolation & result ) const
private

using TracksInConeTool

prepare look-up structure

Definition at line 186 of file TrackIsolationTool.cxx.

187 {
189 std::vector<const TrackParticle*> tps;
190#ifndef XAOD_ANALYSIS
191 if( !m_tracksInConeTool->particlesInCone(input.particle->eta(),input.particle->phi(),input.maxRadius,tps) ) return false;
192#else
193 if( !getparticlesInCone(input.particle->eta(),input.particle->phi(),input.maxRadius,tps) ) return false;
194#endif
195
196 for( const auto& tp : tps ) {
197 if( (!m_trkselTool->accept( *tp , input.vertex)) ||
198 (m_useTTVATool && (!input.vertex || !m_ttvaTool->isCompatible(*tp, *input.vertex)))){
199 if (m_useTTVATool && !input.vertex){
200 ATH_MSG_DEBUG("Encountered a track isolation input with invalid vertex while requiring TTVA. Rejecting, please check your inputs!");
201 }
202 ATH_MSG_DEBUG("reject track pt = " << tp->pt());
203 continue;
204 } else{
205 ATH_MSG_DEBUG("Accept track " << tp << " pt = " << tp->pt() << " z+vz = " << tp->z0()+tp->vz() << " eta = " << tp->eta() << " phi = " << tp->phi());
206 }
207 add( input,*tp, result );
208
209 }
210 return true;
211 }
void add(TrackIsolationInput &input, const TrackParticle &tp2, TrackIsolation &result) const
add track particle to isolation calculation
ToolHandle< ITrackParticlesInConeTool > m_tracksInConeTool
tracks in cone tool
ToolHandle< CP::ITrackVertexAssociationTool > m_ttvaTool
Select tracks associated to the vertex.
bool m_useTTVATool
Use the ttva tool. Set to true if one was provided.
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkselTool
selection of tracks

◆ 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>

◆ 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.

◆ 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

◆ 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::Event 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::Event, 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::Event 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::Event, 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::TrackIsolationTool::getReferenceParticle ( const IParticle & particle) const
private

get reference particle

Print a warning for the case that no primary track was found. Given that eta/phi/pt are the same for the primary track and the muon track... Do not return a nullptr

Definition at line 89 of file TrackIsolationTool.cxx.

89 {
91 const Muon* muon = static_cast<const Muon*>(&particle);
92 const xAOD::TrackParticle* tp = muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
93 if( !tp ) tp = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary);
94 if( !tp ) {
97 ATH_MSG_WARNING(" No TrackParticle found for muon with pT: " <<muon->pt() * 1.e-3 <<"[GeV], eta: "<<muon->eta()<<" phi: "<<
98 muon->phi()<<" q: "<<muon->charge()<<" primaryAuthor: "<<muon->author()<< " allAuthors: "<<muon->allAuthors());
99 } else return tp;
100 }
101 else if( particle.type() == xAOD::Type::ObjectType::Electron )
102 {
103 const Electron* electron = static_cast<const xAOD::Electron*>(&particle);
105 {
106 const xAOD::TrackParticle* tp = electron->trackParticle();
107 return tp;
108 }
109 }
110 return &particle;
111 }
#define ATH_MSG_WARNING(x,...)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ Electron
The object is an electron.
Definition ObjectType.h:46
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30
Muon_v1 Muon
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".

◆ initialize()

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

initialize

square cone

Reimplemented from asg::AsgTool.

Definition at line 41 of file TrackIsolationTool.cxx.

42 {
43#ifndef XAOD_ANALYSIS
44 ATH_CHECK(m_tracksInConeTool.retrieve( DisableTool{m_simpleIsolation} ));
45#endif // XAOD_ANALYSIS
46
47 if(m_trkselTool.retrieve().isFailure()){
48 ATH_MSG_FATAL("Could not retrieve InDetTrackSelectionTool");
49 return StatusCode::FAILURE;
50 }
51 if (!m_ttvaTool.empty()) {
52 ATH_MSG_DEBUG("Use TTVA tool " << m_ttvaTool);
53 m_useTTVATool = true;
54 ATH_CHECK( m_ttvaTool.retrieve() );
55 }
56 else
57 ATH_MSG_DEBUG("Will not use TTVA tool");
58
61
62 // the read handles
64 if (!m_vertexLocation.key().empty())
65 ATH_CHECK(m_vertexLocation.initialize());
66
67 if (m_coreTrackEtaRange.value() > 0)
69
70 return StatusCode::SUCCESS;
71 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x,...)
SG::ReadHandleKey< VertexContainer > m_vertexLocation
SG::ReadHandleKey< TrackParticleContainer > m_indetTrackParticleLocation
track particle location
Gaudi::Property< float > m_overlapCone

◆ initresult()

void xAOD::TrackIsolationTool::initresult ( TrackIsolation & result,
TrackCorrection corrlist,
unsigned int typesize )
staticprivate

init result struct

Definition at line 307 of file TrackIsolationTool.cxx.

309 {
310
311 result.corrlist = corrlist;
312 result.coreCorrections.clear();
313 result.ptcones.resize(typesize,0.);
314 result.ptvarcones_10GeVDivPt.resize(typesize,0.);
315
316 std::vector<float> vec;
317 vec.resize(typesize,0.);
318
319 for(unsigned int i=0;i<static_cast<unsigned int>(Iso::numIsolationTrackCorrections);i++){
320 result.coreCorrections[static_cast<Iso::IsolationTrackCorrection>(i)] = 0.;
321 }
322 }
std::vector< size_t > vec

◆ 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 }

◆ 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.

◆ phiInRange()

float xAOD::TrackIsolationTool::phiInRange ( float phi) const
inlineprivate

hepler function to ensure phi is within +-Pi

Definition at line 92 of file TrackIsolationTool.h.

92 {
93 while (phi >= M_PI) phi -= m_2PI;
94 while (phi < -M_PI) phi += m_2PI;
95 return phi;
96 }
#define M_PI
static constexpr float m_2PI
define 2*Pi

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ 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 }

◆ retrieveIDBestPrimaryVertex()

const Vertex * xAOD::TrackIsolationTool::retrieveIDBestPrimaryVertex ( const VertexContainer * vtxC) const
private

retrieve pvx if not given

Definition at line 73 of file TrackIsolationTool.cxx.

74 {
75 if (vtxC) {
76 if (vtxC->empty()) {
77 ATH_MSG_INFO("No vertex in container.");
78 return nullptr;
79 }
80 // In fact, should rather do like that, in case front is not PriVtx
81 for (const auto* const vtx : *vtxC ) {
82 if (vtx->vertexType() == xAOD::VxType::PriVtx)
83 return vtx;
84 }
85 }
86 return nullptr;
87 }
@ PriVtx
Primary vertex.

◆ simpleIsolation()

bool xAOD::TrackIsolationTool::simpleIsolation ( TrackIsolationInput & input,
TrackIsolation & result,
const TrackParticleContainer * indetTrackParticles = 0 ) const
private

simple isolation (loop)

retrieve track particles if not passed into the interface

Definition at line 213 of file TrackIsolationTool.cxx.

214 {
215
216 SG::ReadHandle<TrackParticleContainer> tpH;
218 if( !indetTrackParticles ) {
220 if (!tpH.isValid()) {
221 ATH_MSG_ERROR("Could not open a TrackParticle container with key "
223 return false;
224 }
225 indetTrackParticles = tpH.ptr();
226 }
227
228 // exit if not track particles found
229 if( !indetTrackParticles ) return false;
230
231 // loop over all track particles
232 for( const auto *const tp : *indetTrackParticles ) {
233 if( (!m_trkselTool->accept(*tp, input.vertex)) ||
234 (m_useTTVATool && !m_ttvaTool->isCompatible(*tp, *input.vertex))){
235 ATH_MSG_DEBUG("[2] reject track pt = " << tp->pt());
236 continue;
237 }
238
239 add( input, *tp, result );
240 }
241
242 return true;
243 }
#define ATH_MSG_ERROR(x,...)
const_pointer_type ptr()
Dereference the pointer.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ 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 >, and AthCheckedComponent<::AthAlgTool >.

◆ 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.

◆ trackIsolation()

bool xAOD::TrackIsolationTool::trackIsolation ( TrackIsolation & result,
const IParticle & tp,
const std::vector< Iso::IsolationType > & cones,
TrackCorrection corrections,
const Vertex * vertex = 0,
const std::set< const TrackParticle * > * exclusionSet = 0,
const TrackParticleContainer * indetTrackParticles = 0 ) const
overridevirtual

ITrackIsolationTool interface:

prepare input

get track particle

Implements xAOD::ITrackIsolationTool.

Definition at line 114 of file TrackIsolationTool.cxx.

120 {
122 // If not vertex is given, use the ID best one. If one does not want to cut on z0sinT, use the TrackSelectionTool config
123 SG::ReadHandle<VertexContainer> vtxH;
124 if (vertex == nullptr && !m_vertexLocation.key().empty()) {
126 if (!vtxH.isValid()) {
127 ATH_MSG_ERROR("Did not find a vertex container with key " << m_vertexLocation.key());
128 return false;
129 }
131 if (vertex)
132 ATH_MSG_DEBUG("No vertex provided, is required. Use the ID-chosen pvx, z = " << vertex->z());
133 }
134
136 const IParticle* tp = getReferenceParticle(particle);
137 if( !tp ){
138 ATH_MSG_WARNING("Failed to obtain reference particle");
139 return false;
140 }
141 if (tp->pt() <= 0.)
142 ATH_MSG_WARNING("A particle of type " << particle.type() << " with strange pT : " << tp->pt()*1e-3 << " GeV");
143 TrackIsolationInput input( tp, corrbitset, vertex, exclusionSet );
144
145 for( auto isoType : isoTypes ){
147 if( flavour != Iso::ptcone ) {
148 ATH_MSG_WARNING("Unsupported isolation type passed, cannot calculate isolation " << Iso::toCString(isoType));
149 return false;
150 }
151 float conesize = Iso::coneSize(isoType);
152 input.coneSizesSquared.push_back(conesize*conesize);
153 }
154
155 for(size_t i=1; i<input.coneSizesSquared.size(); i++){
156 if(input.coneSizesSquared[i]>input.coneSizesSquared[i-1]) ATH_MSG_ERROR("Isolation Cone should be in decreasing order. "<< i << "th variable is " << Iso::toCString(isoTypes[i]) << " is larger than the one before it: " << Iso::toCString(isoTypes[i-1]));
157 }
158
159 std::sort(input.coneSizesSquared.begin(),input.coneSizesSquared.end(),[](float i, float j) { return i>j; });
160
161 initresult(result, corrbitset, input.coneSizesSquared.size());
162
163 input.maxRadius = sqrt(input.coneSizesSquared[0]);
164
165 bool success = false;
166 // run isolation code
167 if( indetTrackParticles ) success = simpleIsolation(input,result,indetTrackParticles);
168 else if( m_simpleIsolation ) success = simpleIsolation(input,result);
169 else success = binnedIsolation(input,result);
170
171 if( msgLvl(MSG::DEBUG) ){
172 if( !success ){
173 ATH_MSG_DEBUG(" Track isolation calculation failed");
174 }else{
175 msg(MSG::DEBUG) << "Calculated track isolation: ";
176 for( unsigned int i = 0; i< result.ptcones.size();++i ){
177 msg(MSG::DEBUG) << " coneSizeSquared " << std::setw(3) << input.coneSizesSquared[i] << " value " << result.ptcones[i];
178 }
179 msg(MSG::DEBUG) << endmsg;
180 }
181 }
182 return success;
183 }
#define endmsg
bool msgLvl(const MSG::Level lvl) const
virtual double pt() const =0
transverse momentum
bool binnedIsolation(TrackIsolationInput &input, TrackIsolation &result) const
using TracksInConeTool
const Vertex * retrieveIDBestPrimaryVertex(const VertexContainer *vtxC) const
retrieve pvx if not given
bool simpleIsolation(TrackIsolationInput &input, TrackIsolation &result, const TrackParticleContainer *indetTrackParticles=0) const
simple isolation (loop)
const IParticle * getReferenceParticle(const IParticle &particle) const
get reference particle
static void initresult(TrackIsolation &result, TrackCorrection corrlist, unsigned int typesize)
init result struct
Gaudi::Property< bool > m_simpleIsolation
flag to select calculation type
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
@ ptcone
Track isolation.
static const char * toCString(IsolationConeSize conesize)
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
MsgStream & msg
Definition testRead.cxx:32

◆ 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_2PI

float xAOD::TrackIsolationTool::m_2PI = 2*M_PI
staticconstexprprivate

define 2*Pi

Definition at line 89 of file TrackIsolationTool.h.

◆ m_coreTrackEtaRange

Gaudi::Property<float> xAOD::TrackIsolationTool::m_coreTrackEtaRange
private
Initial value:
{this,
"CoreTrackEtaRange", 0.0, "The maximum eta range to consider something a core track"}

overlap cone size squared

The maximum eta range to consider something a core track

Definition at line 131 of file TrackIsolationTool.h.

131 {this,
132 "CoreTrackEtaRange", 0.0, "The maximum eta range to consider something a core track"};

◆ 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_DoTimingSel

Gaudi::Property<bool> xAOD::TrackIsolationTool::m_DoTimingSel {this, "DoForwardIsoTiming",false,"Apply the timing selection on the track Isolation"}
private

Definition at line 156 of file TrackIsolationTool.h.

156{this, "DoForwardIsoTiming",false,"Apply the timing selection on the track Isolation"};

◆ 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_indetTrackParticleLocation

SG::ReadHandleKey<TrackParticleContainer> xAOD::TrackIsolationTool::m_indetTrackParticleLocation
private
Initial value:
{this,
"TrackParticleLocation", "InDetTrackParticles"}

track particle location

Definition at line 118 of file TrackIsolationTool.h.

118 {this,
119 "TrackParticleLocation", "InDetTrackParticles"};

◆ m_maxTime

Gaudi::Property<float> xAOD::TrackIsolationTool::m_maxTime {this, "IsoTimeRemoval", 2.5}
private

Definition at line 126 of file TrackIsolationTool.h.

126{this, "IsoTimeRemoval", 2.5};

◆ m_overlapCone

Gaudi::Property<float> xAOD::TrackIsolationTool::m_overlapCone {this, "OverlapCone", 0.1}
private

Definition at line 124 of file TrackIsolationTool.h.

124{this, "OverlapCone", 0.1};

◆ m_overlapCone2

float xAOD::TrackIsolationTool::m_overlapCone2 = 0.0F
private

Definition at line 128 of file TrackIsolationTool.h.

◆ m_simpleIsolation

Gaudi::Property<bool> xAOD::TrackIsolationTool::m_simpleIsolation {this, "SimpleIsolation", false}
private

flag to select calculation type

Definition at line 122 of file TrackIsolationTool.h.

122{this, "SimpleIsolation", false};

◆ m_tracksInConeTool

ToolHandle<ITrackParticlesInConeTool> xAOD::TrackIsolationTool::m_tracksInConeTool
private
Initial value:
{this,
"TracksInConeTool", "xAOD::TrackParticlesInConeTool/TrackParticlesInConeTool"}

tracks in cone tool

Definition at line 137 of file TrackIsolationTool.h.

137 {this,
138 "TracksInConeTool", "xAOD::TrackParticlesInConeTool/TrackParticlesInConeTool"};

◆ m_trkselTool

ToolHandle<InDet::IInDetTrackSelectionTool> xAOD::TrackIsolationTool::m_trkselTool
private
Initial value:
{this,
"TrackSelectionTool", "InDet::InDetTrackSelectionTool/TrackSelectionTool"}

selection of tracks

Definition at line 141 of file TrackIsolationTool.h.

141 {this,
142 "TrackSelectionTool", "InDet::InDetTrackSelectionTool/TrackSelectionTool"};

◆ m_ttvaTool

ToolHandle<CP::ITrackVertexAssociationTool> xAOD::TrackIsolationTool::m_ttvaTool
private
Initial value:
{this,
"TTVATool", "", "Optional track to vertex association tool to filter tracks"}

Select tracks associated to the vertex.

Definition at line 145 of file TrackIsolationTool.h.

145 {this,
146 "TTVATool", "", "Optional track to vertex association tool to filter tracks"};

◆ m_useLooseTrackCore

bool xAOD::TrackIsolationTool::m_useLooseTrackCore {false}
private

Whether the loose core track eta range is used.

Definition at line 134 of file TrackIsolationTool.h.

134{false};

◆ m_useTTVATool

bool xAOD::TrackIsolationTool::m_useTTVATool {false}
private

Use the ttva tool. Set to true if one was provided.

Definition at line 148 of file TrackIsolationTool.h.

148{false};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexLocation

SG::ReadHandleKey<VertexContainer> xAOD::TrackIsolationTool::m_vertexLocation
private
Initial value:
{this,
"VertexLocation", "PrimaryVertices"}

Definition at line 150 of file TrackIsolationTool.h.

150 {this,
151 "VertexLocation", "PrimaryVertices"};

◆ 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: