ATLAS Offline Software
Loading...
Searching...
No Matches
InDetVertexTruthMatchTool Class Reference

Class for vertex truth matching. More...

#include <InDetVertexTruthMatchTool.h>

Inheritance diagram for InDetVertexTruthMatchTool:
Collaboration diagram for InDetVertexTruthMatchTool:

Public Member Functions

 InDetVertexTruthMatchTool (const std::string &name)
virtual StatusCode initialize () override final
 Dummy implementation of the initialisation function.
virtual StatusCode finalize () override
virtual StatusCode matchVertices (const xAOD::VertexContainer &vxContainer) const override
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

bool pass (const xAOD::TruthParticle &truthPart) const
bool pass (const xAOD::TrackParticle &trackPart) 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 const xAOD::TrackParticleContainerfindTrackParticleContainer (const xAOD::VertexContainer &vxContainer)

Private Attributes

float m_trkMatchProb
float m_vxMatchWeight
float m_trkPtCut
std::atomic< unsigned int > m_nVtx {}
std::atomic< unsigned int > m_nVtxWithBadLinks {}
std::atomic< unsigned int > m_nBadLinks {}
std::atomic< unsigned int > m_nLinks {}
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

Class for vertex truth matching.

Match reconstructed vertices to truth level interactions vertices through the chain: track -> particle -> genEvent -> genVertex Categorize reconstructed vertices depending on their composition.

Definition at line 23 of file InDetVertexTruthMatchTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ InDetVertexTruthMatchTool()

InDetVertexTruthMatchTool::InDetVertexTruthMatchTool ( const std::string & name)

Definition at line 13 of file InDetVertexTruthMatchTool.cxx.

13 : asg::AsgTool(name) {
14 declareProperty("trackMatchProb", m_trkMatchProb = 0.5 );
15 declareProperty("vertexMatchWeight", m_vxMatchWeight = 0.7 );
16 declareProperty("trackPtCut", m_trkPtCut = 500. );
17}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

Member Function Documentation

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

◆ 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

◆ finalize()

StatusCode InDetVertexTruthMatchTool::finalize ( )
overridevirtual

Definition at line 25 of file InDetVertexTruthMatchTool.cxx.

26{
27 if (m_nBadLinks>0) {
28 ATH_MSG_INFO("Vertex fraction with invalid track particle links: " << std::setw(8) << static_cast<double>(m_nVtxWithBadLinks) / m_nVtx << "; invalid track particle link fraction " << static_cast<double>(m_nBadLinks) / m_nLinks << ".");
29 }
30 return StatusCode::SUCCESS;
31}
#define ATH_MSG_INFO(x)
std::atomic< unsigned int > m_nVtxWithBadLinks
std::atomic< unsigned int > m_nVtx
std::atomic< unsigned int > m_nBadLinks
std::atomic< unsigned int > m_nLinks

◆ findTrackParticleContainer()

const xAOD::TrackParticleContainer * InDetVertexTruthMatchTool::findTrackParticleContainer ( const xAOD::VertexContainer & vxContainer)
staticprivate

Definition at line 121 of file InDetVertexTruthMatchTool.cxx.

122{
123 for (auto vtx : vxContainer)
124 {
125 for (const ElementLink<xAOD::TrackParticleContainer>& tpLink : vtx->trackParticleLinks())
126 {
127 if (tpLink.isValid())
128 {
129 return tpLink.getStorableObjectPointer();
130 }
131 }
132 }
133 return nullptr;
134}

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

◆ initialize()

StatusCode InDetVertexTruthMatchTool::initialize ( void )
finaloverridevirtual

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 19 of file InDetVertexTruthMatchTool.cxx.

19 {
20 ATH_MSG_INFO("Initializing");
21
22 return StatusCode::SUCCESS;
23}

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

◆ matchVertices()

StatusCode InDetVertexTruthMatchTool::matchVertices ( const xAOD::VertexContainer & vxContainer) const
overridevirtual

Implements IInDetVertexTruthMatchTool.

Definition at line 136 of file InDetVertexTruthMatchTool.cxx.

