ATLAS Offline Software
Loading...
Searching...
No Matches
VrtSecInclusive.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// VKalVrt.h
6//
7#ifndef VRTSECINCLUSIVE_VRTSECINCLUSIVE_H
8#define VRTSECINCLUSIVE_VRTSECINCLUSIVE_H
9
10
11#include "VrtSecInclusive/Constants.h"
12
15
16// Gaudi includes
17#include "GaudiKernel/ToolHandle.h"
18#include "GaudiKernel/ITHistSvc.h"
19//
21
22// for truth
24
32#include "GaudiKernel/ServiceHandle.h"
36
37// xAOD Classes
48#include "xAODMuon/Muon.h"
50#include "xAODEgamma/Electron.h"
51
52// Normal STL and physical vectors
53#include <vector>
54#include <deque>
55#include <functional>
56#include <optional>
57#include <map>
58#include <cstdint> //for uint8_t
59
60
62
63class TH1;
64
65namespace Trk {
66 class ITruthToTrack;
67 class ITrackToVertex;
69 class IExtrapolator;
70 class IVertexMapper;
71 struct MappedVertex;
72}
73
74namespace VKalVrtAthena {
75
76 namespace GeoModel { enum GeoModel { Run1=1, Run2=2 }; }
77
78 class IntersectionPos;
81
82 class NtupleVars;
83}
84
85
86namespace VKalVrtAthena {
87
89 public:
91 VrtSecInclusive(const std::string& name, ISvcLocator* pSvcLocator);
92
94 virtual ~VrtSecInclusive() override;
95
96 virtual StatusCode initialize() override;
97 virtual StatusCode execute() override;
98 virtual StatusCode initEvent();
99
100 private:
101 StatusCode defineDummyCollections(const EventContext& ctx);
102 StatusCode dummyVertexContainer(const EventContext& ctx,
105 //
106 // Member Variables
107 //
108
109 // JO: GeoModel
110 Gaudi::Property<int> m_geoModel{this, "GeoModel", VKalVrtAthena::GeoModel::Run2};
111
112 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrackLocation{this, "TrackLocation", "InDetTrackParticles"};
115 SG::ReadHandleKey<xAOD::VertexContainer> m_PrimVrtLocation{this, "PrimVrtLocation", "PrimaryVertices"};
116 Gaudi::Property<std::string> m_truthParticleContainerName{this, "McParticleContainer", "TruthParticles"};
117 Gaudi::Property<std::string> m_mcEventContainerName{this, "MCEventContainer", "TruthEvents"};
118 Gaudi::Property<std::string> m_augVerString{this, "AugmentingVersionString", "_VSI"};
119 Gaudi::Property<std::string> m_truthParticleFilter{this, "TruthParticleFilter", "Rhadron"};// Either "", "Kshort", "Rhadron", "HNL", "HadInt", "Bhadron"
120
121 Gaudi::Property<std::string> m_all2trksVerticesContainerName{this, "All2trkVerticesContainerName", "All2TrksVertices"};
122 Gaudi::Property<std::string> m_secondaryVerticesContainerName{this, "SecondaryVerticesContainerName", "SecondaryVertices"};
123
124 // common feature flags
125 Gaudi::Property<bool> m_doTruth{this, "DoTruth", false};
126 Gaudi::Property<bool> m_FillHist{this, "FillHist", false};
127 Gaudi::Property<bool> m_FillNtuple{this, "FillNtuple", false};
128 Gaudi::Property<bool> m_FillIntermediateVertices{this, "FillIntermediateVertices", false};
129 Gaudi::Property<bool> m_doIntersectionPos{this, "DoIntersectionPos", false};
130 Gaudi::Property<bool> m_doMapToLocal{this, "DoMapToLocal", false};
131 Gaudi::Property<bool> m_extrapPV{this, "ExtrapPV", false}; //extrapolate reco and prim truth trks to PV (for testing only)
132
133 Gaudi::Property<bool> m_passThroughTrackSelection{this, "PassThroughTrackSelection", false };
134
135 Gaudi::Property<bool> m_doFastMode{this, "DoFastMode", false}; // flag for running in rapid finder mode instead of using graph
136
137 // track selection conditions
138 Gaudi::Property<unsigned int> m_SelTrkMaxCutoff{this, "SelTrkMaxCutoff", 50}; // max number of tracks
139 Gaudi::Property<bool> m_SAloneTRT{this, "DoSAloneTRT", false}; // SAlone = "standalone"
140
141 /* impact parameters */
142 Gaudi::Property<bool> m_do_PVvetoCut{this, "do_PVvetoCut", true};
143 Gaudi::Property<bool> m_do_d0Cut{this, "do_d0Cut", true};
144 Gaudi::Property<bool> m_do_z0Cut{this, "do_z0Cut", true};
145 Gaudi::Property<bool> m_do_d0errCut{this, "do_d0errCut", false};
146 Gaudi::Property<bool> m_do_z0errCut{this, "do_z0errCut", false};
147 Gaudi::Property<bool> m_do_d0signifCut{this, "do_d0signifCut", false};
148 Gaudi::Property<bool> m_do_z0signifCut{this, "do_z0signifCut", false};
149
150 Gaudi::Property<bool> m_ImpactWrtBL{this, "ImpactWrtBL", true}; // false option is going to be deprecated
151 Gaudi::Property<double> m_d0TrkPVDstMinCut{this, "a0TrkPVDstMinCut", 0. }; // in [mm]
152 Gaudi::Property<double> m_d0TrkPVDstMaxCut{this, "a0TrkPVDstMaxCut", 1000.}; // in [mm]
153 Gaudi::Property<double> m_d0TrkPVSignifCut{this, "a0TrkPVSignifCut", 0.}; // in [mm]
154 Gaudi::Property<double> m_z0TrkPVDstMinCut{this, "zTrkPVDstMinCut", 0.}; // in [mm]
155 Gaudi::Property<double> m_z0TrkPVDstMaxCut{this, "zTrkPVDstMaxCut", 1000.}; // in [mm]
156 Gaudi::Property<double> m_z0TrkPVSignifCut{this, "zTrkPVSignifCut", 0.}; // in unit of sigma
157 Gaudi::Property<double> m_d0TrkErrorCut{this, "TrkA0ErrCut", 10000}; // in [mm]
158 Gaudi::Property<double> m_z0TrkErrorCut{this, "TrkZErrCut", 20000}; // in [mm]
159 Gaudi::Property<double> m_twoTrkVtxFormingD0Cut{this, "twoTrkVtxFormingD0Cut", 1.}; // in [mm]
160
161 /* pT anc chi2 */
162 Gaudi::Property<double> m_TrkChi2Cut{this, "TrkChi2Cut", 3.}; // in terms of chi2 / ndof
163 Gaudi::Property<double> m_TrkPtCut{this, "TrkPtCut", 1000.}; // low pT threshold. in [MeV]
164
165 /* hit requirements */
166 Gaudi::Property<bool> m_doTRTPixCut{this, "doTRTPixCut", false, "mode for R-hadron displaced vertex"}; // Kazuki
167 Gaudi::Property<int> m_CutSctHits{this, "CutSctHits", 0};
168 Gaudi::Property<int> m_CutPixelHits{this, "CutPixelHits", 0};
169 Gaudi::Property<int> m_CutSiHits{this, "CutSiHits", 0};
170 Gaudi::Property<int> m_CutBLayHits{this, "CutBLayHits", 0};
171 Gaudi::Property<int> m_CutSharedHits{this, "CutSharedHits", 0};
172 Gaudi::Property<int> m_CutTRTHits{this, "CutTRTHits", 0}; // Kazuki
173 Gaudi::Property<int> m_CutTightSCTHits{this, "CutTightSCTHits", 7};
174 Gaudi::Property<int> m_CutTightTRTHits{this, "CutTightTRTHits", 20};
175
176 /* track extrpolator{this, }; 1==VKalGetImpact, 2==m_trackToVertexTool*/
177 Gaudi::Property<int> m_trkExtrapolator{this, "TrkExtrapolator", 2};
178
179 // Vertex reconstruction
180 Gaudi::Property<bool> m_doPVcompatibilityCut{this, "DoPVcompatibility", true};
181 Gaudi::Property<bool> m_doTightPVcompatibilityCut{this, "DoTightPVcompatibility", false};
182 Gaudi::Property<bool> m_removeFakeVrt{this, "RemoveFake2TrkVrt", true};
183 Gaudi::Property<bool> m_removeFakeVrtLate{this, "DoDelayedFakeReject", false};
184 Gaudi::Property<bool> m_doReassembleVertices{this, "doReassembleVertices", false};
185 Gaudi::Property<bool> m_doMergeByShuffling{this, "doMergeByShuffling", false};
186 Gaudi::Property<bool> m_doSuggestedRefitOnMerging{this, "doSuggestedRefitOnMerging", true};
187 Gaudi::Property<bool> m_doMagnetMerging{this, "doMagnetMerging", true}; // sub-option of doMergeByShuffling-2
188 Gaudi::Property<bool> m_doWildMerging{this, "doWildMerging", true}; // sub-option of doMergeByShuffling-3
189 Gaudi::Property<bool> m_doMergeFinalVerticesDistance{this, "doMergeFinalVerticesDistance", false}; // Kazuki
190 Gaudi::Property<bool> m_doAssociateNonSelectedTracks{this, "doAssociateNonSelectedTracks", false};
191 Gaudi::Property<bool> m_doFinalImproveChi2{this, "doFinalImproveChi2", false};
192 Gaudi::Property<double> m_pvCompatibilityCut{this, "PVcompatibilityCut", -20.}; // in [mm]
193 Gaudi::Property<double> m_SelVrtChi2Cut{this, "SelVrtChi2Cut", 4.5}; // in terms of chi2 / ndof
194 Gaudi::Property<double> m_VertexMergeFinalDistCut{this, "VertexMergeFinalDistCut", 1.}; // in [mm] // Kazuki
195 Gaudi::Property<double> m_VertexMergeFinalDistScaling{this, "VertexMergeFinalDistScaling", 0.}; // in [1/mm]
196 Gaudi::Property<double> m_VertexMergeCut{this, "VertexMergeCut", 3};
197 Gaudi::Property<double> m_TrackDetachCut{this, "TrackDetachCut", 6};
198
199 Gaudi::Property<bool> m_doTwoTrSoftBtag{this, "DoTwoTrSoftBtag", false};
200 Gaudi::Property<double> m_twoTrVrtAngleCut{this, "TwoTrVrtAngleCut", -10};
201 Gaudi::Property<double> m_twoTrVrtMinDistFromPV{this, "TwoTrVrtMinDistFromPVCut", 0.};
202
203 // When truncateWrkVertices set to true, maxWrkVertices is the maximum
204 // number of potential vertices to process, used to truncate the list
205 // in rare caes where several thousands are found, to avoid algorithm
206 // timeout issues
207 Gaudi::Property<bool> m_truncateWrkVertices{this, "TruncateListOfWorkingVertices", true};
208 Gaudi::Property<size_t> m_maxWrkVertices{this, "MaxNumberOfWorkingVertices", 1500};
209
210 Gaudi::Property<double> m_associateMinDistanceToPV{this, "associateMinDistanceToPV", 0.5};
211 Gaudi::Property<double> m_associateMaxD0Signif{this, "associateMaxD0Signif", 5.}; // wrt. DV in unit of sigma
212 Gaudi::Property<double> m_associateMaxZ0Signif{this, "associateMaxZ0Signif", 5.}; // wrt. DV in unit of sigma
213 Gaudi::Property<double> m_associatePtCut{this, "associatePtCut", 0.}; // in [MeV]
214 Gaudi::Property<double> m_associateChi2Cut{this, "associateChi2Cut", 20.};
215
216 Gaudi::Property<double> m_reassembleMaxImpactParameterD0{this, "reassembleMaxImpactParameterD0", 1.}; // wrt. DV in [mm]
217 Gaudi::Property<double> m_reassembleMaxImpactParameterZ0{this, "reassembleMaxImpactParameterZ0", 5.}; // wrt. DV in [mm]
218 Gaudi::Property<double> m_mergeByShufflingMaxSignificance{this, "mergeByShufflingMaxSignificance", 100.}; // in unit of sigma
219 Gaudi::Property<double> m_mergeByShufflingAllowance{this, "mergeByShufflingAllowance", 4.}; // in unit of sigma
220
221 Gaudi::Property<double> m_improveChi2ProbThreshold{this, "improveChi2ProbThreshold", 1.e-4};
222
223 // vertexing using muons (test implementation)
224 Gaudi::Property<bool> m_doSelectTracksFromMuons{this, "doSelectTracksFromMuons", false};
225 Gaudi::Property<bool> m_doRemoveCaloTaggedMuons{this, "doRemoveCaloTaggedMuons", false};
226 Gaudi::Property<bool> m_doSelectTracksFromElectrons{this, "doSelectTracksFromElectrons", false};
227 Gaudi::Property<bool> m_doSelectIDAndGSFTracks{this, "doSelectIDAndGSFTracks", false};
228 Gaudi::Property<bool> m_doRemoveNonLeptonVertices{this, "doRemoveNonLeptonVertices", false};
229
230 // vertexing using disapperaing track
231 Gaudi::Property<bool> m_doDisappearingTrackVertexing{this, "doDisappearingTrackVertexing", false};
232 Gaudi::Property<double> m_twoTrVrtMaxPerigeeDist{this, "twoTrVrtMaxPerigeeDist", 50}; // in [mm]
233 Gaudi::Property<double> m_twoTrVrtMinRadius{this, "twoTrVrtMinRadius", 50}; // in [mm]
234
235 // When doSelectTracksWithLRTCuts is set to true, the addtional track cuts
236 // be applied to the selected tracks to reduce the number of fake tracks in
237 // the selected track collected. These cuts are inspired by the improvments that
238 // were implmented for LRT Run 3.
239 Gaudi::Property<bool> m_doSelectTracksWithLRTCuts {this, "doSelectTracksWithLRTCuts", false};
240
241 // Additional dressing option
242 Gaudi::Property<bool> m_doAugmentDVimpactParametersToMuons{this, "doAugmentDVimpactParametersToMuons", false}; // potentially useful for DV + muon search
243 Gaudi::Property<bool> m_doAugmentDVimpactParametersToElectrons{this, "doAugmentDVimpactParametersToElectrons", false}; // potentially useful for analyses involving electrons
244
245 // MC truth
246 Gaudi::Property<double> m_mcTrkResolution{this, "MCTrackResolution", 0.06}; // see getTruth for explanation
247 Gaudi::Property<double> m_TruthTrkLen{this, "TruthTrkLen", 1000}; // in [mm]
248
249 // Indicates give-up modes during vertexing
250 // 0 if no errors occured
251 // 1 if too few selected tracks
252 // 2 if too many selected tracks
253 // 3 if wrkVertices container is truncated
254 // 4 if any uncaught exception is raised at the top level of VSI execute()
256
257 // xAOD Accessors
260 std::vector<const xAOD::TrackParticle*> m_selectedTracks;
261 std::vector<const xAOD::TrackParticle*> m_associatedTracks;
262 std::vector<const xAOD::TrackParticle*> m_leptonicTracks;
263 std::vector<double> m_BeamPosition;
264
266 //
267 // Athena JobOption Properties
268 //
269
270 ToolHandle <Trk::ITrkVKalVrtFitter> m_fitSvc{this, "VertexFitterTool", "Trk::TrkVKalVrtFitter", " Private TrkVKalVrtFitter"}; // VKalVrtFitter tool
271 PublicToolHandle <Trk::ITruthToTrack> m_truthToTrack{this, "TruthToTrack", "Trk::TruthToTrack/InDetTruthToTrack"}; // tool to create trkParam from genPart
272
274 PublicToolHandle< Reco::ITrackToVertex > m_trackToVertexTool{this, "TrackToVertexTool", "Reco::TrackToVertex"};
275 PublicToolHandle<Trk::ITrackToVertexIPEstimator> m_trackToVertexIPEstimatorTool{this, "TrackToVertexIPEstimatorTool", "Trk::TrackToVertexIPEstimator/TrackToVertexIPEstimator"};
276 PublicToolHandle<Trk::IExtrapolator> m_extrapolator{this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"};
277 PublicToolHandle<Trk::IVertexMapper> m_vertexMapper{this, "VertexMapper", ""};
278
280 ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"};
281 ToolHandle<IInDetConditionsTool> m_sctCondSummaryTool{this, "InDetSCT_ConditionsSummaryTool", "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool", "Tool to retrieve SCT conditions summary"};
282
285 const SCT_ID* m_sctId{};
286
287 Gaudi::Property<std::string> m_checkPatternStrategy{this, "CheckHitPatternStrategy", "Classical", "Either Classical or Extrapolation"};
288 using PatternStrategyFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle *trk, const Amg::Vector3D& vertex );
289 std::map<std::string, PatternStrategyFunc> m_patternStrategyFuncs;
290
291 // AuxElement decorators
292 std::optional< SG::Decorator< char > > m_decor_isSelected;
293 std::optional< SG::Decorator< char > > m_decor_isAssociated;
294 std::optional< SG::Decorator< char > > m_decor_is_svtrk_final;
295 std::map< unsigned, SG::Decorator<float> > m_trkDecors;
296
298 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{this,"EventInfoKey", "EventInfo", "EventInfo name"};
299 SG::WriteHandleKey<xAOD::VertexContainer> m_vertexKey {this, "VertexKey", "", "Vertex key"};
300 SG::WriteHandleKey<xAOD::VertexContainer> m_twoTrksVertexKey {this, "TwoTracksVertexKey", "", "Two Tracks Vertex key"};
301 std::map<std::string, SG::WriteHandleKey<xAOD::VertexContainer>> m_intermediateVertexKey;
302
304
306 std::vector< IPDecoratorType > m_ipDecors;
307
309 std::optional< VertexELType > m_decor_svLink;
310
312 //
313 // define ntuple variables here
314 //
315
316 // The standard AANT, CollectionTree, is bare bones
317 TTree *m_tree_Vert{};
318 std::unique_ptr<NtupleVars> m_ntupleVars;
319
320 // Histograms for stats
321 std::map<std::string, TH1*> m_hists;
322
323
325 //
326 // Private member functions
327 //
328
329 // for event info to new ntuple (used to go by default in CollectionTree)
331
332 StatusCode addEventInfo();
333 StatusCode setupNtupleVariables();
334 StatusCode setupNtuple();
335 StatusCode clearNtupleVariables();
336 StatusCode deleteNtupleVariables();
337 StatusCode processPrimaryVertices();
338 StatusCode fillAANT_SelectedBaseTracks();
340
341 //
342 struct WrkVrt {
343 bool isGood = false;
344 std::deque<long int> selectedTrackIndices;
345 std::deque<long int> associatedTrackIndices;
347 TLorentzVector vertexMom;
348 std::vector<double> vertexCov;
349 double Chi2 = 0;
350 double Chi2_core = 0;
351 std::vector<double> Chi2PerTrk;
352 long int Charge = 0;
353 std::vector< std::vector<double> > TrkAtVrt;
354 unsigned long closestWrkVrtIndex = 0;
356
357 inline double ndof() const { return 2.0*( selectedTrackIndices.size() + associatedTrackIndices.size() ) - 3.0; }
358 inline double ndof_core() const { return 2.0*( selectedTrackIndices.size() ) - 3.0; }
359 inline unsigned nTracksTotal() const { return selectedTrackIndices.size() + associatedTrackIndices.size(); }
360 inline double fitQuality() const { return Chi2 / ndof(); }
361 };
362
363
364 using Detector = int;
365 using Bec = int;
366 using Layer = int;
367 using Flag = int;
368 using ExtrapolatedPoint = std::tuple<const TVector3, Detector, Bec, Layer, Flag>;
369 using ExtrapolatedPattern = std::vector< ExtrapolatedPoint >;
370 using PatternBank = std::map<const xAOD::TrackParticle*, std::pair< std::unique_ptr<ExtrapolatedPattern>, std::unique_ptr<ExtrapolatedPattern> > >;
371
373
374 std::vector< std::pair<int, int> > m_incomp;
375
376 // the map used by printWrkSet
377 std::map<const xAOD::TruthVertex*, bool> m_matchMap;
378
383
385 void selectTrack( const xAOD::TrackParticle* );
386 StatusCode selectTracksInDet(const EventContext& ctx);
387 StatusCode selectTracksFromMuons(const EventContext& ctx);
388 StatusCode selectTracksFromElectrons(const EventContext& ctx);
389 StatusCode selectInDetAndGSFTracks(const EventContext& ctx);
390
391 using TrackSelectionAlg = StatusCode (VrtSecInclusive::*)(const EventContext&);
392 std::vector<TrackSelectionAlg> m_trackSelectionAlgs;
393
395 using CutFunc = bool (VrtSecInclusive::*) ( const xAOD::TrackParticle* ) const;
396 std::vector<CutFunc> m_trackSelectionFuncs;
397
400 bool selectTrack_pTCut ( const xAOD::TrackParticle* ) const;
401 bool selectTrack_chi2Cut ( const xAOD::TrackParticle* ) const;
402 bool selectTrack_hitPattern ( const xAOD::TrackParticle* ) const;
404 bool selectTrack_d0Cut ( const xAOD::TrackParticle* ) const;
405 bool selectTrack_z0Cut ( const xAOD::TrackParticle* ) const;
406 bool selectTrack_d0errCut ( const xAOD::TrackParticle* ) const;
407 bool selectTrack_z0errCut ( const xAOD::TrackParticle* ) const;
408 static bool selectTrack_d0signifCut ( const xAOD::TrackParticle* ) ;
409 static bool selectTrack_z0signifCut ( const xAOD::TrackParticle* ) ;
410 bool selectTrack_LRTR3Cut ( const xAOD::TrackParticle* ) const;
411
413 StatusCode extractIncompatibleTrackPairs( const EventContext& ctx, std::vector<WrkVrt>* );
414 StatusCode findNtrackVertices( const EventContext& ctx, std::vector<WrkVrt>* );
415 StatusCode rearrangeTracks( const EventContext& ctx, std::vector<WrkVrt>* );
416
418 StatusCode reassembleVertices( const EventContext& ctx, std::vector<WrkVrt>* );
419
422 StatusCode mergeByShuffling( const EventContext& ctx, std::vector<WrkVrt>* );
423
425 StatusCode mergeFinalVertices( const EventContext& ctx, std::vector<WrkVrt>* ); // Kazuki
426
428 StatusCode associateNonSelectedTracks( const EventContext& ctx, std::vector<WrkVrt>* );
429
431 StatusCode refitAndSelectGoodQualityVertices( const EventContext& ctx, std::vector<WrkVrt>* );
432
434 bool getSVImpactParameters(const xAOD::TrackParticle* trk, const Amg::Vector3D& vertex, std::vector<double>& impactParameters, std::vector<double>& impactParErrors);
435
436 enum TrkParameter { k_d0=0, k_z0=1, k_theta=2, k_phi=3, k_qOverP=4 ,k_nTP=5 };
438
439 using vertexingAlg = StatusCode (VrtSecInclusive::*)( const EventContext&, std::vector<WrkVrt>* );
440 std::vector< std::pair<std::string, vertexingAlg> > m_vertexingAlgorithms;
442
443
445 //
446 // Supporting utility functions
447
449 void printWrkSet(const std::vector<WrkVrt> *WrkVrtSet, const std::string& name);
450
452 StatusCode refitVertex( WrkVrt& );
453 StatusCode refitVertex( WrkVrt&, Trk::IVKalState& istate );
454
456 StatusCode refitVertexWithSuggestion( WrkVrt&, const Amg::Vector3D& );
457 StatusCode refitVertexWithSuggestion( WrkVrt&, const Amg::Vector3D&, Trk::IVKalState& istate );
458
461 double improveVertexChi2( WrkVrt& );
462
463 static void removeTrackFromVertex(std::vector<WrkVrt>*,
464 std::vector< std::deque<long int> > *,
465 const long int & ,const long int & );
466
467 StatusCode disassembleVertex(std::vector<WrkVrt> *, const unsigned& vertexIndex );
468
469 void trackClassification(std::vector< WrkVrt >* , std::map< long int, std::vector<long int> >& );
470
471 double findWorstChi2ofMaximallySharedTrack(std::vector<WrkVrt>*, std::map< long int, std::vector<long int> >&, long int & ,long int & );
472
474 static size_t nTrkCommon( std::vector<WrkVrt> *WrkVrtSet, const std::pair<unsigned, unsigned>& pairIndex ) ;
475
477 double significanceBetweenVertices( const WrkVrt&, const WrkVrt& ) const;
478
480 double distanceBetweenVertices( const WrkVrt&, const WrkVrt& ) const;
481
482 using AlgForVerticesPair = double (VrtSecInclusive::*)( const WrkVrt&, const WrkVrt& ) const;
483
485 double findMinVerticesPair( std::vector<WrkVrt>*, std::pair<unsigned, unsigned>&, const AlgForVerticesPair& );
486
488 static double findMinVerticesNextPair( std::vector<WrkVrt>*, std::pair<unsigned, unsigned>& );
489
491 StatusCode mergeVertices( WrkVrt& destination, WrkVrt& source );
492
494
516
518 static void fillTrackSummary( track_summary& summary, const xAOD::TrackParticle *trk );
519
521
522 bool patternCheck ( const uint32_t& pattern, const Amg::Vector3D& vertex );
523 static bool patternCheckRun1( const uint32_t& pattern, const Amg::Vector3D& vertex );
524 static bool patternCheckRun2( const uint32_t& pattern, const Amg::Vector3D& vertex );
525
526 bool patternCheckOuterOnly ( const uint32_t& pattern, const Amg::Vector3D& vertex );
527 static bool patternCheckRun1OuterOnly( const uint32_t& pattern, const Amg::Vector3D& vertex );
528 static bool patternCheckRun2OuterOnly( const uint32_t& pattern, const Amg::Vector3D& vertex );
529
531 bool checkTrackHitPatternToVertex( const xAOD::TrackParticle *trk, const Amg::Vector3D& vertex );
532
535
538
541
543 bool passedFakeReject( const Amg::Vector3D& FitVertex, const xAOD::TrackParticle *itrk, const xAOD::TrackParticle *jtrk );
544
546 void removeInconsistentTracks( WrkVrt& );
547
548 template<class Track> void getIntersection(Track *trk, std::vector<IntersectionPos*>& layers, const Trk::Perigee* per);
549 template<class Track> void setIntersection(Track *trk, IntersectionPos *bec, const Trk::Perigee* per);
550
552 StatusCode monitorVertexingAlgorithmStep( const EventContext& ctx,
553 std::vector<WrkVrt>*, const std::string& name, bool final = false );
554
556 //
557 // Truth Information Algorithms Member Functions
558 //
559 //
560
562
563 StatusCode categorizeVertexTruthTopology( xAOD::Vertex *vertex );
564
566
567 std::vector<const xAOD::TruthVertex*> m_tracingTruthVertices;
568
570 //
571 // Additional augmentation
572 //
573 //
574
575 template<class LeptonFlavor>
576 StatusCode augmentDVimpactParametersToLeptons( const std::string& containerName );
577
579 void lockTrackDecorations( const xAOD::TrackParticle* trk, bool onlySelection ) const;
580 void lockLeptonDecorations( const SG::AuxVectorData* cont ) const;
581 StatusCode lockTrackDecorations( bool onlySelection, const EventContext& ctx ) const;
582
583 std::unordered_map<std::string, bool> m_vertexCollectionsDefinitions;
584 };
585
586} // end of namespace bracket
587
588
589 // This header file contains the definition of member templates
590#include "details/Utilities.h"
591
592
593#endif /* VRTSECINCLUSIVE_VRTSECINCLUSIVE_H */
Helper class to provide type-safe access to aux data.
Extrapolation for HepMC particles.
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the SCT subdetector.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:69
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:576
Manage lookup of vectors of auxiliary data.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Interface class for the extrapolation AlgTool, it inherits from IAlgTool Detailed information about p...
ITruthToTrack is an interface to create Trk::TrackParameters from a HepMC::GenParticle.
Interface class IVertexMapper.
Gaudi::Property< bool > m_doSelectIDAndGSFTracks
bool patternCheck(const uint32_t &pattern, const Amg::Vector3D &vertex)
Gaudi::Property< bool > m_doRemoveNonLeptonVertices
Gaudi::Property< bool > m_SAloneTRT
SG::AuxElement::Decorator< std::vector< std::vector< float > > > IPDecoratorType
Gaudi::Property< double > m_pvCompatibilityCut
VrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Gaudi::Property< double > m_associateChi2Cut
Gaudi::Property< double > m_d0TrkPVDstMinCut
bool selectTrack_pTCut(const xAOD::TrackParticle *) const
Gaudi::Property< bool > m_doWildMerging
Gaudi::Property< double > m_TrkPtCut
Gaudi::Property< double > m_d0TrkErrorCut
Gaudi::Property< double > m_TruthTrkLen
Gaudi::Property< bool > m_doTRTPixCut
std::map< std::string, PatternStrategyFunc > m_patternStrategyFuncs
static const xAOD::TruthParticle * getTrkGenParticle(const xAOD::TrackParticle *)
Definition TruthAlgs.cxx:26
Gaudi::Property< bool > m_do_d0Cut
Gaudi::Property< double > m_SelVrtChi2Cut
StatusCode refitVertexWithSuggestion(WrkVrt &, const Amg::Vector3D &)
refit the vertex with suggestion
Gaudi::Property< bool > m_do_z0errCut
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonLocation
bool passedFakeReject(const Amg::Vector3D &FitVertex, const xAOD::TrackParticle *itrk, const xAOD::TrackParticle *jtrk)
Flag false if the consistituent tracks are not consistent with the vertex position.
Gaudi::Property< int > m_trkExtrapolator
bool checkTrackHitPatternToVertex(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
static bool patternCheckRun1(const uint32_t &pattern, const Amg::Vector3D &vertex)
Gaudi::Property< int > m_CutSiHits
bool checkTrackHitPatternToVertexByExtrapolationAssist(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
Gaudi::Property< bool > m_doRemoveCaloTaggedMuons
Gaudi::Property< bool > m_do_d0errCut
void printWrkSet(const std::vector< WrkVrt > *WrkVrtSet, const std::string &name)
print the contents of reconstructed vertices
Gaudi::Property< bool > m_doMergeFinalVerticesDistance
Gaudi::Property< double > m_twoTrVrtMaxPerigeeDist
static bool patternCheckRun2(const uint32_t &pattern, const Amg::Vector3D &vertex)
bool checkTrackHitPatternToVertexByExtrapolation(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
Gaudi::Property< bool > m_doTightPVcompatibilityCut
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
Condition service.
SG::WriteHandleKey< xAOD::VertexContainer > m_vertexKey
Gaudi::Property< bool > m_doReassembleVertices
Gaudi::Property< int > m_CutBLayHits
Gaudi::Property< double > m_reassembleMaxImpactParameterZ0
bool selectTrack_chi2Cut(const xAOD::TrackParticle *) const
bool selectTrack_notPVassociated(const xAOD::TrackParticle *) const
track-by-track selection strategies
void lockTrackDecorations(const xAOD::TrackParticle *trk, bool onlySelection) const
lock decorations at the end of the algorithm
Gaudi::Property< double > m_mergeByShufflingAllowance
void trackClassification(std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &)
Gaudi::Property< bool > m_doPVcompatibilityCut
StatusCode selectTracksFromElectrons(const EventContext &ctx)
StatusCode selectTracksFromMuons(const EventContext &ctx)
std::map< unsigned, SG::Decorator< float > > m_trkDecors
Gaudi::Property< bool > m_do_PVvetoCut
ExtrapolatedPattern * extrapolatedPattern(const xAOD::TrackParticle *, enum Trk::PropDirection)
void selectTrack(const xAOD::TrackParticle *)
Vertexing Algorithm Member Functions.
void lockLeptonDecorations(const SG::AuxVectorData *cont) const
PublicToolHandle< Trk::IVertexMapper > m_vertexMapper
bool selectTrack_hitPatternTight(const xAOD::TrackParticle *) const
double findWorstChi2ofMaximallySharedTrack(std::vector< WrkVrt > *, std::map< long int, std::vector< long int > > &, long int &, long int &)
Gaudi::Property< bool > m_passThroughTrackSelection
Gaudi::Property< double > m_associateMaxD0Signif
static bool selectTrack_d0signifCut(const xAOD::TrackParticle *)
Gaudi::Property< double > m_z0TrkPVDstMaxCut
Gaudi::Property< unsigned int > m_SelTrkMaxCutoff
bool selectTrack_d0errCut(const xAOD::TrackParticle *) const
Gaudi::Property< bool > m_doMergeByShuffling
std::unique_ptr< NtupleVars > m_ntupleVars
Gaudi::Property< bool > m_doFastMode
Gaudi::Property< bool > m_doIntersectionPos
static bool patternCheckRun1OuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)
Gaudi::Property< bool > m_truncateWrkVertices
Gaudi::Property< std::string > m_truthParticleFilter
Gaudi::Property< double > m_associateMinDistanceToPV
bool getSVImpactParameters(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex, std::vector< double > &impactParameters, std::vector< double > &impactParErrors)
get secondary vertex impact parameters
Gaudi::Property< int > m_CutTightTRTHits
StatusCode categorizeVertexTruthTopology(xAOD::Vertex *vertex)
Definition TruthAlgs.cxx:44
Gaudi::Property< std::string > m_mcEventContainerName
SG::ReadHandleKey< xAOD::ElectronContainer > m_ElectronLocation
std::unordered_map< std::string, bool > m_vertexCollectionsDefinitions
void removeInconsistentTracks(WrkVrt &)
Remove inconsistent tracks from vertices.
Gaudi::Property< bool > m_doSuggestedRefitOnMerging
Gaudi::Property< double > m_twoTrVrtMinDistFromPV
ToolHandle< IInDetConditionsTool > m_sctCondSummaryTool
bool selectTrack_hitPattern(const xAOD::TrackParticle *) const
StatusCode associateNonSelectedTracks(const EventContext &ctx, std::vector< WrkVrt > *)
in addition to selected tracks, associate as much tracks as possible
Gaudi::Property< int > m_geoModel
PublicToolHandle< Trk::ITruthToTrack > m_truthToTrack
Gaudi::Property< bool > m_doSelectTracksWithLRTCuts
Gaudi::Property< bool > m_do_z0Cut
Gaudi::Property< double > m_twoTrVrtMinRadius
Gaudi::Property< double > m_VertexMergeFinalDistCut
Gaudi::Property< bool > m_doSelectTracksFromElectrons
Gaudi::Property< double > m_associatePtCut
Gaudi::Property< std::string > m_all2trksVerticesContainerName
Gaudi::Property< bool > m_FillHist
bool checkTrackHitPatternToVertexOuterOnly(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
Gaudi::Property< double > m_associateMaxZ0Signif
std::vector< CutFunc > m_trackSelectionFuncs
Gaudi::Property< double > m_TrackDetachCut
std::optional< SG::Decorator< char > > m_decor_isSelected
void getIntersection(Track *trk, std::vector< IntersectionPos * > &layers, const Trk::Perigee *per)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackLocation
StatusCode(VrtSecInclusive::*)(const EventContext &) TrackSelectionAlg
Gaudi::Property< bool > m_ImpactWrtBL
Gaudi::Property< double > m_z0TrkErrorCut
std::map< std::string, TH1 * > m_hists
static void fillTrackSummary(track_summary &summary, const xAOD::TrackParticle *trk)
retrieve the track hit information
double improveVertexChi2(WrkVrt &)
attempt to improve the vertex chi2 by removing the most-outlier track one by one until the vertex chi...
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read/Write Handle Keys.
Gaudi::Property< std::string > m_secondaryVerticesContainerName
double distanceBetweenVertices(const WrkVrt &, const WrkVrt &) const
calculate the physical distance
StatusCode(VrtSecInclusive::*)(const EventContext &, std::vector< WrkVrt > *) vertexingAlg
StatusCode reassembleVertices(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact param...
StatusCode mergeFinalVertices(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge vertices by lookng at the distance between two vertices
Gaudi::Property< int > m_CutSharedHits
static size_t nTrkCommon(std::vector< WrkVrt > *WrkVrtSet, const std::pair< unsigned, unsigned > &pairIndex)
returns the number of tracks commonly present in both vertices
static double findMinVerticesNextPair(std::vector< WrkVrt > *, std::pair< unsigned, unsigned > &)
returns the next pair of vertices that give next-to-minimum distance significance
std::tuple< const TVector3, Detector, Bec, Layer, Flag > ExtrapolatedPoint
Gaudi::Property< bool > m_FillNtuple
bool(VrtSecInclusive::*)(const xAOD::TrackParticle *) const CutFunc
track selection
bool selectTrack_LRTR3Cut(const xAOD::TrackParticle *) const
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final
double findMinVerticesPair(std::vector< WrkVrt > *, std::pair< unsigned, unsigned > &, const AlgForVerticesPair &)
returns the pair of vertices that give minimum in terms of some observable (e.g.
std::optional< VertexELType > m_decor_svLink
Gaudi::Property< bool > m_doFinalImproveChi2
std::map< const xAOD::TrackParticle *, std::pair< std::unique_ptr< ExtrapolatedPattern >, std::unique_ptr< ExtrapolatedPattern > > > PatternBank
Gaudi::Property< double > m_TrkChi2Cut
const AtlasDetectorID * m_atlasId
Gaudi::Property< bool > m_doMagnetMerging
Gaudi::Property< double > m_VertexMergeFinalDistScaling
virtual StatusCode execute() override
Gaudi::Property< std::string > m_checkPatternStrategy
static void removeTrackFromVertex(std::vector< WrkVrt > *, std::vector< std::deque< long int > > *, const long int &, const long int &)
virtual StatusCode initialize() override
Gaudi::Property< double > m_twoTrkVtxFormingD0Cut
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
bool selectTrack_d0Cut(const xAOD::TrackParticle *) const
Gaudi::Property< double > m_improveChi2ProbThreshold
Gaudi::Property< int > m_CutTRTHits
StatusCode defineDummyCollections(const EventContext &ctx)
bool selectTrack_z0Cut(const xAOD::TrackParticle *) const
std::vector< double > m_BeamPosition
SG::AuxElement::Decorator< std::vector< ElementLink< xAOD::VertexContainer > > > VertexELType
std::vector< IPDecoratorType > m_ipDecors
StatusCode refitAndSelectGoodQualityVertices(const EventContext &ctx, std::vector< WrkVrt > *)
finalization of the vertex and store to xAOD::VertexContainer
Gaudi::Property< bool > m_doTwoTrSoftBtag
std::vector< ExtrapolatedPoint > ExtrapolatedPattern
const xAOD::VertexContainer * m_primaryVertices
StatusCode mergeVertices(WrkVrt &destination, WrkVrt &source)
the 2nd vertex is merged into the 1st vertex.
Gaudi::Property< double > m_mergeByShufflingMaxSignificance
Gaudi::Property< int > m_CutSctHits
Gaudi::Property< double > m_d0TrkPVDstMaxCut
std::vector< const xAOD::TrackParticle * > m_associatedTracks
bool selectTrack_z0errCut(const xAOD::TrackParticle *) const
PublicToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
get a handle on the Track to Vertex tool
ToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc
Gaudi::Property< double > m_z0TrkPVSignifCut
SG::ReadHandleKey< xAOD::VertexContainer > m_PrimVrtLocation
std::vector< const xAOD::TrackParticle * > m_selectedTracks
Gaudi::Property< size_t > m_maxWrkVertices
StatusCode rearrangeTracks(const EventContext &ctx, std::vector< WrkVrt > *)
StatusCode disassembleVertex(std::vector< WrkVrt > *, const unsigned &vertexIndex)
StatusCode fillAANT_SecondaryVertices(xAOD::VertexContainer *)
Gaudi::Property< bool > m_doMapToLocal
Gaudi::Property< int > m_CutPixelHits
StatusCode dummyVertexContainer(const EventContext &ctx, const SG::WriteHandleKey< xAOD::VertexContainer > &handleKey)
double(VrtSecInclusive::*)(const WrkVrt &, const WrkVrt &) const AlgForVerticesPair
Gaudi::Property< double > m_d0TrkPVSignifCut
bool patternCheckOuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)
Gaudi::Property< bool > m_removeFakeVrtLate
Gaudi::Property< double > m_reassembleMaxImpactParameterD0
Gaudi::Property< std::string > m_truthParticleContainerName
static bool selectTrack_z0signifCut(const xAOD::TrackParticle *)
Gaudi::Property< bool > m_removeFakeVrt
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
Gaudi::Property< std::string > m_augVerString
PublicToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
Gaudi::Property< bool > m_doDisappearingTrackVertexing
struct VKalVrtAthena::VrtSecInclusive::track_summary_properties track_summary
SG::WriteDecorHandleKey< xAOD::EventInfo > m_vertexingStatusKey
void setIntersection(Track *trk, IntersectionPos *bec, const Trk::Perigee *per)
StatusCode selectTracksInDet(const EventContext &ctx)
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
StatusCode monitorVertexingAlgorithmStep(const EventContext &ctx, std::vector< WrkVrt > *, const std::string &name, bool final=false)
monitor the intermediate status of vertexing
Gaudi::Property< bool > m_doAssociateNonSelectedTracks
Gaudi::Property< double > m_VertexMergeCut
std::vector< std::pair< int, int > > m_incomp
static bool patternCheckRun2OuterOnly(const uint32_t &pattern, const Amg::Vector3D &vertex)
Gaudi::Property< bool > m_FillIntermediateVertices
virtual ~VrtSecInclusive() override
Default Destructor.
StatusCode mergeByShuffling(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior ...
std::map< std::string, SG::WriteHandleKey< xAOD::VertexContainer > > m_intermediateVertexKey
Gaudi::Property< bool > m_doAugmentDVimpactParametersToElectrons
std::optional< SG::Decorator< char > > m_decor_isAssociated
std::vector< const xAOD::TruthVertex * > m_tracingTruthVertices
Gaudi::Property< double > m_z0TrkPVDstMinCut
StatusCode extractIncompatibleTrackPairs(const EventContext &ctx, std::vector< WrkVrt > *)
related to the graph method and verte finding
Gaudi::Property< bool > m_extrapPV
Gaudi::Property< bool > m_doTruth
SG::WriteHandleKey< xAOD::VertexContainer > m_twoTrksVertexKey
Gaudi::Property< bool > m_do_z0signifCut
StatusCode findNtrackVertices(const EventContext &ctx, std::vector< WrkVrt > *)
Gaudi::Property< int > m_CutTightSCTHits
bool(VrtSecInclusive::*)(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex) PatternStrategyFunc
Gaudi::Property< bool > m_doSelectTracksFromMuons
Gaudi::Property< double > m_twoTrVrtAngleCut
StatusCode selectInDetAndGSFTracks(const EventContext &ctx)
Gaudi::Property< bool > m_doAugmentDVimpactParametersToMuons
Gaudi::Property< bool > m_do_d0signifCut
Gaudi::Property< double > m_mcTrkResolution
double significanceBetweenVertices(const WrkVrt &, const WrkVrt &) const
calculate the significance (Mahalanobis distance) between two reconstructed vertices
std::vector< TrackSelectionAlg > m_trackSelectionAlgs
std::map< const xAOD::TruthVertex *, bool > m_matchMap
Eigen::Matrix< double, 3, 1 > Vector3D
USAGE: openCoraCool.exe "COOLONL_SCT/COMP200".
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
double Chi2
VKalVrt fit covariance.
std::vector< double > vertexCov
VKalVrt fit vertex 4-momentum.
std::vector< double > Chi2PerTrk
VKalVrt fit chi2 result.
std::deque< long int > selectedTrackIndices
flagged true for good vertex candidates
std::deque< long int > associatedTrackIndices
list if indices in TrackParticleContainer for selectedBaseTracks
long int Charge
list of VKalVrt fit chi2 for each track
double Chi2_core
VKalVrt fit chi2 result.
Amg::Vector3D vertex
list if indices in TrackParticleContainer for associatedTracks
TLorentzVector vertexMom
VKalVrt fit vertex position.
double closestWrkVrtValue
stores the index of the closest WrkVrt in std::vector<WrkVrt>
double ndof() const
stores the value of some observable to the closest WrkVrt ( observable = e.g. significance )
std::vector< std::vector< double > > TrkAtVrt
total charge of the vertex
unsigned long closestWrkVrtIndex
list of track parameters wrt the reconstructed vertex