forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PFDisplacedVertexFinder.h
201 lines (133 loc) · 6.03 KB
/
PFDisplacedVertexFinder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#ifndef RecoParticleFlow_PFTracking_PFDisplacedVertexFinder_h
#define RecoParticleFlow_PFTracking_PFDisplacedVertexFinder_h
#include "RecoParticleFlow/PFTracking/interface/PFDisplacedVertexHelper.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidate.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexCandidateFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexSeed.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexSeedFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h"
#include "DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/GeometryVector/interface/GlobalVector.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "RecoParticleFlow/PFTracking/interface/PFCheckHitPattern.h"
/// \brief Displaced Vertex Finder Algorithm
/*!
\author Maxime Gouzevitch
\date October 2009
*/
class TrackingGeometry;
class TrackerGeometry;
class MagneticField;
class PFDisplacedVertexFinder {
public:
PFDisplacedVertexFinder();
~PFDisplacedVertexFinder();
/// -------- Useful Types -------- ///
typedef reco::PFDisplacedVertexSeedCollection::iterator IDVS;
typedef reco::PFDisplacedVertexCollection::iterator IDV;
typedef std::pair <unsigned int, unsigned int> PFTrackHitInfo;
typedef std::pair <PFTrackHitInfo, PFTrackHitInfo> PFTrackHitFullInfo;
/// Fitter Type
enum FitterType {
F_NOTDEFINED,
F_DONOTREFIT,
F_KALMAN,
F_ADAPTIVE
};
/// -------- Set different algo parameters -------- ///
/// Sets algo parameters for the vertex finder
void setParameters(double transvSize, double longSize,
double primaryVertexCut, double tobCut,
double tecCut, double minAdaptWeight, bool switchOff2TrackVertex) {
transvSize_ = transvSize;
longSize_ = longSize;
primaryVertexCut_ = primaryVertexCut;
tobCut_ = tobCut;
tecCut_ = tecCut;
minAdaptWeight_ = minAdaptWeight;
switchOff2TrackVertex_ = switchOff2TrackVertex;
}
/// Sets debug printout flag
void setDebug( bool debug ) {debug_ = debug;}
/// Sets parameters for track extrapolation and hits study
void setEdmParameters( const MagneticField* magField,
edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle,
const TrackerTopology* tkerTopo,
const TrackerGeometry* tkerGeom){
magField_ = magField;
globTkGeomHandle_ = globTkGeomHandle;
tkerTopo_ = tkerTopo;
tkerGeom_ = tkerGeom;
}
void setTracksSelector(const edm::ParameterSet& ps){
helper_.setTracksSelector(ps);
}
void setVertexIdentifier(const edm::ParameterSet& ps){
helper_.setVertexIdentifier(ps);
}
void setPrimaryVertex(edm::Handle< reco::VertexCollection > mainVertexHandle,
edm::Handle< reco::BeamSpot > beamSpotHandle){
helper_.setPrimaryVertex(mainVertexHandle, beamSpotHandle);
}
void setAVFParameters(const edm::ParameterSet& ps){
sigmacut_ = ps.getParameter<double>("sigmacut");
t_ini_ = ps.getParameter<double>("Tini");
ratio_ = ps.getParameter<double>("ratio");
}
/// Set input collections of tracks
void setInput(const edm::Handle< reco::PFDisplacedVertexCandidateCollection >&);
/// \return auto_ptr to collection of DisplacedVertices
std::auto_ptr< reco::PFDisplacedVertexCollection > transferDisplacedVertices() {return displacedVertices_;}
const std::auto_ptr< reco::PFDisplacedVertexCollection >& displacedVertices() const {return displacedVertices_;}
/// -------- Main function which find vertices -------- ///
void findDisplacedVertices();
private:
/// -------- Different steps of the finder algorithm -------- ///
/// Analyse a vertex candidate and select potential vertex point(s)
void findSeedsFromCandidate(const reco::PFDisplacedVertexCandidate&, reco::PFDisplacedVertexSeedCollection&);
/// Sometimes two vertex candidates can be quite close and coming from the same vertex
void mergeSeeds(reco::PFDisplacedVertexSeedCollection&, std::vector<bool>& bLocked);
/// Fit one by one the vertex points with associated tracks to get displaced vertices
bool fitVertexFromSeed(const reco::PFDisplacedVertexSeed&, reco::PFDisplacedVertex&);
/// Remove potentially fakes displaced vertices
void selectAndLabelVertices(reco::PFDisplacedVertexCollection&, std::vector <bool>&);
bool rejectAndLabelVertex(reco::PFDisplacedVertex& dv);
/// -------- Tools -------- ///
bool isCloseTo(const reco::PFDisplacedVertexSeed&, const reco::PFDisplacedVertexSeed&) const;
double getTransvDiff(const GlobalPoint&, const GlobalPoint&) const;
double getLongDiff(const GlobalPoint&, const GlobalPoint&) const;
double getLongProj(const GlobalPoint&, const GlobalVector&) const;
reco::PFDisplacedVertex::VertexTrackType getVertexTrackType(PFTrackHitFullInfo&) const;
unsigned commonTracks(const reco::PFDisplacedVertex&, const reco::PFDisplacedVertex&) const;
friend std::ostream& operator<<(std::ostream&, const PFDisplacedVertexFinder&);
/// -------- Members -------- ///
reco::PFDisplacedVertexCandidateCollection const* displacedVertexCandidates_;
std::auto_ptr< reco::PFDisplacedVertexCollection > displacedVertices_;
/// -------- Parameters -------- ///
/// Algo parameters for the vertex finder
double transvSize_;
double longSize_;
double primaryVertexCut_;
double tobCut_;
double tecCut_;
double minAdaptWeight_;
bool switchOff2TrackVertex_;
/// Adaptive Vertex Fitter parameters
double sigmacut_; //= 6;
double t_ini_; //= 256.;
double ratio_; //= 0.25;
/// If true, debug printouts activated
bool debug_;
/// Tracker geometry for discerning hit positions
edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle_;
/// doc?
const TrackerTopology* tkerTopo_;
const TrackerGeometry* tkerGeom_;
/// to be able to extrapolate tracks f
const MagneticField* magField_;
PFCheckHitPattern hitPattern_;
PFDisplacedVertexHelper helper_;
};
#endif