136 {
137
138 ATH_MSG_DEBUG("Start vertex matching");
139 if (vxContainer.empty() || // reject empty vertex containers
140 (vxContainer.size() == 1 && vxContainer.at(0)->vertexType() == xAOD::VxType::NoVtx)){ // as well as containers containing only a dummy vertex
141 ATH_MSG_DEBUG("No vertices to match.");
142 return StatusCode::SUCCESS;
143 }
144 // Identify MC vertices to match to -- this is the collection for hard scatter
145 const xAOD::TruthEventBaseContainer * truthEvents = nullptr;
146 if ( evtStore()->contains<xAOD::TruthEventBaseContainer>( "TruthEvents" ) )
147 ATH_CHECK( evtStore()->retrieve( truthEvents, "TruthEvents" ) );
148 else
149 ATH_CHECK( evtStore()->retrieve( truthEvents, "TruthEvent" ) );
150
151 std::vector<const xAOD::TruthEventBaseContainer *> truthContainers;
152 truthContainers.push_back( truthEvents );
153
154 ATH_MSG_DEBUG("Found Hard Scatter collection");
155
156 // These are the pile-up truth -- don't want to fail if they don't exist
157 const xAOD::TruthEventBaseContainer * truthPileup = nullptr;
158 if ( evtStore()->contains<xAOD::TruthEventBaseContainer>( "TruthPileupEvents" ) )
159 ATH_CHECK( evtStore()->retrieve( truthPileup, "TruthPileupEvents" ) );
160 if (truthPileup)
161 truthContainers.push_back( truthPileup );
162
163 ATH_MSG_DEBUG("Found Pileup collection");
164
165 // Find the trackParticle container associated with our reconstructed vertices
166 // We could pass this, but it would break the original interface...
167 const xAOD::TrackParticleContainer* tkContainer = findTrackParticleContainer(vxContainer);
168 if (!tkContainer)
169 {
170 ATH_MSG_WARNING("Vertex container has no vertices with valid TrackParticle links");
171 return StatusCode::SUCCESS;
172 }
173
174 ATH_MSG_DEBUG("Found track collection");
175
176 // create the particle links to events to avoid excessive looping
177 // also decorate reconstructed tracks passing selection with truthEvent links
178 createTrackTruthMap( truthContainers, *tkContainer, m_trkMatchProb );
179
180 // Accessor for the links we just created
182
183 //setup decorators for truth matching info
184 static const xAOD::Vertex::Decorator<std::vector<VertexTruthMatchInfo> > matchInfoDecor("TruthEventMatchingInfos");
185 static const xAOD::Vertex::Decorator<std::vector<VertexTruthMatchInfo> > rawMatchInfoDecor("TruthEventRawMatchingInfos");
186 static const xAOD::Vertex::Decorator<VertexMatchType> matchTypeDecor("VertexMatchType");
187 static const xAOD::Vertex::Decorator<std::vector<ElementLink<xAOD::VertexContainer> > > splitPartnerDecor("SplitPartners");
188 static const xAOD::Vertex::Decorator<int> nHSTrkDecor("nHSTrk");
189
190 //setup accessors
191 // can switch to built in method in xAOD::Vertex once don't have to deal with changing names anymore
193 xAOD::Vertex::ConstAccessor<std::vector<float> > weightAcc("trackWeights");
194
196 xAOD::TrackParticle::ConstAccessor<float> trk_truthProbAcc("truthMatchProbability");
197
198 static const xAOD::TrackParticle::Decorator<ElementLink<xAOD::VertexContainer> > trk_recoVtx("RecoVertex");
199 static const xAOD::TrackParticle::Decorator<float> trk_wtVtx("WeightVertex");
200
201 //some variables to store
202 size_t ntracks;
204
205 ATH_MSG_DEBUG("Starting Loop on Vertices");
206
207 //=============================================================================
208 //First loop over vertices: get tracks, then TruthParticles, and store relative
209 //weights of contribution from each TruthEvent
210 //=============================================================================
211 size_t vxEntry = 0;
212 unsigned int n_bad_links = 0;
213 unsigned int n_links = 0;
214 unsigned int n_vx_with_bad_links = 0;
215
216 for ( auto vxit : vxContainer.stdcont() ) {
217 vxEntry++;
218 vxType = static_cast<xAOD::VxType::VertexType>( vxit->vertexType() );
219 if (vxType == xAOD::VxType::NoVtx) {
220 //skip dummy vertices -> match info will be empty vector if someone tries to access later
221 //type will be set to dummy
222 ATH_MSG_DEBUG("FOUND xAOD::VxType::NoVtx");
223 continue;
224 }
225
226
227 //create the vector we will add as matching info decoration later
228 std::vector<VertexTruthMatchInfo> matchinfo;
229 std::vector<VertexTruthMatchInfo> rawMatchinfo; //not normalized to one for each reco vertex
230
231 //if don't have track particles
232 if (!trkAcc.isAvailable(*vxit) || !weightAcc.isAvailable(*vxit) ) {
233 ATH_MSG_DEBUG("trackParticles or trackWeights not available, setting fake");
234 // Add invalid link for fakes
235 matchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), 1., 0. );
236 matchInfoDecor( *vxit ) = matchinfo;
237 rawMatchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), 1., 0. );
238 rawMatchInfoDecor( *vxit ) = rawMatchinfo;
239 nHSTrkDecor( *vxit ) = 0;
240 continue;
241 }
242
243 //things we need to do the matching
244 const xAOD::Vertex::TrackParticleLinks_t & trkParts = trkAcc( *vxit );
245 ntracks = trkParts.size();
246 const std::vector<float> & trkWeights = weightAcc( *vxit );
247
248 //double check
249 if ( trkWeights.size() != ntracks ) {
250 ATH_MSG_DEBUG("Vertex without same number of tracks and trackWeights, setting fake");
251 matchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), 1., 0. );
252 matchInfoDecor( *vxit ) = matchinfo;
253 rawMatchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), 1., 0. );
254 rawMatchInfoDecor( *vxit ) = rawMatchinfo;
255 nHSTrkDecor( *vxit ) = 0;
256 continue;
257 }
258
259 ATH_MSG_DEBUG("Matching new vertex at (" << vxit->x() << ", " << vxit->y() << ", " << vxit->z() << ")" << " with " << ntracks << " tracks, at index: " << vxit->index());
260
261 float totalWeight = 0.;
262 float totalFake = 0.;
263 int nHSTrk = 0;
264
265 unsigned vx_n_bad_links = 0;
266 //loop element link to track particle
267 for ( size_t t = 0; t < ntracks; ++t ) {
268 if (!trkParts[t].isValid()) {
269 ++vx_n_bad_links;
270 continue;
271 }
272 const xAOD::TrackParticle & trk = **trkParts[t];
273
274 totalWeight += trkWeights[t];
275 trk_recoVtx(trk) = ElementLink<xAOD::VertexContainer>(vxContainer, vxEntry - 1);
276 trk_wtVtx(trk) = trkWeights[t];
277
278 const ElementLink<xAOD::TruthParticleContainer> & truthPartLink = trk_truthPartAcc( trk );
279 float prob = trk_truthProbAcc( trk );
280
281 if (!truthPartLink.isValid()) continue;
282
283 if (prob > m_trkMatchProb) {
284 const xAOD::TruthParticle & truthPart = **truthPartLink;
285 //check if the truth particle is "good"
286 if ( pass( truthPart) ) {
287 ElementLink<xAOD::TruthEventBaseContainer> match = backLinkDecor( truthPart );
288 //check we have an actual link
289 if ( match.isValid() ) {
290 size_t matchIdx = indexOfMatchInfo( matchinfo, match );
291 std::get<1>(matchinfo[matchIdx]) += trkWeights[t];
292 std::get<2>(matchinfo[matchIdx]) += (trk.pt()/1000.) * (trk.pt()/1000.) * trkWeights[t];
293 matchIdx = indexOfMatchInfo( rawMatchinfo, match );
294 std::get<1>(rawMatchinfo[matchIdx]) += trkWeights[t];
295 std::get<2>(rawMatchinfo[matchIdx]) += (trk.pt()/1000.) * (trk.pt()/1000.) * trkWeights[t];
296 if((*match)->type() == xAOD::Type::TruthEvent && match.index() == 0) nHSTrk++;
297 } else {
298 totalFake += trkWeights[t];
299 }
300
301 } else {
302 //truth particle failed cuts -> add to fakes
303 totalFake += trkWeights[t];
304 }
305 } else {
306 //not valid or low matching probability -> add to fakes
307 totalFake += trkWeights[t];
308 }
309 }//end loop over tracks in vertex
310 n_links += ntracks;
311 n_bad_links += vx_n_bad_links;
312 if (vx_n_bad_links>0) {
313 ++n_vx_with_bad_links;
314 }
315
316 //finalize the match info vector
317 if ( totalWeight < 1e-12 ) { // in case we don't have any passing tracks we want to make sure labeled fake
318 ATH_MSG_DEBUG(" Declaring vertex fully fake (no passing tracks included)");
319 totalWeight = 1.;
320 totalFake = 1.;
321 }
322 if ( totalFake > 0. )
323 {
324 matchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), totalFake, 0. );
325 rawMatchinfo.emplace_back( ElementLink<xAOD::TruthEventBaseContainer>(), totalFake, 0. );
326 }
327
328 for ( auto & mit : matchinfo ) {
329 std::get<1>(mit) /= totalWeight;
330 }
331 std::sort( matchinfo.begin(), matchinfo.end(), compareMatchPair );
332 std::sort( rawMatchinfo.begin(), rawMatchinfo.end(), compareMatchPair );
333 matchInfoDecor( *vxit ) = matchinfo;
334 rawMatchInfoDecor( *vxit ) = rawMatchinfo;
335 nHSTrkDecor( *vxit ) = nHSTrk;
336 }
337 m_nVtx += vxContainer.stdcont().size();
338 m_nVtxWithBadLinks += n_vx_with_bad_links;
339 m_nBadLinks += n_bad_links;
340 m_nLinks += n_links;
341
342 //After first loop, all vertices have been decorated with their vector of match info (link to TruthEvent paired with weight)
343 //now we want to use that information from the whole collection to assign types
344
345 //keep track of whether a type is assigned
346 //useful since looking for splits involves a double loop, and then setting types ahead in the collection
347 std::vector<bool> assignedType( vxContainer.size(), false );
348
349 for ( size_t i = 0; i < vxContainer.size(); ++i ) {
350
351 if ( assignedType[i] ) continue; // make sure we don't reclassify vertices already found in the split loop below
352
353 std::vector<VertexTruthMatchInfo> & info = matchInfoDecor( *vxContainer[i] );
354 if (info.empty()) {
355 matchTypeDecor( *vxContainer[i] ) = DUMMY;
356 } else if ( !std::get<0>(info[0]).isValid() ) {
357 matchTypeDecor( *vxContainer[i] ) = FAKE;
358 } else if ( std::get<1>(info[0]) > m_vxMatchWeight ) {
359 matchTypeDecor( *vxContainer[i] ) = MATCHED;
360 } else {
361 matchTypeDecor( *vxContainer[i] ) = MERGED;
362 }
363
364 //check for splitting
365 if ( matchTypeDecor( *vxContainer[i] ) == MATCHED || matchTypeDecor( *vxContainer[i] ) == MERGED ) {
366 std::vector<size_t> foundSplits;
367 for ( size_t j = i + 1; j < vxContainer.size(); ++j ) {
368 std::vector<VertexTruthMatchInfo> & info2 = matchInfoDecor( *vxContainer[j] );
369 //check second vertex is not dummy or fake, and that it has same elementlink as first vertex
370 //equality test is in code but doesnt seem to work for ElementLinks that I have?
371 //so i am just checking that the contianer key hash and the index are the same
372 if (matchTypeDecor( *vxContainer[j] ) == FAKE || matchTypeDecor( *vxContainer[j] ) == DUMMY) continue;
373 if (!info2.empty() && std::get<0>(info2[0]).isValid() && std::get<0>(info[0]).key() == std::get<0>(info2[0]).key() && std::get<0>(info[0]).index() == std::get<0>(info2[0]).index() ) {
374 //add split links; first between first one found and newest one
375 splitPartnerDecor( *vxContainer[i] ).emplace_back( vxContainer, j );
376 splitPartnerDecor( *vxContainer[j] ).emplace_back( vxContainer, i );
377 //then between any others we found along the way
378 for ( auto k : foundSplits ) { //k is a size_t in the vector of splits
379 splitPartnerDecor( *vxContainer[k] ).emplace_back( vxContainer, j );
380 splitPartnerDecor( *vxContainer[j] ).emplace_back( vxContainer, k );
381 }
382 //then keep track that we found this one
383 foundSplits.push_back(j);
384 } //if the two vertices match to same TruthEvent
385 }//inner loop over vertices
386
387 // Correct labelling of split vertices - keep highest sumpt2 vertex labelled as matched/merged
388 float maxSumpT2 = std::get<2>( matchInfoDecor( *vxContainer[i] )[0] );
389 size_t indexOfMax = i;
390 for ( auto l : foundSplits ) {
391 if ( std::get<2>( matchInfoDecor( *vxContainer[l] )[0] ) > maxSumpT2 ){
392 maxSumpT2 = std::get<2>( matchInfoDecor( *vxContainer[l] )[0] );
393 indexOfMax = l;
394 } else {
395 matchTypeDecor( *vxContainer[l] ) = SPLIT;
396 assignedType[l] = true;
397 }
398 }
399 if ( indexOfMax!=i ) matchTypeDecor( *vxContainer[i] ) = SPLIT;
400 } //if matched or merged
401 } //outer loop
402
403 //DEBUG MATCHING
404 if (msgLvl(MSG::DEBUG)) {
405 for (const auto &vxit : vxContainer.stdcont() ) {
406 ATH_MSG_DEBUG("Matched vertex (index " << (*vxit).index() << ") to type " << matchTypeDecor(*vxit) << " with following info of size " << matchInfoDecor(*vxit).size() << ":");
407 for (const auto &vit : matchInfoDecor(*vxit) ) {
408 if ( std::get<0>(vit).isValid() ) {
409 ATH_MSG_DEBUG(" GenEvent type " << (* std::get<0>(vit))->type() << ", index " << std::get<0>(vit).index() << " with relative weight " << std::get<1>(vit) );
410 } else {
411 ATH_MSG_DEBUG(" Fakes with relative weight " << std::get<1>(vit) );
412 }
413 }
414 if (matchTypeDecor(*vxit) == SPLIT) {
415 ATH_MSG_DEBUG(" Split partners are:");
416 for (const auto &split : splitPartnerDecor( *vxit ) ) {
417 if ( split.isValid() )
418 ATH_MSG_DEBUG(" Vertex " << split.index());
419 else
420 ATH_MSG_DEBUG(" ERROR");
421 }
422 }
423 }
424 }
425
426 return StatusCode::SUCCESS;
427
428}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
bool msgLvl(const MSG::Level lvl) const
const T * at(size_type n) const
Access an element, as an rvalue.
const PtrVector & stdcont() const
Return the underlying std::vector of the container.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
bool pass(const xAOD::TruthParticle &truthPart) const
static const xAOD::TrackParticleContainer * findTrackParticleContainer(const xAOD::VertexContainer &vxContainer)
SG::Decorator< T, ALLOC > Decorator
class to provide type-safe access to aux data.
Definition AuxElement.h:135
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide type-safe access to aux data.
Definition AuxElement.h:131
virtual double pt() const override final
The transverse momentum ( ) of the particle.
std::vector< ElementLink< xAOD::TrackParticleContainer > > TrackParticleLinks_t
Type for the associated track particles.
Definition Vertex_v1.h:128
VxType::VertexType vertexType() const
The type of the vertex.
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:357
str index
Definition DeMoScan.py:362
l
Printing final latex table to .tex output file.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ TruthEvent
The object is a truth event.
Definition ObjectType.h:69
VertexType
Vertex types.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthEventBaseContainer_v1 TruthEventBaseContainer
Declare the latest version of the truth event container.
TruthParticle_v1 TruthParticle
Typedef to implementation.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".

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

