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

typedef std::vector< const TrackParticle* > xAOD::TrackIsolationTool::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 27 of file TrackIsolationTool.cxx.

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

◆ ~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 235 of file TrackIsolationTool.cxx.

236 {
237 // check if track pointer matches the one of input or one of the exclusion set
238 // Jon Burr: I'm not completely convinced by the use of CoreTrackEtaRange.
239 // With this setup, if you're running in simple isolation mode any track
240 // within the same eta slice (even on the other side of the detector) will
241 // be included in the eta code. If you manually provide a track particle
242 // container then the tool automatically runs in this simple mode...
243 // This is fine in IsolationBuilder (the main client) but could produce
244 // unexpected results with other users
245 if(input.corrections.trackbitset.test(static_cast<unsigned int>(Iso::coreTrackPtr))){
246 if(input.particle == &tp2 ||
247 (input.exclusionSet && input.exclusionSet->count(&tp2)) ||
248 (m_useLooseTrackCore && std::abs(input.particle->eta() - tp2.eta()) < m_coreTrackEtaRange)){
249 ATH_MSG_DEBUG("track pointer " << &tp2 << ", track pt = " << tp2.pt() << ", input pt = " << input.particle->pt()) ;
250 result.coreCorrections[Iso::coreTrackPtr] += tp2.pt();
251 return;
252 }
253 }
254
255 // check eta
256 float deta = input.particle->eta()-tp2.eta();
257 if( fabs(deta) > input.maxRadius ) return;
258
259 // check phi
260 float dphi = phiInRange(input.particle->phi()-tp2.phi());
261 if( fabs(dphi) > input.maxRadius ) return;
262
263 // check dr2
264 float dr2 = deta*deta + dphi*dphi;
265
266 // check cone if using cone based overlap removal
267 if(input.corrections.trackbitset.test(static_cast<unsigned int>(Iso::coreTrackCone))
268 && dr2 < m_overlapCone2 ) {
269 result.coreCorrections[Iso::coreTrackCone] += tp2.pt();
270 return;
271 }
272
274 for( unsigned int k=0;k<input.coneSizesSquared.size();++k ){
275 if( dr2 >= input.coneSizesSquared[k] ) return;
276 result.ptcones[k] += tp2.pt();
277 if( dr2 <= input.ptvarconeRadiusSquared ){
278 result.ptvarcones_10GeVDivPt[k] += tp2.pt();
279 }
280 }
281 }
#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.
float phiInRange(float phi) const
hepler function to ensure phi is within +-Pi

◆ binnedIsolation()

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

using TracksInConeTool

prepare look-up structure

Definition at line 176 of file TrackIsolationTool.cxx.

177 {
179 std::vector<const TrackParticle*> tps;
180#ifndef XAOD_ANALYSIS
181 if( !m_tracksInConeTool->particlesInCone(input.particle->eta(),input.particle->phi(),input.maxRadius,tps) ) return false;
182#else
183 if( !getparticlesInCone(input.particle->eta(),input.particle->phi(),input.maxRadius,tps) ) return false;
184#endif
185
186 for( const auto& tp : tps ) {
187 if( (!m_trkselTool->accept( *tp , input.vertex)) ||
188 (m_useTTVATool && (!input.vertex || !m_ttvaTool->isCompatible(*tp, *input.vertex)))){
189 if (m_useTTVATool && !input.vertex){
190 ATH_MSG_DEBUG("Encountered a track isolation input with invalid vertex while requiring TTVA. Rejecting, please check your inputs!");
191 }
192 ATH_MSG_DEBUG("reject track pt = " << tp->pt());
193 continue;
194 } else{
195 ATH_MSG_DEBUG("Accept track " << tp << " pt = " << tp->pt() << " z+vz = " << tp->z0()+tp->vz() << " eta = " << tp->eta() << " phi = " << tp->phi());
196 }
197 add( input,*tp, result );
198
199 }
200 return true;
201 }
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::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::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 88 of file TrackIsolationTool.cxx.

88 {
90 const Muon* muon = static_cast<const Muon*>(&particle);
91 const xAOD::TrackParticle* tp = muon->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
92 if( !tp ) tp = muon->primaryTrackParticle();
93 if( !tp ) {
96 ATH_MSG_WARNING(" No TrackParticle found for muon with pT: " <<muon->pt() * 1.e-3 <<"[GeV], eta: "<<muon->eta()<<" phi: "<<
97 muon->phi()<<" q: "<<muon->charge()<<" primaryAuthor: "<<muon->author()<< " allAuthors: "<<muon->allAuthors());
98 } else return tp;
99 }
100 return &particle;
101 }
#define ATH_MSG_WARNING(x)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ Muon
The object is a muon.
Definition ObjectType.h:48
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Muon_v1 Muon
Reference the current persistent version:

◆ initialize()

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

initialize

square cone

Reimplemented from asg::AsgTool.

Definition at line 40 of file TrackIsolationTool.cxx.

