ATLAS Offline Software
Loading...
Searching...
No Matches
TrigVrtSecInclusive.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TRIGTOOLS_TRIGVRTSECINCLUSIVE_H
5#define TRIGTOOLS_TRIGVRTSECINCLUSIVE_H
6
9
15
16#include "Gaudi/Property.h"
19
20#include <TH3D.h>
21#include <TMatrixT.h>
22
23#include <vector>
24#include <deque>
25#include <iostream>
26
27namespace TrigVSI {
28
34
35
37{
38public:
39 TrigVrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator);
40 virtual ~TrigVrtSecInclusive();
41
42 virtual StatusCode initialize() override;
43 virtual StatusCode execute(const EventContext& ctx) const override;
44 virtual StatusCode finalize() override;
45
46private:
47
48 using xAODContainers = std::pair< std::unique_ptr<xAOD::VertexContainer>, std::unique_ptr<xAOD::VertexAuxContainer> >;
49
50 // Properties
51 Gaudi::Property<int> m_vtxAlgorithm{this, "vtxAlgorithm", 0, "Vertexing algorithm. 0 : TrigVSI algorithm, 1 : Offline VSI like algorithm"};
52
53 Gaudi::Property<bool> m_recordTrkPair {this, "recordTrkPair", false, "Output EDM : Flag for record TrkPair vertices"};
54
55 Gaudi::Property<int> m_cutPixelHits {this, "CutPixelHits", 0, "Track selection : Hit requirements"};
56 Gaudi::Property<int> m_cutSctHits {this, "CutSctHits", 2, "Track selection : Hit requirements"};
57 Gaudi::Property<int> m_cutSharedHits {this, "CutSharedHits", 99, "Track selection : Hit requirements"};
58 Gaudi::Property<int> m_cutSiHits {this, "CutSiHits", 0, "Track selection : Hit requirements"};
59 Gaudi::Property<int> m_cutBLayHits {this, "CutBLayHits", 0, "Track selection : Hit requirements"};
60
61 Gaudi::Property<double> m_trkChi2Cut {this, "TrkChi2Cut", 50.0, "Track selection : Chi2 requirements"};
62 Gaudi::Property<double> m_trkPtCut {this, "TrkPtCut", (m_vtxAlgorithm == 0)? 2000. : 1000., "Track selection : pT requirements. 2 GeV in TrigVSI, 1 GeV in VSI"};
63
64 Gaudi::Property<double> m_d0TrkPVDstMinCut {this, "d0TrkPVDstMinCut", 2.0, "Track selection : Impact parameter requirements [mm]"};
65 Gaudi::Property<double> m_d0TrkPVDstMaxCut {this, "d0TrkPVDstMaxCut", 300.0, "Track selection : Impact parameter requirements [mm]"};
66 Gaudi::Property<double> m_z0TrkPVDstMinCut {this, "z0TrkPVDstMinCut", 0.0, "Track selection : Impact parameter requirements [mm]"};
67 Gaudi::Property<double> m_z0TrkPVDstMaxCut {this, "z0TrkPVDstMaxCut", 1500.0, "Track selection : Impact parameter requirements [mm]"};
68 Gaudi::Property<double> m_twoTrkVtxFormingD0Cut {this, "twoTrkVtxFormingD0Cut", 1., "Track selection : Impact parameter requirements [mm]"};
69
70
71 Gaudi::Property<double> m_maxR {this, "maxR", 563., "Track-pair selection : Max value for R of vertex position"};
72
73 Gaudi::Property<bool> m_doTwoCircRCut {this, "doTwoCircRCut", false, "Track-pair selection : Flag for R cut derived from two-circles-intersection-point"};
74 Gaudi::Property<bool> m_doFastRCut {this, "doFastRCut", false, "Track-pair selection : Flag for R cut derived from VKalVrtFitFast"};
75
76 Gaudi::Property<double> m_fastD0minCut {this, "fastD0minCut", 5., "Track-pair selection : Threshold for rough d0 cut"};
77 Gaudi::Property<double> m_fastD0deltaCut{this, "fastD0deltaCut", 4.2, "Track-pair selection : Threshold for rough d0 cut"};
78 Gaudi::Property<double> m_fastZ0minCut {this, "fastZ0minCut", 120., "Track-pair selection : Threshold for rough z0 cut"};
79 Gaudi::Property<double> m_fastZ0deltaCut{this, "fastZ0deltaCut", 8., "Track-pair selection : Threshold for rough z0 cut"};
80
81 Gaudi::Property<double> m_selVrtChi2Cut {this, "SelVrtChi2Cut", 4.5, "Track-pair selection : Threshold for the chi2 value of track pair fitting with VKalVrtFit"};
82
83 Gaudi::Property<bool> m_doPVCompatibilityCut {this, "doPVCompatibilityCut", false, "Track-pair selection : When set to true, require track pairs to be compatible with PV"};
84 Gaudi::Property<double> m_dphiPVCut {this, "dphiPVCut", -0.8, "Track-pair selection : Threshold for the cos of angle of the tracks and the momentum of the track pair"};
85 Gaudi::Property<double> m_pvCompatibilityCut {this, "PVcompatibilityCut", -20., "Track-pair selection : Threshold for the track pair position along the momentum vector"};
86
87 Gaudi::Property<bool> m_doMaterialMapVeto {this, "doMaterialMapVeto", false, "Track-pair selection : When set to true, perform material map veto on track pairs"};
88
89 Gaudi::Property<bool> m_skipLargeCluster {this, "skipLargeCluster", true, "Flag to skip vertexing on clusters with too many tracks"};
90 Gaudi::Property<size_t> m_maxTrks {this, "maxTrks", 100, "Max track number to run vertexing"};
91
92 Gaudi::Property<size_t> m_minTrkPairsMerge {this, "minTrkPairsMerge", 6, "Clusters with track pairs less than minTrkPairsMerge and tracks less than minTrksMerge will be merged into single vertex"};
93 Gaudi::Property<size_t> m_minTrksMerge {this, "minTrksMerge", 4, "Clusters with track pairs less than minTrkPairsMerge and tracks less than minTrksMerge will be merged into single vertex"};
94
95 Gaudi::Property<bool> m_truncateWrkVertices {this, "truncateWrkVertices", true, "Offline VSI option"};
96 Gaudi::Property<size_t> m_maxWrkVertices {this, "maxWrkVertices", 10000, "Offline VSI option"};
97 Gaudi::Property<double> m_improveChi2ProbThreshold{this, "improveChi2ProbThreshold", 4.5, "Offline VSI option"};
98
99 //
100 struct WrkVrt : public TrigVSI::IWrkVrt{
101 bool isGood = false;
102 bool isPair = false;
104 TLorentzVector vertexMom;
105 std::vector<double> vertexCov;
106 double chi2;
107 double chi2Core;
108 std::vector<double> chi2PerTrk;
109 long int charge;
110 std::vector< std::vector<double> > trkAtVrt;
111 unsigned long closestWrkVrtIndex;
113
114 inline double ndof() const { return 2.0*( m_selectedTrackIndices.size() + m_associatedTrackIndices.size() ) - 3.0; }
115 inline double ndofCore() const { return 2.0*( m_selectedTrackIndices.size() ) - 3.0; }
116 inline unsigned nTracksTotal() const { return m_selectedTrackIndices.size() + m_associatedTrackIndices.size(); }
117 inline double fitQuality() const { return chi2 / ndof(); }
118
119 struct AlgParam {
120 double twoCirc_dphi = 0;
121 double twoCirc_dr = 0;
122 double twoCirc_int_r = 0;
123
124 double vPos = 0;
125 double vPosMomAngT = 0;
126 double dphi1 = 0;
127 double dphi2 = 0;
128
129 double vrtFast_r = 0;
130 double vrtFast_eta = 0;
131 double vrtFast_phi = 0;
132 std::vector<float> vrtFast_trkd0;
133 std::vector<float> vrtFast_trkz0;
134
135 bool isPassMMV = false;
136 };
137
138 struct AlgCuts {
139 bool trkd0cut = false;
140 bool twoCircErrcut = false;
141 bool twoCircRcut = false;
142 bool fastErrcut = false;
143 bool fastRcut = false;
144 bool fitErrcut = false;
145 bool chi2cut = false;
146
148 };
149
152
153 virtual std::deque<size_t>& selectedTrackIndices() override { return this->m_selectedTrackIndices; }
154 virtual const std::deque<size_t>& selectedTrackIndices() const override { return this->m_selectedTrackIndices; }
155
158 virtual double x() const override { return vertex.x(); }
159 virtual double y() const override { return vertex.y(); }
160 virtual double z() const override { return vertex.z(); }
162
163 private :
164 std::deque<size_t> m_selectedTrackIndices;
165 std::deque<size_t> m_associatedTrackIndices;
166
167 };
168
169 enum TrkParameter { k_d0=0, k_z0=1, k_theta=2, k_phi=3, k_qOverP=4 ,k_nTP=5 };
171
172
173 // Type Definition
174 using WrkVrtContainer = std::vector<WrkVrt>;
175
176 // material map
179 TMatrixT<double>* m_materialMapMatrix=0;
185
186 // selection methods
187 bool selectTrack( const xAOD::TrackParticle* trk ) const;
188 bool selectTrack_hitPattern( const xAOD::TrackParticle* trk ) const;
189 bool selectTrack_d0Cut( const xAOD::TrackParticle* trk ) const;
190 bool selectTrack_z0Cut( const xAOD::TrackParticle* trk ) const;
191 bool selectTrack_pTCut( const xAOD::TrackParticle* trk ) const;
192 bool selectTrack_chi2Cut( const xAOD::TrackParticle* trk ) const;
193
194 // keys
195 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_firstPassTracksName { this,"FirstPassTracksName","InDetTrackParticles","xAOD::TrackParticle Collection used in Vertexing" };
196 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_secondPassTracksName { this,"SecondPassTracksName","InDetTrackParticles","xAOD::TrackParticle Collection used in Vertexing" };
197 SG::WriteHandleKey<xAOD::VertexContainer> m_vxCandidatesOutputName { this,"VxCandidatesOutputName","InclusiveSecVtx","Output Vertex Collection" };
198 SG::WriteHandleKey<xAOD::VertexContainer> m_trkPairOutputName { this,"TrkPairOutputName","InclusiveSecVtx","Track pair Collection" };
199 SG::ReadHandleKey<xAOD::VertexContainer> m_PrimaryVxInputName{ this,"PrimaryVertexInputName","PrimaryVertices","Input Vertex Collection" };
200 //
201 ToolHandle<Trk::TrkVKalVrtFitter> m_fitSvc { this, "VertexFitter", "", "VKalVrtFitter tool to fit tracks into the common vertex" };
202 ToolHandle<InDet::VertexPointEstimator> m_vertexPointEstimator { this, "VertexPointEstimator", "", "tool to find starting point for the vertex fitter"};
203 //
204 ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" };
205
206 //================================================================
207 //
208 // Util member functions
209 //
210 StatusCode fillVtxContainer( xAODContainers&, const WrkVrtContainer&, std::vector<const xAOD::TrackParticle*>&) const;
211
212
213 //================================================================
214 //
215 // Vertex finding algorithm member functions
216 //
217 size_t nTrkCommon( WrkVrtContainer&, const std::pair<unsigned, unsigned>& ) const;
218 StatusCode cleanUp ( WrkVrtContainer& ) const;
219 StatusCode trackSelection ( const xAOD::TrackParticleContainer*, const xAOD::TrackParticleContainer*, std::vector<const xAOD::TrackParticle*>& ) const;
220 StatusCode findDiTrackVertex ( WrkVrtContainer&, std::vector<std::pair<size_t,size_t>>&, std::vector<const xAOD::TrackParticle*>&, const EventContext&, const xAOD::Vertex*) const;
221 StatusCode findDiTrackVertexVSI ( WrkVrtContainer&, std::vector<std::pair<size_t,size_t>>&, std::vector<const xAOD::TrackParticle*>&, const EventContext&, const xAOD::Vertex*) const;
222 StatusCode findNtrackVerticesVSI( WrkVrtContainer&, std::vector<std::pair<size_t,size_t>>&, std::vector<const xAOD::TrackParticle*>&, const EventContext& ) const;
223
224 template<typename VrtType, typename Coord>
225 StatusCode findNTrackVertex ( WrkVrtContainer&, TrigVSI::VtxMap<VrtType,Coord>&, const std::vector<const xAOD::TrackParticle*>&, const EventContext& ) const;
226
227 StatusCode fitVertexFromTracks ( WrkVrt&, const std::vector<const xAOD::TrackParticle*>&, const EventContext& ) const;
228 StatusCode mergeVertexFromDiTrkVrt ( WrkVrtContainer&, const std::vector<std::pair<size_t,size_t>>&, const std::vector<size_t>&, const std::vector<const xAOD::TrackParticle*>&, const EventContext& ) const;
229};
230
231} // end of namespace TrigVSI
232
233#endif //> TRIGTOOLS_TRIGVRTSECINCLUSIVE_H
point classes for clustering
An algorithm that can be simultaneously executed in multiple threads.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Interface for vertex classes processed in VtxMap.
Definition IWrkVrt.h:30
StatusCode fillVtxContainer(xAODContainers &, const WrkVrtContainer &, std::vector< const xAOD::TrackParticle * > &) const
SG::WriteHandleKey< xAOD::VertexContainer > m_vxCandidatesOutputName
bool selectTrack_d0Cut(const xAOD::TrackParticle *trk) const
Gaudi::Property< double > m_twoTrkVtxFormingD0Cut
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< size_t > m_minTrksMerge
Gaudi::Property< int > m_cutBLayHits
Gaudi::Property< bool > m_doPVCompatibilityCut
Gaudi::Property< double > m_selVrtChi2Cut
Gaudi::Property< double > m_fastD0minCut
Gaudi::Property< bool > m_doTwoCircRCut
bool selectTrack_hitPattern(const xAOD::TrackParticle *trk) const
Gaudi::Property< size_t > m_maxTrks
Gaudi::Property< size_t > m_maxWrkVertices
bool selectTrack_chi2Cut(const xAOD::TrackParticle *trk) const
SG::WriteHandleKey< xAOD::VertexContainer > m_trkPairOutputName
Gaudi::Property< double > m_dphiPVCut
StatusCode findDiTrackVertex(WrkVrtContainer &, std::vector< std::pair< size_t, size_t > > &, std::vector< const xAOD::TrackParticle * > &, const EventContext &, const xAOD::Vertex *) const
StatusCode cleanUp(WrkVrtContainer &) const
Gaudi::Property< double > m_improveChi2ProbThreshold
virtual StatusCode finalize() override
Gaudi::Property< bool > m_doMaterialMapVeto
bool selectTrack_pTCut(const xAOD::TrackParticle *trk) const
StatusCode findNTrackVertex(WrkVrtContainer &, TrigVSI::VtxMap< VrtType, Coord > &, const std::vector< const xAOD::TrackParticle * > &, const EventContext &) const
Gaudi::Property< double > m_d0TrkPVDstMinCut
Gaudi::Property< double > m_maxR
virtual StatusCode initialize() override
Gaudi::Property< double > m_d0TrkPVDstMaxCut
Gaudi::Property< bool > m_doFastRCut
TrigVrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_firstPassTracksName
Gaudi::Property< double > m_trkChi2Cut
Gaudi::Property< double > m_fastZ0deltaCut
std::vector< WrkVrt > WrkVrtContainer
StatusCode mergeVertexFromDiTrkVrt(WrkVrtContainer &, const std::vector< std::pair< size_t, size_t > > &, const std::vector< size_t > &, const std::vector< const xAOD::TrackParticle * > &, const EventContext &) const
Reconstruct multi-track vertices from incompatible track pair lists.
StatusCode findNtrackVerticesVSI(WrkVrtContainer &, std::vector< std::pair< size_t, size_t > > &, std::vector< const xAOD::TrackParticle * > &, const EventContext &) const
Gaudi::Property< double > m_pvCompatibilityCut
Gaudi::Property< bool > m_truncateWrkVertices
Gaudi::Property< int > m_vtxAlgorithm
bool selectTrack(const xAOD::TrackParticle *trk) const
Gaudi::Property< bool > m_skipLargeCluster
ToolHandle< InDet::VertexPointEstimator > m_vertexPointEstimator
Gaudi::Property< double > m_fastZ0minCut
StatusCode fitVertexFromTracks(WrkVrt &, const std::vector< const xAOD::TrackParticle * > &, const EventContext &) const
Reconstruct vertex from given tracks.
Gaudi::Property< int > m_cutSctHits
size_t nTrkCommon(WrkVrtContainer &, const std::pair< unsigned, unsigned > &) const
Gaudi::Property< bool > m_recordTrkPair
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_secondPassTracksName
Gaudi::Property< double > m_fastD0deltaCut
ToolHandle< Trk::TrkVKalVrtFitter > m_fitSvc
Gaudi::Property< size_t > m_minTrkPairsMerge
Gaudi::Property< int > m_cutPixelHits
ToolHandle< GenericMonitoringTool > m_monTool
std::pair< std::unique_ptr< xAOD::VertexContainer >, std::unique_ptr< xAOD::VertexAuxContainer > > xAODContainers
Gaudi::Property< int > m_cutSiHits
Gaudi::Property< double > m_z0TrkPVDstMinCut
Gaudi::Property< double > m_z0TrkPVDstMaxCut
TMatrixT< double > * m_materialMapMatrix
Gaudi::Property< double > m_trkPtCut
StatusCode trackSelection(const xAOD::TrackParticleContainer *, const xAOD::TrackParticleContainer *, std::vector< const xAOD::TrackParticle * > &) const
Gaudi::Property< int > m_cutSharedHits
bool selectTrack_z0Cut(const xAOD::TrackParticle *trk) const
StatusCode findDiTrackVertexVSI(WrkVrtContainer &, std::vector< std::pair< size_t, size_t > > &, std::vector< const xAOD::TrackParticle * > &, const EventContext &, const xAOD::Vertex *) const
SG::ReadHandleKey< xAOD::VertexContainer > m_PrimaryVxInputName
The vertex map class to be used to find multi-track vertices.
Definition VtxMap.h:38
Eigen::Matrix< double, 3, 1 > Vector3D
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Amg::Vector3D vertex
flaged true for track pair vertex
double ndof() const
stores the value of some observable to the closest WrkVrt ( observable = e.g. significance )
virtual double y() const override
std::vector< double > vertexCov
VKalVrt fit vertex 4-momentum.
virtual const std::deque< size_t > & selectedTrackIndices() const override
Return indices of tracks associated with the vertex.
std::vector< std::vector< double > > trkAtVrt
total charge of the vertex
long int charge
list of VKalVrt fit chi2 for each track
double closestWrkVrtValue
stores the index of the closest WrkVrt in std::vector<WrkVrt>
bool isPair
flaged true for good vertex candidates
std::deque< size_t > m_associatedTrackIndices
list if indices in TrackParticleContainer for selectedBaseTracks
std::vector< double > chi2PerTrk
VKalVrt fit chi2 result.
TLorentzVector vertexMom
VKalVrt fit vertex position.
double chi2
VKalVrt fit covariance.
virtual double z() const override
virtual std::deque< size_t > & selectedTrackIndices() override
Return indices of tracks associated with the vertex.
double chi2Core
VKalVrt fit chi2 result.
virtual double x() const override
unsigned long closestWrkVrtIndex
list of track parameters wrt the reconstructed vertex
#define private