◆ pass() [1/2]

bool InDetVertexTruthMatchTool::pass ( const xAOD::TrackParticle & trackPart) const
private

◆ pass() [2/2]

bool InDetVertexTruthMatchTool::pass ( const xAOD::TruthParticle & truthPart) const
private

Definition at line 435 of file InDetVertexTruthMatchTool.cxx.

435 {
436
437 //remove the registered secondaries
438 return truthPart.pt() >= m_trkPtCut;
439
440}
virtual double pt() const override final
The transverse momentum ( ) of the particle.

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

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

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

std::atomic<unsigned int> InDetVertexTruthMatchTool::m_nBadLinks {}
mutableprivate

Definition at line 51 of file InDetVertexTruthMatchTool.h.

51{};

◆ m_nLinks

std::atomic<unsigned int> InDetVertexTruthMatchTool::m_nLinks {}
mutableprivate

Definition at line 52 of file InDetVertexTruthMatchTool.h.

52{};

◆ m_nVtx

std::atomic<unsigned int> InDetVertexTruthMatchTool::m_nVtx {}
mutableprivate

Definition at line 49 of file InDetVertexTruthMatchTool.h.

49{};

◆ m_nVtxWithBadLinks

std::atomic<unsigned int> InDetVertexTruthMatchTool::m_nVtxWithBadLinks {}
mutableprivate

Definition at line 50 of file InDetVertexTruthMatchTool.h.

50{};

◆ m_trkMatchProb

float InDetVertexTruthMatchTool::m_trkMatchProb
private

Definition at line 43 of file InDetVertexTruthMatchTool.h.

◆ m_trkPtCut

float InDetVertexTruthMatchTool::m_trkPtCut
private

Definition at line 47 of file InDetVertexTruthMatchTool.h.

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

◆ m_vxMatchWeight

float InDetVertexTruthMatchTool::m_vxMatchWeight
private

Definition at line 45 of file InDetVertexTruthMatchTool.h.


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