41 {
42#ifndef XAOD_ANALYSIS
43 ATH_CHECK(m_tracksInConeTool.retrieve( DisableTool{m_simpleIsolation} ));
44#endif // XAOD_ANALYSIS
45
46 if(m_trkselTool.retrieve().isFailure()){
47 ATH_MSG_FATAL("Could not retrieve InDetTrackSelectionTool");
48 return StatusCode::FAILURE;
49 }
50 if (!m_ttvaTool.empty()) {
51 ATH_MSG_DEBUG("Use TTVA tool " << m_ttvaTool);
52 m_useTTVATool = true;
53 ATH_CHECK( m_ttvaTool.retrieve() );
54 }
55 else
56 ATH_MSG_DEBUG("Will not use TTVA tool");
57
60
61 // the read handles
63 if (!m_vertexLocation.key().empty())
64 ATH_CHECK(m_vertexLocation.initialize());
65
66 if (m_coreTrackEtaRange.value() > 0)
68
69 return StatusCode::SUCCESS;
70 }
#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 283 of file TrackIsolationTool.cxx.

285 {
286
287 result.corrlist = corrlist;
288 result.coreCorrections.clear();
289 result.ptcones.resize(typesize,0.);
290 result.ptvarcones_10GeVDivPt.resize(typesize,0.);
291
292 std::vector<float> vec;
293 vec.resize(typesize,0.);
294
295 for(unsigned int i=0;i<static_cast<unsigned int>(Iso::numIsolationTrackCorrections);i++){
296 result.coreCorrections[static_cast<Iso::IsolationTrackCorrection>(i)] = 0.;
297 }
298 }
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()

◆ 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 72 of file TrackIsolationTool.cxx.

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

204 {
205
206 SG::ReadHandle<TrackParticleContainer> tpH;
208 if( !indetTrackParticles ) {
210 if (!tpH.isValid()) {
211 ATH_MSG_ERROR("Could not open a TrackParticle container with key "
213 return false;
214 }
215 indetTrackParticles = tpH.ptr();
216 }
217
218 // exit if not track particles found
219 if( !indetTrackParticles ) return false;
220
221 // loop over all track particles
222 for( const auto *const tp : *indetTrackParticles ) {
223 if( (!m_trkselTool->accept(*tp, input.vertex)) ||
224 (m_useTTVATool && !m_ttvaTool->isCompatible(*tp, *input.vertex))){
225 ATH_MSG_DEBUG("[2] reject track pt = " << tp->pt());
226 continue;
227 }
228
229 add( input, *tp, result );
230 }
231
232 return true;
233 }
#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 >, 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.

◆ 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 104 of file TrackIsolationTool.cxx.

110 {
112 // If not vertex is given, use the ID best one. If one does not want to cut on z0sinT, use the TrackSelectionTool config
113 SG::ReadHandle<VertexContainer> vtxH;
114 if (vertex == nullptr && !m_vertexLocation.key().empty()) {
116 if (!vtxH.isValid()) {
117 ATH_MSG_ERROR("Did not find a vertex container with key " << m_vertexLocation.key());
118 return false;
119 }
121 if (vertex)
122 ATH_MSG_DEBUG("No vertex provided, is required. Use the ID-chosen pvx, z = " << vertex->z());
123 }
124
126 const IParticle* tp = getReferenceParticle(particle);
127 if( !tp ){
128 ATH_MSG_WARNING("Failed to obtain reference particle");
129 return false;
130 }
131 if (tp->pt() <= 0.)
132 ATH_MSG_WARNING("A particle of type " << particle.type() << " with strange pT : " << tp->pt()*1e-3 << " GeV");
133 TrackIsolationInput input( tp, corrbitset, vertex, exclusionSet );
134
135 for( auto isoType : isoTypes ){
137 if( flavour != Iso::ptcone ) {
138 ATH_MSG_WARNING("Unsupported isolation type passed, cannot calculate isolation " << Iso::toCString(isoType));
139 return false;
140 }
141 float conesize = Iso::coneSize(isoType);
142 input.coneSizesSquared.push_back(conesize*conesize);
143 }
144
145 for(size_t i=1; i<input.coneSizesSquared.size(); i++){
146 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]));
147 }
148
149 std::sort(input.coneSizesSquared.begin(),input.coneSizesSquared.end(),[](float i, float j) { return i>j; });
150
151 initresult(result, corrbitset, input.coneSizesSquared.size());
152
153 input.maxRadius = sqrt(input.coneSizesSquared[0]);
154
155 bool success = false;
156 // run isolation code
157 if( indetTrackParticles ) success = simpleIsolation(input,result,indetTrackParticles);
158 else if( m_simpleIsolation ) success = simpleIsolation(input,result);
159 else success = binnedIsolation(input,result);
160
161 if( msgLvl(MSG::DEBUG) ){
162 if( !success ){
163 ATH_MSG_DEBUG(" Track isolation calculation failed");
164 }else{
165 msg(MSG::DEBUG) << "Calculated track isolation: ";
166 for( unsigned int i = 0; i< result.ptcones.size();++i ){
167 msg(MSG::DEBUG) << " coneSizeSquared " << std::setw(3) << input.coneSizesSquared[i] << " value " << result.ptcones[i];
168 }
169 msg(MSG::DEBUG) << endmsg;
170 }
171 }
172 return success;
173 }
#define endmsg
bool msgLvl(const MSG::Level lvl) const
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.
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 129 of file TrackIsolationTool.h.

129 {this,
130 "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_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_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 126 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 135 of file TrackIsolationTool.h.

135 {this,
136 "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 139 of file TrackIsolationTool.h.

139 {this,
140 "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 143 of file TrackIsolationTool.h.

143 {this,
144 "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 132 of file TrackIsolationTool.h.

132{false};

◆ m_useTTVATool

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

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

Definition at line 146 of file TrackIsolationTool.h.

146{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 148 of file TrackIsolationTool.h.

148 {this,
149 "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: