ATLAS Offline Software
Loading...
Searching...
No Matches
VrtSecInclusive.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Header include
8
11
12// FrameWork include(s):
14
15// ROOT Classes
16#include "TMath.h"
17#include "TH1F.h"
18#include "TH2F.h"
19#include "TNtuple.h"
20#include "TTree.h"
21#include "TROOT.h"
22
23#include <chrono>
24#include <exception>
25#include <functional>
26#include <iostream>
27#include <memory>
28#include <new>
29#include <string>
30#include <tuple>
31
32using namespace std;
33
34
35namespace VKalVrtAthena {
36
37 //Constructor and destructor
38 //__________________________________________________________________________
39 VrtSecInclusive::VrtSecInclusive(const std::string& name, ISvcLocator* pSvcLocator):
40 AthAlgorithm (name,pSvcLocator),
41
42 m_primaryVertices ( nullptr ),
43 m_thePV ( nullptr ),
44
45 // ToolsHandles
46 m_fitSvc ( "Trk::TrkVKalVrtFitter", this ),
47 m_truthToTrack ( "Trk::TruthToTrack/InDetTruthToTrack" ),
48 m_trackToVertexTool ( "Reco::TrackToVertex" ),
49 m_trackToVertexIPEstimatorTool ( "Trk::TrackToVertexIPEstimator/TrackToVertexIPEstimator" ),
50 m_extrapolator ( "Trk::Extrapolator/AtlasExtrapolator" ),
51 m_vertexMapper ( "" ),
52
53 m_checkPatternStrategy ( "Classical" ),
54
55 // Pointers of Ntuple variable vectors
56 m_tree_Vert ( nullptr ),
57 m_ntupleVars ( nullptr )
58
59 {
60
65
66 this->declareProperties();
67
68 if( m_jp.FillNtuple ) {
69 m_ntupleVars = std::make_unique<NtupleVars>( );
70 }
71
72 }
73
74
75
76 //__________________________________________________________________________
78 {
79 ATH_MSG_DEBUG("destructor called");
80 }
81
82
83 //__________________________________________________________________________
85 {
86 ATH_MSG_INFO("initialize: begin");
87 //
88 // first instantiate tools
89
90 // VKalVrt vertex fitter
91 if (m_fitSvc.retrieve().isFailure()) {
92 ATH_MSG_ERROR("initialize: Can't find Trk::TrkVKalVrtFitter");
93 return StatusCode::SUCCESS;
94 } else {
95 ATH_MSG_INFO("initialize: Trk::TrkVKalVrtFitter found");
96 }
97
98 //
99 // retreive tool to get trackParameters of generated Particles
100 if(m_truthToTrack.retrieve().isFailure()) {
101 ATH_MSG_INFO("initialize: Cannot retrieve Trk::TruthToTrack Tool!");
102 return StatusCode::FAILURE;
103 }
104 else {
105 ATH_MSG_INFO("initialize: Retrieved Trk::TruthToTrack Tool" << m_truthToTrack);
106
107 }
108 // extract TrackToVertex extrapolator tool
109 if ( m_trackToVertexTool.retrieve().isFailure() ) {
110 ATH_MSG_ERROR("initialize: failed to retrieve trackToVertex tool ");
111 return StatusCode::SUCCESS;
112 }
113 else {
114 ATH_MSG_INFO("initialize: Retrieved Reco::TrackToVertex Tool" << m_trackToVertexTool);
115 }
116 // extract TrackToVertexIPEstimator extrapolator tool
117 if ( m_trackToVertexIPEstimatorTool.retrieve().isFailure() ) {
118 ATH_MSG_ERROR("initialize: failed to retrieve trackToVertexIPEstimator tool ");
119 return StatusCode::SUCCESS;
120 }
121 else {
122 ATH_MSG_INFO("initialize: Retrieved Trk::TrackToVertexIPEstimator Tool" << m_trackToVertexIPEstimatorTool);
123 }
124
125 if( detStore()->retrieve(m_atlasId, "AtlasID").isFailure() ) return StatusCode::FAILURE;
126 if( detStore()->retrieve(m_pixelId, "PixelID").isFailure() ) return StatusCode::FAILURE;
127 if( detStore()->retrieve(m_sctId, "SCT_ID") .isFailure() ) return StatusCode::FAILURE;
128
129 if ( m_pixelCondSummaryTool.retrieve().isFailure() ) {
130 ATH_MSG_ERROR("initialize: failed to retrieve PixelConditionsSummaryTool");
131 return StatusCode::SUCCESS;
132 }
133 else {
134 ATH_MSG_INFO("initialize: Retrieved PixelConditionsSummaryTool" << m_pixelCondSummaryTool);
135 }
136 if ( m_sctCondSummaryTool.retrieve().isFailure() ) {
137 ATH_MSG_ERROR("initialize: failed to retrieve SCTConditionsSummaryTool");
138 return StatusCode::SUCCESS;
139 }
140 else {
141 ATH_MSG_INFO("initialize: Retrieved SCTConditionsSummaryTool" << m_sctCondSummaryTool);
142 }
143
144 ATH_CHECK( m_extrapolator.retrieve() );
145
146 // extract VertexMapper
147 if( m_jp.doMapToLocal ) {
148 ATH_CHECK( m_vertexMapper.retrieve() );
149 }
150
151 // Track selection algorithm configuration
152 if( m_jp.doSelectTracksFromMuons ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectTracksFromMuons ); }
153 if( m_jp.doSelectTracksFromElectrons ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectTracksFromElectrons ); }
154 if( m_jp.doSelectIDAndGSFTracks ) { m_trackSelectionAlgs.emplace_back( &VrtSecInclusive::selectInDetAndGSFTracks ); }
155
156 // if none of the above two flags are activated, use ID tracks (default)
157 if( !m_jp.doSelectTracksFromMuons && !m_jp.doSelectTracksFromElectrons && !m_jp.doSelectIDAndGSFTracks) {
158
160
161 }
162
163
164 // Vertexing algorithm configuration
165 m_vertexingAlgorithms.emplace_back( "extractIncompatibleTrackPairs", &VrtSecInclusive::extractIncompatibleTrackPairs );
166 m_vertexingAlgorithms.emplace_back( "findNtrackVertices", &VrtSecInclusive::findNtrackVertices );
167 m_vertexingAlgorithms.emplace_back( "rearrangeTracks", &VrtSecInclusive::rearrangeTracks );
168
169 if( m_jp.doReassembleVertices ) {
170 m_vertexingAlgorithms.emplace_back( "reassembleVertices", &VrtSecInclusive::reassembleVertices );
171 }
172
173 if( m_jp.doMergeByShuffling ) {
174 m_vertexingAlgorithms.emplace_back( "mergeByShuffling", &VrtSecInclusive::mergeByShuffling );
175 }
176
177 if ( m_jp.doMergeFinalVerticesDistance ) {
178 m_vertexingAlgorithms.emplace_back( "mergeFinalVertices", &VrtSecInclusive::mergeFinalVertices );
179 }
180
181 if( m_jp.doAssociateNonSelectedTracks ) {
182 m_vertexingAlgorithms.emplace_back( "associateNonSelectedTracks", &VrtSecInclusive::associateNonSelectedTracks );
183 }
184
186
187
188 // now make histograms/ntuples
189
190 ServiceHandle<ITHistSvc> hist_root("THistSvc", name());
191 ATH_CHECK( hist_root.retrieve() );
192
193 if( m_jp.FillHist ) {
194
195 std::vector<double> rbins = { 0.1, 0.3, 0.5, 1, 2, 3, 5, 7, 10, 14, 20, 28, 38, 50, 64, 80, 100, 130, 170, 220, 280, 350, 450, 600 };
196 std::vector<double> nbins = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 20, 24, 28, 38, 50, 70, 100, 150 };
197
198 const size_t& nAlgs = m_vertexingAlgorithms.size();
199
200 ATH_MSG_INFO("initialize: Filling Histograms");
201 //
202 m_hists["trkSelCuts"] = new TH1F("trkSelCuts", ";Cut Order;Tracks", 10, -0.5, 10-0.5 );
203 m_hists["selTracksDist"] = new TH1F("selTracksDist", ";Selected Tracks;Events", 2000, -0.5, 2000-0.5 );
204 m_hists["initVertexDispD0"] = new TH2F("initVertexDispD0", ";Rough d0 wrt init [mm];r [mm];Vertices", 1000, -100, 100, rbins.size()-1, &(rbins[0]) );
205 m_hists["initVertexDispZ0"] = new TH2F("initVertexDispZ0", ";Rough z0 wrt init [mm];z [mm];Vertices", 1000, -100, 100, 100, -1000, 1000 );
206 m_hists["incompMonitor"] = new TH1F("incompMonitor", ";Setp;Track Pairs", 10, -0.5, 10-0.5 );
207 m_hists["2trkVerticesDist"] = new TH1F("2trkVerticesDist", ";2-track Vertices;Events", 1000, -0.5, 1000-0.5 );
208 m_hists["2trkChi2Dist"] = new TH1F("2trkChi2Dist", ";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
209 m_hists["NtrkChi2Dist"] = new TH1F("NtrkChi2Dist", ";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
210 m_hists["vPosDist"] = new TH2F("vPosDist", ";r;#vec{x}*#vec{p}/p_{T} [mm]", rbins.size()-1, &(rbins[0]), 200, -1000, 1000 );
211 m_hists["vPosMomAngTDist"] = new TH2F("vPosMomAngDistT", ";r;cos(#vec{r},#vec{p}_{T})", rbins.size()-1, &(rbins[0]), 200, -1.0, 1.0 );
212 m_hists["disabledCount"] = new TH1F("disabledCount", ";N_{modules};Tracks", 20, -0.5, 10-0.5 );
213 m_hists["vertexYield"] = new TH1F("vertexYield", ";Algorithm Step;Vertices", nAlgs, -0.5, nAlgs-0.5 );
214 m_hists["vertexYieldNtrk"] = new TH2F("vertexYieldNtrk", ";Ntrk;Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
215 m_hists["vertexYieldChi2"] = new TH2F("vertexYieldChi2", ";#chi^{2}/N_{dof};Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
216 m_hists["mergeType"] = new TH1F("mergeType", ";Merge Algorithm Type;Entries", 10, -0.5, 10-0.5 );
217 m_hists["associateMonitor"] = new TH1F("associateMonitor", ";Step;Vertices", 10, -0.5, 10-0.5 );
218 m_hists["shuffleMinSignif1"] = new TH1F("shuffleMinSignif1", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
219 m_hists["shuffleMinSignif2"] = new TH1F("shuffleMinSignif2", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
220 m_hists["shuffleMinSignif3"] = new TH1F("shuffleMinSignif3", ";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
221 m_hists["finalCutMonitor"] = new TH1F("finalCutMonitor", ";Step;Vertices", 6, -0.5, 6-0.5 );
222 m_hists["finalVtxNtrk"] = new TH1F("finalVtxNtrk", ";N_{trk};Vertices", nbins.size()-1, &(nbins[0]) );
223 m_hists["finalVtxR"] = new TH1F("finalVtxR", ";r [mm];Vertices", 600, 0, 600 );
224 m_hists["finalVtxNtrkR"] = new TH2F("finalVtxNtrkR", ";N_{trk};r [mm];Vertices", nbins.size()-1, &(nbins[0]), rbins.size()-1, &(rbins[0]) );
225 m_hists["CPUTime"] = new TH1F("CPUTime", ";Step;Accum. CPU Time [s]", 10, -0.5, 10-0.5 );
226 m_hists["nMatchedTruths"] = new TH2F("nMatchedTruths", ";Step;;r [mm];Matched truth vertices", 11, -0.5, 11-0.5, rbins.size()-1, &(rbins[0]) );
227 m_hists["vPosMomAngT"] = new TH1F("vPosMomAngT", ";cos(#vec{r},#vec{p}_{T}", 200, -1.0, 1.0 );
228 m_hists["vPosMomAng3D"] = new TH1F("vPosMomAng3D", ";cos(#vec{r},#vec{p})", 200, -1.0, 1.0 );
229 m_hists["2trkVtxDistFromPV"] = new TH1F("2trkVtDistFromPV", ";2tr vertex distance from PV;Events", 100, 0, 3 );
230
231
232 std::string histDir("/AANT/VrtSecInclusive" + m_jp.augVerString + "/");
233
234 for( auto& pair : m_hists ) {
235 ATH_CHECK( hist_root->regHist( histDir + pair.first, pair.second ) );
236 }
237 }
238
239
240 if( m_jp.FillNtuple ) {
241
243
244 m_tree_Vert = new TTree("tree_VrtSecInclusive","TTree of VrtSecInclusive");
245 ATH_CHECK( hist_root->regTree("/AANT/tree_VrtSecInclusive", m_tree_Vert) );
246
248
249 }
250
251 // initialize keys
252 ATH_CHECK(m_eventInfoKey.initialize());
253
254 // Instantiate and initialize our event info decorator write
255 m_vertexingStatusKey = SG::WriteDecorHandleKey<xAOD::EventInfo>(m_eventInfoKey.key() + "." + "VrtSecInclusive_"+ m_jp.secondaryVerticesContainerName + m_jp.augVerString + "_status");
256 this->declare(m_vertexingStatusKey);
257 m_vertexingStatusKey.setOwner(&(*this));
258 ATH_CHECK(m_vertexingStatusKey.initialize());
259
260 //
261 ATH_MSG_INFO("initialize: Exit VrtSecInclusive::initialize()");
262 return StatusCode::SUCCESS;
263 }
264
265
266
267 //__________________________________________________________________________
269 {
270
271 ATH_MSG_INFO("finalize: VrtSecInclusive finalize()");
272 return StatusCode::SUCCESS;
273 }
274
275 //__________________________________________________________________________
277 {
278
279 ATH_MSG_DEBUG("initEvent: begin");
280
281 // Clear all variables to be stored to the AANT
282 if( m_jp.FillNtuple ) {
284 }
285
286
287 ATH_MSG_DEBUG("initEvent: from initEvent ");
288 return StatusCode::SUCCESS;
289
290 }
291
292
293 //__________________________________________________________________________
295 {
296 //
297 ATH_MSG_DEBUG("VrtSecInclusive execute()");
298
300
302 if (!eventInfo.isValid()) {
303 ATH_MSG_ERROR ("Could not retrieve EventInfo");
304 return StatusCode::FAILURE;
305 }
306
308
309 // clear ntuple variables
310 StatusCode sc = this->initEvent();
311 if(sc.isFailure()) {
312 ATH_MSG_WARNING("Problem in initEvent ");
313 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
314 return StatusCode::SUCCESS;
315 }
316
317 // add event level info to ntuple
318 if( m_jp.FillNtuple ) sc = addEventInfo();
319
320 if (sc.isFailure() ) {
321 ATH_MSG_WARNING("Failure in getEventInfo() ");
322 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
323 return StatusCode::SUCCESS;
324 }
325
326
328 //
329 // Setup StoreGate Variables
330 //
331
332 // Check Return StatusCode::Failure if the user-specified container names have duplication.
333 {
334 std::vector<std::string> userContainerNames { m_jp.secondaryVerticesContainerName, m_jp.all2trksVerticesContainerName };
335 std::set<std::string> userContainerNamesSet;
336 for( auto& name : userContainerNames ) userContainerNamesSet.insert( name );
337 if( userContainerNamesSet.size() != userContainerNames.size() ) {
338 ATH_MSG_ERROR( " > " << __FUNCTION__ << ": detected duplicated user-specified container name. Please check your job property" );
339 return StatusCode::FAILURE;
340 }
341 }
342
343 auto *secondaryVertexContainer = new xAOD::VertexContainer;
344 auto *secondaryVertexAuxContainer = new xAOD::VertexAuxContainer;
345
346 secondaryVertexContainer ->setStore( secondaryVertexAuxContainer );
347
348 ATH_CHECK( evtStore()->record( secondaryVertexContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString ) );
349 ATH_CHECK( evtStore()->record( secondaryVertexAuxContainer, "VrtSecInclusive_" + m_jp.secondaryVerticesContainerName + m_jp.augVerString + "Aux." ) );
350
351 if( m_jp.FillIntermediateVertices ) {
352 auto *twoTrksVertexContainer = new xAOD::VertexContainer;
353 auto *twoTrksVertexAuxContainer = new xAOD::VertexAuxContainer;
354
355 twoTrksVertexContainer ->setStore( twoTrksVertexAuxContainer );
356
357 ATH_CHECK( evtStore()->record( twoTrksVertexContainer, "VrtSecInclusive_" + m_jp.all2trksVerticesContainerName + m_jp.augVerString ) );
358 ATH_CHECK( evtStore()->record( twoTrksVertexAuxContainer, "VrtSecInclusive_" + m_jp.all2trksVerticesContainerName + m_jp.augVerString + "Aux." ) );
359
360 for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
361
362 auto& name = itr->first;
363
364 auto *intermediateVertexContainer = new xAOD::VertexContainer;
365 auto *intermediateVertexAuxContainer = new xAOD::VertexAuxContainer;
366
367 intermediateVertexContainer ->setStore( intermediateVertexAuxContainer );
368
369 ATH_CHECK( evtStore()->record( intermediateVertexContainer, "VrtSecInclusive_IntermediateVertices_" + name + m_jp.augVerString ) );
370 ATH_CHECK( evtStore()->record( intermediateVertexAuxContainer, "VrtSecInclusive_IntermediateVertices_" + name + m_jp.augVerString + "Aux." ) );
371 }
372
373 }
374
376
377
378 // Later use elsewhere in the algorithm
379 m_selectedTracks.clear();
380 m_associatedTracks.clear();
381 m_leptonicTracks.clear();
382
384
386 //
387 // now start algorithm
388 //
389
390 //--------------------------------------------------------
391 // Primary vertex processing
392 //
393 sc = this->processPrimaryVertices(); // fetch the 1st primary reconstructed vertex
394
395 if( sc.isFailure() or !m_thePV ) {
396
397 ATH_MSG_WARNING("processPrimaryVertices() failed");
398 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
399 return StatusCode::SUCCESS;
400 }
401
402 // Perform track selection and store it to selectedBaseTracks
403 for( auto alg : m_trackSelectionAlgs ) {
404 ATH_CHECK( (this->*alg)() );
405 }
406
407 if( m_jp.FillNtuple )
408 m_ntupleVars->get<unsigned int>( "NumSelTrks" ) = static_cast<int>( m_selectedTracks.size() );
409
410 // fill information about selected tracks in AANT
412
413 //-------------------------------------------------------
414 // Skip the event if the number of selected tracks is more than m_jp.SelTrkMaxCutoff
415 if( m_selectedTracks.size() < 2 ) {
416 ATH_MSG_DEBUG( "execute: Too few (<2) selected reco tracks. Terminated reconstruction." );
418 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
420 return StatusCode::SUCCESS;
421 }
422
423 if( m_selectedTracks.size() > m_jp.SelTrkMaxCutoff ) {
424 ATH_MSG_INFO( "execute: Too many selected reco tracks. Terminated reconstruction." );
426 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
428 return StatusCode::SUCCESS;
429 }
430
431 //-------------------------------------------------------
432 // Core part of Vertexing
433 //
434
435 {
436
438
439 // set of vertices created in the following while loop.
440 std::vector<WrkVrt> workVerticesContainer;
441
442 // the main sequence of the main vertexing algorithms
443 // see initialize() what kind of algorithms exist.
444 for( auto itr = m_vertexingAlgorithms.begin(); itr!=m_vertexingAlgorithms.end(); ++itr ) {
445
446 auto& name = itr->first;
447 auto alg = itr->second;
448
449 auto t_start = std::chrono::system_clock::now();
450
451 ATH_CHECK( (this->*alg)( &workVerticesContainer ) );
452
453 auto t_end = std::chrono::system_clock::now();
454
455 if( m_jp.FillHist ) {
456 auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
457 m_hists["CPUTime"]->Fill( m_vertexingAlgorithmStep, sec/1.e6 );
458 }
459
460 std::erase_if( workVerticesContainer,
461 []( WrkVrt& wrkvrt ) {
462 return ( !wrkvrt.isGood || wrkvrt.nTracksTotal() < 2 ); }
463 );
464
465 ATH_CHECK( monitorVertexingAlgorithmStep( &workVerticesContainer, name, std::next( itr ) == m_vertexingAlgorithms.end() ) );
466
468
469 }
470 }
471
473 vertexingStatusDecor(*eventInfo) = m_vertexingStatus;
474
475 // Fill AANT
476 if( m_jp.FillNtuple ) {
477 m_tree_Vert->Fill();
479 }
480
482
483 ATH_MSG_VERBOSE( "execute: process done." );
484 // end
485 return StatusCode::SUCCESS;
486
487 }
488
489 void VrtSecInclusive::lockTrackDecorations( const xAOD::TrackParticle* trk, bool onlySelection ) const {
491 const_cast<SG::AuxVectorData*> (trk->container());
492 cont_nc->lockDecoration (m_decor_isSelected->auxid());
493
494 if (onlySelection) return;
495
496 if (m_decor_isAssociated && m_decor_isAssociated->isAvailable (*cont_nc)) {
497 cont_nc->lockDecoration (m_decor_isAssociated->auxid());
498 }
499 if (m_decor_is_svtrk_final && m_decor_is_svtrk_final->isAvailable (*cont_nc)) {
500 cont_nc->lockDecoration (m_decor_is_svtrk_final->auxid());
501 }
502
503 for (const auto& p : m_trkDecors) {
504 cont_nc->lockDecoration (p.second.auxid());
505 }
506 }
507
510 const_cast<SG::AuxVectorData*> (cont);
511 for (const IPDecoratorType& dec : m_ipDecors) {
512 if (dec.isAvailable (*cont)) {
513 cont_nc->lockDecoration (dec.auxid());
514 }
515 }
516
517 if (m_decor_svLink) {
518 if (m_decor_svLink->isAvailable (*cont)) {
519 cont_nc->lockDecoration (m_decor_svLink->auxid());
520 }
521 }
522 }
523
524 StatusCode VrtSecInclusive::lockTrackDecorations( bool onlySelection ) const
525 {
526 const xAOD::TrackParticleContainer* trackParticleContainer ( nullptr );
527 ATH_CHECK( evtStore()->retrieve( trackParticleContainer, m_jp.TrackLocation) );
528 for( const xAOD::TrackParticle* trk : *trackParticleContainer ) {
529 lockTrackDecorations( trk, onlySelection );
530 }
531
532 const xAOD::MuonContainer* muons ( nullptr );
533 ATH_CHECK( evtStore()->retrieve( muons, m_jp.MuonLocation) );
534 if (muons->ownPolicy() != SG::VIEW_ELEMENTS) {
535 lockLeptonDecorations (muons);
536 }
537 for( const xAOD::Muon* muon : *muons ) {
538 if (muons->ownPolicy() == SG::VIEW_ELEMENTS) {
539 lockLeptonDecorations (muon->container());
540 }
541 if ( const xAOD::TrackParticle* trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ) ) {
542 lockTrackDecorations( trk, onlySelection );
543 }
544 }
545
546 const xAOD::ElectronContainer *electrons( nullptr );
547 ATH_CHECK( evtStore()->retrieve( electrons, m_jp.ElectronLocation ) );
548 if (electrons->ownPolicy() != SG::VIEW_ELEMENTS) {
549 lockLeptonDecorations (electrons);
550 }
551 for( const xAOD::Electron* electron : *electrons ) {
552 if (electrons->ownPolicy() == SG::VIEW_ELEMENTS) {
553 lockLeptonDecorations (electron->container());
554 }
555 if( electron->nTrackParticles() > 0 ) {
556 if (const xAOD::TrackParticle* trk = electron->trackParticle(0)) {
557 lockTrackDecorations( trk, onlySelection );
558 }
559 }
560 }
561
562 const xAOD::TrackParticleContainer* IDtracks ( nullptr );
563 ATH_CHECK( evtStore()->retrieve( IDtracks, m_jp.TrackLocation) );
564 for( const auto *trk : *IDtracks ) {
565 lockTrackDecorations( trk, onlySelection );
566 }
567
568 return StatusCode::SUCCESS;
569 }
570
571} // end of namespace bracket
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
Handle class for adding a decoration to an object.
#define ATLAS_THREAD_SAFE
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
const SG::AuxVectorData * container() const
Return the container holding this element.
Manage lookup of vectors of auxiliary data.
void lockDecoration(SG::auxid_t auxid)
Explicitly lock a decoration.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
SG::AuxElement::Decorator< std::vector< std::vector< float > > > IPDecoratorType
StatusCode associateNonSelectedTracks(std::vector< WrkVrt > *)
in addition to selected tracks, associate as much tracks as possible
VrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
std::map< std::string, PatternStrategyFunc > m_patternStrategyFuncs
bool checkTrackHitPatternToVertex(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
bool checkTrackHitPatternToVertexByExtrapolationAssist(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
bool checkTrackHitPatternToVertexByExtrapolation(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
Condition service.
StatusCode mergeFinalVertices(std::vector< WrkVrt > *)
attempt to merge vertices by lookng at the distance between two vertices
StatusCode refitAndSelectGoodQualityVertices(std::vector< WrkVrt > *)
finalization of the vertex and store to xAOD::VertexContainer
void lockTrackDecorations(const xAOD::TrackParticle *trk, bool onlySelection) const
lock decorations at the end of the algorithm
std::map< unsigned, SG::Decorator< float > > m_trkDecors
void lockLeptonDecorations(const SG::AuxVectorData *cont) const
StatusCode reassembleVertices(std::vector< WrkVrt > *)
attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact param...
std::unique_ptr< NtupleVars > m_ntupleVars
StatusCode rearrangeTracks(std::vector< WrkVrt > *)
ToolHandle< IInDetConditionsTool > m_sctCondSummaryTool
ToolHandle< Trk::IVertexMapper > m_vertexMapper
StatusCode extractIncompatibleTrackPairs(std::vector< WrkVrt > *)
related to the graph method and verte finding
bool checkTrackHitPatternToVertexOuterOnly(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
std::optional< SG::Decorator< char > > m_decor_isSelected
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
std::map< std::string, TH1 * > m_hists
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read/Write Handle Keys.
StatusCode findNtrackVertices(std::vector< WrkVrt > *)
StatusCode monitorVertexingAlgorithmStep(std::vector< WrkVrt > *, const std::string &name, bool final=false)
monitor the intermediate status of vertexing
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final
std::optional< VertexELType > m_decor_svLink
const AtlasDetectorID * m_atlasId
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
get a handle on the Track to Vertex tool
std::vector< IPDecoratorType > m_ipDecors
const xAOD::VertexContainer * m_primaryVertices
std::vector< const xAOD::TrackParticle * > m_associatedTracks
ToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc
std::vector< const xAOD::TrackParticle * > m_selectedTracks
StatusCode mergeByShuffling(std::vector< WrkVrt > *)
attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior ...
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
~VrtSecInclusive()
Default Destructor.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_vertexingStatusKey
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
std::optional< SG::Decorator< char > > m_decor_isAssociated
std::vector< TrackSelectionAlg > m_trackSelectionAlgs
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
STL namespace.
std::size_t erase_if(T_container &container, T_Func pred)
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".