ATLAS Offline Software
Loading...
Searching...
No Matches
TrackAnalysisPlotsMgr.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
10
17
19#include "GaudiKernel/ISvcLocator.h"
20#include "GaudiKernel/Service.h"
21
22
27 const std::string& dirName,
28 const std::string& anaTag,
29 const std::string& chain,
30 PlotMgr* pParent ) :
31 PlotMgr( dirName, anaTag, pParent ),
33 m_directory( dirName ) { }
34
35
40{
41 ATH_MSG_DEBUG( "Initialising in directory: " << m_directory );
42
44 m_trkAnaDefSvc = Gaudi::svcLocator()->service( "TrkAnaDefSvc"+m_anaTag );
45 ATH_CHECK( m_trkAnaDefSvc.isValid() );
46
48 if( m_trkAnaDefSvc->plotTrackMultiplicities() ) {
49 m_plots_summary = std::make_unique< SummaryPlots >(
50 this, "Tracks/Multiplicities", m_anaTag,
51 m_trkAnaDefSvc->doTrigNavigation() );
52 }
53
55 if( m_trkAnaDefSvc->plotTrackParameters() ) {
56 m_plots_trkParam_vsTest = std::make_unique< TrackParametersPlots >(
57 this, "Tracks/Parameters", m_anaTag, m_trkAnaDefSvc->testTag(),
58 ( not m_trkAnaDefSvc->isTestTruth() ) and m_trkAnaDefSvc->plotTrackParametersErrors(),
59 m_trkAnaDefSvc->plotTracksInJets() );
60 m_plots_trkParam_vsRef = std::make_unique< TrackParametersPlots >(
61 this, "Tracks/Parameters", m_anaTag, m_trkAnaDefSvc->referenceTag(),
62 ( not m_trkAnaDefSvc->isReferenceTruth() ) and m_trkAnaDefSvc->plotTrackParametersErrors(),
63 m_trkAnaDefSvc->plotTracksInJets() );
64 }
65
67 if( m_trkAnaDefSvc->plotTrackMultiplicities() ) {
68 m_plots_nTracks_vsTest = std::make_unique< NtracksPlots >(
69 this, "Tracks/Multiplicities", m_anaTag, m_trkAnaDefSvc->testTag(),
70 m_trkAnaDefSvc->doTrigNavigation(), m_trkAnaDefSvc->hasFullPileupTruth() );
71 m_plots_nTracks_vsRef = std::make_unique< NtracksPlots >(
72 this, "Tracks/Multiplicities", m_anaTag, m_trkAnaDefSvc->referenceTag(),
73 m_trkAnaDefSvc->doTrigNavigation(), m_trkAnaDefSvc->hasFullPileupTruth() );
74 }
75
77 if( m_trkAnaDefSvc->plotEfficiencies() ) {
78 m_plots_eff_vsTest = std::make_unique< EfficiencyPlots >(
79 this, "Tracks/Efficiencies/Purities", m_anaTag, m_trkAnaDefSvc->testTag(), false );
80 m_plots_eff_vsRef = std::make_unique< EfficiencyPlots >(
81 this, "Tracks/Efficiencies", m_anaTag, m_trkAnaDefSvc->referenceTag(), false,
82 true, m_trkAnaDefSvc->hasFullPileupTruth() );
83 if( m_trkAnaDefSvc->matchingType() == "EFTruthMatch" ) {
84 m_plots_eff_vsTruth = std::make_unique< EfficiencyPlots >(
85 this, "Tracks/Efficiencies", m_anaTag, "truth", false );
86 }
87 }
88
90 if( m_trkAnaDefSvc->plotTechnicalEfficiencies()) {
91 m_plots_tech_eff_vsTest = std::make_unique< EfficiencyPlots >(
92 this, "Tracks/Efficiencies/Technical/Purities", m_anaTag, m_trkAnaDefSvc->testTag(), true );
93 m_plots_tech_eff_vsRef = std::make_unique< EfficiencyPlots >(
94 this, "Tracks/Efficiencies/Technical", m_anaTag, m_trkAnaDefSvc->referenceTag(), true,
95 true, m_trkAnaDefSvc->hasFullPileupTruth() );
96 if( m_trkAnaDefSvc->matchingType() == "EFTruthMatch" ) {
97 m_plots_tech_eff_vsTruth = std::make_unique< EfficiencyPlots >(
98 this, "Tracks/Efficiencies/Technical", m_anaTag, "truth", true );
99 }
100 }
101
103 if( m_trkAnaDefSvc->plotResolutions() ) {
104 m_plots_resolution = std::make_unique< ResolutionPlots >(
105 this, "Tracks/Resolutions", m_anaTag,
106 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->referenceTag(),
107 m_trkAnaDefSvc->resolutionMethod() );
108 }
109
111 if( m_trkAnaDefSvc->plotFakeRates() and m_trkAnaDefSvc->isReferenceTruth() ) {
112 m_plots_fakeRate = std::make_unique< FakeRatePlots >(
113 this, "Tracks/FakeRates", m_anaTag, m_trkAnaDefSvc->testTag(),
114 true, m_trkAnaDefSvc->hasFullPileupTruth() );
115 if ( not m_trkAnaDefSvc->unlinkedAsFakes() ) {
116 m_plots_missingTruth = std::make_unique< FakeRatePlots >(
117 this, "Tracks/FakeRates/Unlinked", m_anaTag, m_trkAnaDefSvc->testTag(),
118 true, m_trkAnaDefSvc->hasFullPileupTruth() );
119 }
120 }
121
123 if( m_trkAnaDefSvc->plotDuplicateRates() ) {
124 m_plots_duplRate = std::make_unique< DuplicateRatePlots >(
125 this, "Tracks/Duplicates", m_anaTag, m_trkAnaDefSvc->referenceTag(),
126 true, m_trkAnaDefSvc->hasFullPileupTruth() );
127 }
128
131 if( m_trkAnaDefSvc->plotHitsOnTracks() and not m_trkAnaDefSvc->isTestTruth() ) {
132 m_plots_hitsOnTrk_vsTest = std::make_unique< HitsOnTracksPlots >(
133 this, "Tracks/HitsOnTracks", m_anaTag,
134 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->isITk(),
135 true, m_trkAnaDefSvc->hasFullPileupTruth(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
136 }
137 if( m_trkAnaDefSvc->plotHitsOnTracksReference() and not m_trkAnaDefSvc->isReferenceTruth() ) {
138 m_plots_hitsOnTrk_vsRef = std::make_unique< HitsOnTracksPlots >(
139 this, "Tracks/HitsOnTracks", m_anaTag,
140 m_trkAnaDefSvc->referenceTag(), m_trkAnaDefSvc->isITk(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
141 }
143 if( m_trkAnaDefSvc->plotHitsOnMatchedTracks() and not m_trkAnaDefSvc->isTestTruth() ) {
144 m_plots_hitsOnMatchedTrk = std::make_unique< HitsOnTracksPlots >(
145 this, "Tracks/Resolutions/HitsOnTracks", m_anaTag,
146 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->isITk(),
147 true, m_trkAnaDefSvc->hasFullPileupTruth(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
148 m_plots_hitsOnMatchedTrk_vsRef = std::make_unique< HitsOnTracksPlots >(
149 this, "Tracks/Resolutions/HitsOnTracks", m_anaTag,
150 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->referenceTag(), m_trkAnaDefSvc->isITk(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
151 }
153 if( m_trkAnaDefSvc->plotHitsOnFakeTracks() and m_trkAnaDefSvc->isReferenceTruth() ) {
154 m_plots_hitsOnFakeTrk = std::make_unique< HitsOnTracksPlots >(
155 this, "Tracks/FakeRates/HitsOnTracks", m_anaTag,
156 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->isITk(),
157 true, m_trkAnaDefSvc->hasFullPileupTruth(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
158 if ( not m_trkAnaDefSvc->unlinkedAsFakes() ) {
159 m_plots_hitsOnUnlinkedTrk = std::make_unique< HitsOnTracksPlots >(
160 this, "Tracks/FakeRates/Unlinked/HitsOnTracks", m_anaTag,
161 m_trkAnaDefSvc->testTag(), m_trkAnaDefSvc->isITk(),
162 true, m_trkAnaDefSvc->hasFullPileupTruth(), m_trkAnaDefSvc->plotHitsOnTracksExpert() );
163 }
164 }
165
167 if( m_trkAnaDefSvc->plotOfflineElectrons() ) {
168 m_plots_offEle = std::make_unique< OfflineElectronPlots >(
169 this, "Tracks/Parameters", m_anaTag );
170 if( m_trkAnaDefSvc->plotEfficiencies() ) {
171 m_plots_eff_vsOffEle = std::make_unique< OfflineElectronPlots >(
172 this, "Tracks/Efficiencies", m_anaTag, true );
173 }
174 }
175
177 if( m_trkAnaDefSvc->plotVertexParameters() ) {
179 m_plots_vtxParam_vsTest = std::make_unique< VertexParametersPlots >(
180 this, "Vertices/AllPrimary/Parameters", m_anaTag,
181 m_trkAnaDefSvc->testTag(),
182 not m_trkAnaDefSvc->isTestTruth() ); // do associated tracks plots for reco only
183 m_plots_vtxParam_vsRef = std::make_unique< VertexParametersPlots >(
184 this, "Vertices/AllPrimary/Parameters", m_anaTag,
185 m_trkAnaDefSvc->referenceTag(),
186 not m_trkAnaDefSvc->isReferenceTruth() ); // do associated tracks plots for reco only
187
189 m_plots_nVtxParam_vsTest = std::make_unique< VertexParametersPlots >(
190 this, "Vertices/AllPrimary/Parameters", m_anaTag,
191 m_trkAnaDefSvc->testTag(), false,
192 true, m_trkAnaDefSvc->hasFullPileupTruth() );
193 m_plots_nVtxParam_vsRef = std::make_unique< VertexParametersPlots >(
194 this, "Vertices/AllPrimary/Parameters", m_anaTag,
195 m_trkAnaDefSvc->referenceTag(), false,
196 true, m_trkAnaDefSvc->hasFullPileupTruth() );
197 }
198
201
202 return StatusCode::SUCCESS;
203}
204
205
210 TrackAnalysisCollections& trkAnaColls, float weight )
211{
212 float actualMu = trkAnaColls.eventInfo() ?
213 trkAnaColls.eventInfo()->actualInteractionsPerCrossing() : -1.;
214 float truthMu = trkAnaColls.truthPileupEventContainer() ?
215 static_cast< float >( trkAnaColls.truthPileupEventContainer()->size() ) : -1.;
216
218 if( m_trkAnaDefSvc->isTestTruth() ) {
221 trkAnaColls.matches(),
223 truthMu, actualMu, weight ) );
224 } else {
227 trkAnaColls.matches(),
229 truthMu, actualMu, weight ) );
230 }
231
233 if( m_trkAnaDefSvc->isReferenceTruth() ) {
236 trkAnaColls.matches(),
238 truthMu, actualMu, weight ) );
239 } else {
242 trkAnaColls.matches(),
244 truthMu, actualMu, weight ) );
245 }
246
248 if( m_trkAnaDefSvc->matchingType() == "EFTruthMatch" ) {
253 trkAnaColls.matches(),
254 truthMu, actualMu, weight ) );
255 }
256
258 std::vector< size_t > testTrackCounts = trkAnaColls.testTrackCounts();
259 std::vector< size_t > refTrackCounts = trkAnaColls.refTrackCounts();
260
261 std::vector< size_t > testVertexCounts = trkAnaColls.testVertexCounts();
262 std::vector< size_t > refVertexCounts = trkAnaColls.refVertexCounts();
263
264 if( m_plots_summary ) {
265 ATH_CHECK( m_plots_summary->fillPlots(
266 testTrackCounts, refTrackCounts,
267 trkAnaColls.isNewRoI(), weight ) );
268 }
269
272 testTrackCounts, testVertexCounts,
273 truthMu, actualMu, weight ) );
274 }
275
278 refTrackCounts, refVertexCounts,
279 truthMu, actualMu, weight ) );
280 }
281
282 return StatusCode::SUCCESS;
283}
284
285
289template< typename PARTICLE, typename VERTEX >
291 const std::vector< const PARTICLE* >& particles,
292 const ITrackMatchingLookup& matches,
293 const std::vector< const VERTEX* >& vertices,
294 float truthMu, float actualMu, float weight )
295{
297 for( const PARTICLE* particle : particles ) {
300 ATH_CHECK( m_plots_trkParam_vsTest->fillPlots( *particle, weight ) );
301 }
302
305 ATH_CHECK( m_plots_hitsOnTrk_vsTest->fillPlots( *particle, truthMu, actualMu, weight ) );
306 }
307
308 bool isMatched = matches.isTestMatched( *particle );
309
311 if( m_plots_eff_vsTest ) {
312 ATH_CHECK( m_plots_eff_vsTest->fillPlots(
313 *particle, isMatched, truthMu, actualMu, weight ) );
314 }
315
318 if ( m_trkAnaDefSvc->isTestTruth() and
319 nHitsSelVec( *particle,
320 m_trkAnaDefSvc->minSilHits(),
321 m_trkAnaDefSvc->etaBins() ) ) {
323 *particle, isMatched, truthMu, actualMu, weight ) );
324 }
325 else if ( m_trkAnaDefSvc->isReferenceTruth() ) {
326 bool isTechMatched = isMatched ?
327 nHitsSelVec( *(matches.getMatchedRefTruth( *particle )),
328 m_trkAnaDefSvc->minSilHits(),
329 m_trkAnaDefSvc->etaBins() ) : false;
331 *particle, isTechMatched, truthMu, actualMu, weight ) );
332 }
333 else if ( m_trkAnaDefSvc->matchingType() == "EFTruthMatch" ) {
334 const xAOD::TruthParticle* linkedTruth = getLinkedTruth(
335 *particle, m_trkAnaDefSvc->truthProbCut() );
336 bool isTechMatched = isMatched ?
337 nHitsSelVec( *linkedTruth,
338 m_trkAnaDefSvc->minSilHits(),
339 m_trkAnaDefSvc->etaBins() ) : false;
341 *particle, isTechMatched, truthMu, actualMu, weight ) );
342 }
343 }
344
346 if( m_plots_resolution ) {
347 if( isMatched ) {
348 if( m_trkAnaDefSvc->isReferenceTruth() ) {
349 ATH_CHECK( m_plots_resolution->fillPlots(
350 *particle, *(matches.getMatchedRefTruth( *particle )), weight ) );
351 } else {
352 ATH_CHECK( m_plots_resolution->fillPlots(
353 *particle, *(matches.getMatchedRefTrack( *particle )), weight ) );
354 }
355 }
356 }
357
360 ATH_CHECK( m_plots_hitsOnMatchedTrk->fillPlots( *particle, truthMu, actualMu, weight ) );
361 if( m_trkAnaDefSvc->isReferenceTruth() ) {
363 *particle, *(matches.getMatchedRefTruth( *particle )), truthMu, actualMu, weight ) );
364 } else {
366 *particle, *(matches.getMatchedRefTrack( *particle )), truthMu, actualMu, weight ) );
367 }
368 }
369
371 bool isUnlinked = isUnlinkedTruth( *particle );
372 bool isFakeTruth = getTruthMatchProb( *particle ) < m_trkAnaDefSvc->truthProbCut();
373 if ( isUnlinked ) {
375 ATH_CHECK( m_plots_missingTruth->fillPlots( *particle, isFakeTruth, truthMu, actualMu, weight ) );
376 }
378 ATH_CHECK( m_plots_hitsOnUnlinkedTrk->fillPlots( *particle, truthMu, actualMu, weight ) );
379 }
380 }
381
382 bool doFakes = m_trkAnaDefSvc->unlinkedAsFakes() ? true : not isUnlinked;
383 if( doFakes and m_plots_fakeRate ) {
384 ATH_CHECK( m_plots_fakeRate->fillPlots( *particle, isFakeTruth, truthMu, actualMu, weight ) );
385 if( m_plots_hitsOnFakeTrk and isFakeTruth ) {
386 ATH_CHECK( m_plots_hitsOnFakeTrk->fillPlots( *particle, truthMu, actualMu, weight ) );
387 }
388 }
389
391 if( m_trkAnaDefSvc->isTestOffline() ) {
392 if( m_plots_offEle ) {
393 ATH_CHECK( m_plots_offEle->fillPlots( *particle, false, weight ) );
394 }
396 ATH_CHECK( m_plots_eff_vsOffEle->fillPlots( *particle, isMatched, weight ) );
397 }
398 }
399
400 } // close loop over particles
401
403 int nGoodVertices(0);
404 for( const VERTEX* vertex : vertices ) {
406 if( vertexType( *vertex ) == xAOD::VxType::NoVtx ) {
407 ATH_MSG_DEBUG( "Found Dummy vertex. Skipping" );
408 continue;
409 }
410 nGoodVertices++;
411
413 std::vector< const PARTICLE* > vtxTracks{};
414 std::vector< float > vtxTrackWeights{};
416 *vertex, vtxTracks, vtxTrackWeights,
417 particles, m_trkAnaDefSvc->useSelectedVertexTracks() ) ) {
418 ATH_MSG_WARNING( "Problem when retrieving vertex-assocciated tracks" );
419 if( not vtxTracks.empty() ) {
420 ATH_MSG_WARNING( "Invalid associated track links found. Check your input format." );
421 }
422 }
423
426 ATH_CHECK( m_plots_vtxParam_vsTest->fillPlots( *vertex, vtxTracks, vtxTrackWeights, weight ) );
427 }
428 }
429
432 ATH_CHECK( m_plots_nVtxParam_vsTest->fillPlots( nGoodVertices, truthMu, actualMu, weight ) );
433 }
434
435 return StatusCode::SUCCESS;
436}
437
438template StatusCode
440 const std::vector< const xAOD::TrackParticle* >& particles,
441 const ITrackMatchingLookup& matches,
442 const std::vector< const xAOD::Vertex* >& vertices,
443 float truthMu, float actualMu, float weight );
444
445template StatusCode
447 const std::vector< const xAOD::TruthParticle* >& particles,
448 const ITrackMatchingLookup& matches,
449 const std::vector< const xAOD::TruthVertex* >& vertices,
450 float truthMu, float actualMu, float weight );
451
452
456template< typename PARTICLE, typename VERTEX >
458 const std::vector< const PARTICLE* >& particles,
459 const ITrackMatchingLookup& matches,
460 const std::vector< const VERTEX* >& vertices,
461 float truthMu, float actualMu, float weight )
462{
463
464 for( const PARTICLE* particle : particles ) {
465
468 ATH_CHECK( m_plots_trkParam_vsRef->fillPlots( *particle, weight ) );
469 }
470
473 ATH_CHECK( m_plots_hitsOnTrk_vsRef->fillPlots( *particle, truthMu, actualMu, weight ) );
474 }
475
476 bool isMatched = matches.isRefMatched( *particle );
477
479 if( m_plots_eff_vsRef ) {
480 ATH_CHECK( m_plots_eff_vsRef->fillPlots(
481 *particle, isMatched, truthMu, actualMu, weight ) );
482 }
483
486 if( m_trkAnaDefSvc->isReferenceTruth() and
487 nHitsSelVec( *particle, m_trkAnaDefSvc->minSilHits(), m_trkAnaDefSvc->etaBins() ) )
488 {
490 *particle, isMatched, truthMu, actualMu, weight ) );
491 }
492 else if ( m_trkAnaDefSvc->isTestTruth() ) {
493
494 bool isTechMatched = false;
495
496 if (isMatched) {
497 for ( const xAOD::TruthParticle *thisTruth : (matches.getMatchedTestTruths( *particle ))) {
498 if ( nHitsSelVec( *thisTruth, m_trkAnaDefSvc->minSilHits(), m_trkAnaDefSvc->etaBins() ) ) {
499 isTechMatched = true;
500 break;
501 }
502 }
503 }
505 *particle, isTechMatched, truthMu, actualMu, weight ) );
506 }
507
508 else if ( m_trkAnaDefSvc->matchingType() == "EFTruthMatch" ) {
509 const xAOD::TruthParticle* linkedTruth = getLinkedTruth(
510 *particle, m_trkAnaDefSvc->truthProbCut() );
511 bool isTechMatched = isMatched ?
512 nHitsSelVec( *linkedTruth, m_trkAnaDefSvc->minSilHits(), m_trkAnaDefSvc->etaBins() ) : false;
514 *particle, isTechMatched, truthMu, actualMu, weight ) );
515 }
516 }
517
519 if( m_plots_duplRate ) {
520 unsigned int nMatched = m_trkAnaDefSvc->isTestTruth() ?
521 matches.getMatchedTestTruths( *particle ).size() :
522 matches.getMatchedTestTracks( *particle ).size();
523
524 ATH_CHECK( m_plots_duplRate->fillPlots(
525 *particle, nMatched, truthMu, actualMu, weight ) );
526 }
527
529 if( m_trkAnaDefSvc->isReferenceOffline() ) {
530 if( m_plots_offEle ) {
531 ATH_CHECK( m_plots_offEle->fillPlots( *particle, false, weight ) );
532 }
534 ATH_CHECK( m_plots_eff_vsOffEle->fillPlots( *particle, isMatched, weight ) );
535 }
536 }
537
538 } // close loop over particles
539
541 int nGoodVertices(0);
542 for( const VERTEX* vertex : vertices ) {
544 if( vertexType( *vertex ) == xAOD::VxType::NoVtx ) {
545 ATH_MSG_DEBUG( "Found Dummy vertex. Skipping" );
546 continue;
547 }
548 nGoodVertices++;
549
551 std::vector< const PARTICLE* > vtxTracks{};
552 std::vector< float > vtxTrackWeights{};
554 *vertex, vtxTracks, vtxTrackWeights,
555 particles, m_trkAnaDefSvc->useSelectedVertexTracks() ) ) {
556 ATH_MSG_WARNING( "Problem when retrieving vertex-assocciated tracks" );
557 if( not vtxTracks.empty() ) {
558 ATH_MSG_WARNING( "Invalid associated track links found. Check your input format." );
559 }
560 }
561
564 ATH_CHECK( m_plots_vtxParam_vsRef->fillPlots( *vertex, vtxTracks, vtxTrackWeights, weight ) );
565 }
566 }
567
570 ATH_CHECK( m_plots_nVtxParam_vsRef->fillPlots( nGoodVertices, truthMu, actualMu, weight ) );
571 }
572
573 return StatusCode::SUCCESS;
574}
575
576template StatusCode
578 const std::vector< const xAOD::TrackParticle* >& particles,
579 const ITrackMatchingLookup& matches,
580 const std::vector< const xAOD::Vertex* >& vertices,
581 float truthMu, float actualMu, float weight );
582
583template StatusCode
585 const std::vector< const xAOD::TruthParticle* >& particles,
586 const ITrackMatchingLookup& matches,
587 const std::vector< const xAOD::TruthVertex* >& vertices,
588 float truthMu, float actualMu, float weight );
589
590
595 const std::vector< const xAOD::TrackParticle* >& testTracks,
596 const std::vector< const xAOD::TrackParticle* >& refTracks,
597 const std::vector< const xAOD::TruthParticle* >& truths,
598 const ITrackMatchingLookup& matches,
599 float truthMu, float actualMu, float weight )
600{
601
602 for( const xAOD::TruthParticle* thisTruth : truths ) {
603
604 bool isMatched( false ); // test track matched to reference track through EFTruthMatch method
605 bool refMatched( false ); // reference track matched to thisTruth
606
608 for( const xAOD::TrackParticle* thisTrack : refTracks ) {
609 const xAOD::TruthParticle* linkedTruth = getLinkedTruth(
610 *thisTrack, m_trkAnaDefSvc->truthProbCut() );
611 if( not linkedTruth ) {
612 ATH_MSG_WARNING( "Unlinked track!!" );
613 continue;
614 }
615 if( thisTruth == linkedTruth ) {
616 refMatched = true;
617 break;
618 }
619 } // close loop over reference tracks
620
622 if ( not refMatched ) continue;
623
624 else {
625
627 for( const xAOD::TrackParticle* thisTrack : testTracks ) {
628 const xAOD::TruthParticle* linkedTruth = getLinkedTruth(
629 *thisTrack, m_trkAnaDefSvc->truthProbCut() );
630 if( not linkedTruth ) {
631 ATH_MSG_WARNING( "Unlinked track!!" );
632 continue;
633 }
634 if( thisTruth == linkedTruth ) {
635 isMatched = matches.isTestMatched( *thisTrack ); // Check if this test is matched to reference with EFTruthMatch
636 break;
637 }
638 } // close loop over test tracks
639
641 if( m_plots_eff_vsTruth ) {
642 ATH_CHECK( m_plots_eff_vsTruth->fillPlots(
643 *thisTruth, isMatched, truthMu, actualMu, weight ) );
644 }
645
648 if (nHitsSelVec( *thisTruth, m_trkAnaDefSvc->minSilHits(), m_trkAnaDefSvc->etaBins() )) {
650 *thisTruth, isMatched , truthMu, actualMu, weight ) );
651 }
652 }
653 }
654 } // close loop over truth particles
655
656 return StatusCode::SUCCESS;
657}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Interace for TrackMatchingLookup objects (templated)
Utility methods to access offline object decorations.
Class to hold for each event collections needed in the TrkAnalsis.
class to manage (book, fill) all the plots for the processed TrackAnalysis for tracking performance v...
Utility methods to access track/truth particles parmeters in a consitent way in this package.
virtual const std::vector< const xAOD::TruthParticle * > & getMatchedTestTruths(const xAOD::TrackParticle &r) const =0
vec Truth <- Track
virtual const xAOD::TrackParticle * getMatchedRefTrack(const xAOD::TrackParticle &t) const =0
get matched reference (1 to 1) Track -> Track
virtual const xAOD::TruthParticle * getMatchedRefTruth(const xAOD::TrackParticle &t) const =0
Track -> Truth.
virtual bool isRefMatched(const xAOD::TrackParticle &r) const =0
return true if reference is matched
virtual const std::vector< const xAOD::TrackParticle * > & getMatchedTestTracks(const xAOD::TrackParticle &r) const =0
get matched test vector (1 to 1+) vec Track <- Track
virtual bool isTestMatched(const xAOD::TrackParticle &t) const =0
return true if test is matched
StatusCode initialize()
initialize
Definition PlotMgr.cxx:37
PlotMgr(const std::string &dirName, const std::string &anaTag, PlotMgr *pParent=nullptr)
Constructor taking parent node and directory name for plots pParent = nullptr by default to book plot...
Definition PlotMgr.cxx:25
const std::vector< const xAOD::TruthVertex * > & refTruthVertexVec(Stage stage=FULL)
get REFERENCE vertex vectors
const std::vector< const xAOD::TruthParticle * > & testTruthVec(Stage stage=FULL)
get TEST track vectors
std::vector< size_t > refTrackCounts()
REFERENCE.
const xAOD::TruthPileupEventContainer * truthPileupEventContainer()
bool isNewRoI()
check if this is a new RoI
const std::vector< const xAOD::Vertex * > & refRecoVertexVec(Stage stage=FULL)
REFERENCE = Reco.
const std::vector< const xAOD::TruthParticle * > & truthPartVec(Stage stage=FULL)
get truth/offline/trigger track vector (TEST or REFERENCE)
ITrackMatchingLookup & matches()
get track matching information
std::vector< size_t > refVertexCounts()
REFERENCE.
const xAOD::EventInfo * eventInfo()
get event info
const std::vector< const xAOD::TruthVertex * > & testTruthVertexVec(Stage stage=FULL)
get TEST vertex vectors
const std::vector< const xAOD::TrackParticle * > & testTrackVec(Stage stage=FULL)
TEST = Track.
const std::vector< const xAOD::TruthParticle * > & refTruthVec(Stage stage=FULL)
get REFERENCE track vectors
const std::vector< const xAOD::Vertex * > & testRecoVertexVec(Stage stage=FULL)
TEST = Reco.
std::vector< size_t > testTrackCounts()
get counts vectors for TEST/REFERENCE track vectors at all stages
std::vector< size_t > testVertexCounts()
get counts vectors for TEST/REFERENCE vertex vectors at all stages
const std::vector< const xAOD::TrackParticle * > & refTrackVec(Stage stage=FULL)
TEST = Track.
std::unique_ptr< EfficiencyPlots > m_plots_eff_vsRef
std::unique_ptr< ResolutionPlots > m_plots_resolution
resolution plots
std::unique_ptr< FakeRatePlots > m_plots_fakeRate
fake rate plots (only when reference=truth)
std::unique_ptr< NtracksPlots > m_plots_nTracks_vsRef
SmartIF< ITrackAnalysisDefinitionSvc > m_trkAnaDefSvc
TrackAnalysis definition service to "hold" the histograms configurations/flags.
std::unique_ptr< EfficiencyPlots > m_plots_tech_eff_vsRef
std::unique_ptr< SummaryPlots > m_plots_summary
Plot categories summary plots.
std::unique_ptr< OfflineElectronPlots > m_plots_offEle
plots w.r.t. reference offline electron
const std::string & anaTag() const
return members
std::unique_ptr< VertexParametersPlots > m_plots_vtxParam_vsRef
plots w.r.t. reference vertices parameters
StatusCode fillPlotsTruth(const std::vector< const xAOD::TrackParticle * > &testTracks, const std::vector< const xAOD::TrackParticle * > &refTracks, const std::vector< const xAOD::TruthParticle * > &truths, const ITrackMatchingLookup &matches, float truthMu=0., float actualMu=0., float weight=1.0)
Fill efficiency plots w.r.t. truth (for EFTruthMatch only)
std::unique_ptr< EfficiencyPlots > m_plots_tech_eff_vsTruth
std::unique_ptr< EfficiencyPlots > m_plots_tech_eff_vsTest
StatusCode fill(TrackAnalysisCollections &trkAnaColls, float weight=1.0)
General fill method.
std::unique_ptr< FakeRatePlots > m_plots_missingTruth
StatusCode fillPlotsReference(const std::vector< const PARTICLE * > &particles, const ITrackMatchingLookup &matches, const std::vector< const VERTEX * > &vertices, float truthMu=0., float actualMu=0., float weight=1.0)
Fill all plots w.r.t.
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnUnlinkedTrk
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnTrk_vsRef
std::unique_ptr< VertexParametersPlots > m_plots_vtxParam_vsTest
plots w.r.t. test vertices parameters
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnTrk_vsTest
const std::string & chain() const
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnMatchedTrk
std::unique_ptr< VertexParametersPlots > m_plots_nVtxParam_vsRef
TrackAnalysisPlotsMgr(const std::string &dirName, const std::string &anaTag, const std::string &chain, PlotMgr *pParent=nullptr)
Constructor.
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnMatchedTrk_vsRef
std::unique_ptr< TrackParametersPlots > m_plots_trkParam_vsRef
plots w.r.t. reference tracks parameters
std::unique_ptr< EfficiencyPlots > m_plots_eff_vsTruth
plots w.r.t. efficiency plots w.r.t. truth (for EFTruthMatch only)
std::unique_ptr< EfficiencyPlots > m_plots_eff_vsTest
std::unique_ptr< NtracksPlots > m_plots_nTracks_vsTest
std::unique_ptr< VertexParametersPlots > m_plots_nVtxParam_vsTest
std::unique_ptr< DuplicateRatePlots > m_plots_duplRate
duplicate rate plots
StatusCode fillPlotsTest(const std::vector< const PARTICLE * > &particles, const ITrackMatchingLookup &matches, const std::vector< const VERTEX * > &vertices, float truthMu=0., float actualMu=0., float weight=1.0)
Fill all plots w.r.t.
std::unique_ptr< TrackParametersPlots > m_plots_trkParam_vsTest
plots w.r.t. test tracks parameters
std::unique_ptr< OfflineElectronPlots > m_plots_eff_vsOffEle
std::unique_ptr< HitsOnTracksPlots > m_plots_hitsOnFakeTrk
float actualInteractionsPerCrossing() const
Average interactions per crossing for the current BCID - for in-time pile-up.
bool nHitsSelVec(const PARTICLE &p, const std::vector< unsigned int > &minHits, const std::vector< float > &etaBins)
float getTruthMatchProb(const xAOD::TrackParticle &track)
getTruthMatchProb
bool getVertexTracksAndWeights(const xAOD::Vertex &vtx, std::vector< const xAOD::TrackParticle * > &vtxTracks, std::vector< float > &vtxTrackWeights, const std::vector< const xAOD::TrackParticle * > &selTracks, bool useSelected)
getVertexTracksAndWeights
const xAOD::TruthParticle * getLinkedTruth(const xAOD::TrackParticle &track, const float truthProbCut)
getLinkedTruth
bool isUnlinkedTruth(const xAOD::TrackParticle &track)
isUnlinkedTruth
int vertexType(const V &v)
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.