CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PF_PU_AssoMapAlgos.h
Go to the documentation of this file.
1 #ifndef PF_PU_AssoMapAlgos_h
2 #define PF_PU_AssoMapAlgos_h
3 
4 
9 //
10 // Original Author: Matthias Geisler,32 4-B20,+41227676487,
11 // $Id: PF_PU_AssoMapAlgos.h,v 1.7 2012/11/21 09:45:04 mgeisler Exp $
12 //
13 //
14 
15 #include <string>
16 #include <vector>
17 
21 
23 
27 
30 
35 
38 
41 
45 
47 
49 
56 
57 //
58 // constants, enums and typedefs
59 //
60 
61 const double kMass = 0.49765;
62 const double lamMass = 1.11568;
63 
64 /*limits for the quality criteria*/
65 
66 //track weight step
67 const double tw_1st_90_cum = 0.004;
68 const double tw_1st_50 = 0.5;
69 
70 const double tw_2nd_f1_cum = 0.05;
71 const double tw_2nd_f3_cum = 0.05;
72 const double tw_2nd_fz_cum = 0.05;
73 
74 //secondary vertices step
75 const double sc_1st_70_cum = 8.;
76 const double sc_1st_50 = 2.;
77 
78 const double sc_2nd_f1_0_cum = 0.2;
79 const double sc_2nd_f3_0_cum = 0.3;
80 const double sc_2nd_fz_0_cum = 0.3;
81 
82 const double sc_2nd_f1_1_cum = 0.7;
83 const double sc_2nd_f3_1_cum = 1.;
84 const double sc_2nd_fz_1_cum = 1.;
85 
86 //final step
87 const double f1_1st_70_cum = 0.03;
88 const double f1_1st_50_cum = 0.2;
89 
90 const double f3_1st_70_cum = 0.03;
91 const double f3_1st_50_cum = 40.;
92 const double f3_1st_50 = 0.1;
93 
94 const double fz_1st_70_cum = 0.03;
95 const double fz_1st_50_cum = 40.;
96 const double fz_1st_50 = 0.1;
97 
98 const double f3_2nd_f3_cum = 0.04;
99 const double fz_2nd_fz_cum = 0.04;
100 
101 
102 
105 
106 typedef std::pair<reco::TrackRef, int> TrackQualityPair;
107 typedef std::vector<TrackQualityPair > TrackQualityPairVector;
108 
109 typedef std::pair<reco::VertexRef, int> VertexStepPair;
110 
111 typedef std::pair<reco::VertexRef, TrackQualityPair> VertexTrackQuality;
112 
113 typedef std::pair <reco::VertexRef, float> VertexPtsumPair;
114 typedef std::vector< VertexPtsumPair > VertexPtsumVector;
115 
116 typedef std::pair<int, int> StepQualityPair;
117 typedef std::vector<StepQualityPair> StepQualityPairVector;
118 
119 typedef std::pair<int, double> StepDistancePair;
120 typedef std::vector<StepDistancePair> StepDistancePairVector;
121 
123 
124  public:
125 
126  //dedicated constructor for the algorithms
128 
129  //dedicated destructor for the algorithms
130  virtual ~PF_PU_AssoMapAlgos();
131 
132  //get all needed collections at the beginning
133  virtual void GetInputCollections(edm::Event&, const edm::EventSetup&);
134 
135  //create the track to vertex association map
136  std::auto_ptr<TrackToVertexAssMap> CreateTrackToVertexMap(edm::Handle<reco::TrackCollection>, const edm::EventSetup&);
137 
138  //create the vertex to track association map
139  std::auto_ptr<VertexToTrackAssMap> CreateVertexToTrackMap(edm::Handle<reco::TrackCollection>, const edm::EventSetup&);
140 
141  //function to sort the vertices in the AssociationMap by the sum of (pT - pT_Error)**2
142  std::auto_ptr<TrackToVertexAssMap> SortAssociationMap(TrackToVertexAssMap*);
143 
144  protected:
145  //protected functions
146 
147  //create helping vertex vector to remove associated vertices
148  std::vector<reco::VertexRef>* CreateVertexVector(edm::Handle<reco::VertexCollection>);
149 
150  //erase one vertex from the vertex vector
151  void EraseVertex(std::vector<reco::VertexRef>*, reco::VertexRef);
152 
153  //find an association for a certain track
154  VertexStepPair FindAssociation(const reco::TrackRef&, std::vector<reco::VertexRef>*,
157 
158  //get the quality for a certain association
159  int DefineQuality(StepDistancePairVector, int, double);
160 
161  private:
162 
163  // private methods for internal usage
164 
165  //function to find the closest vertex in z for a certain track
166  static reco::VertexRef FindClosestZ(const reco::TrackRef, std::vector<reco::VertexRef>*, double tWeight = 0.);
167 
168  //function to find the closest vertex in 3D for a certain track
169  static reco::VertexRef FindClosest3D(reco::TransientTrack, std::vector<reco::VertexRef>*, double tWeight = 0.);
170 
171  //function to filter the conversion collection
172  virtual std::auto_ptr<reco::ConversionCollection> GetCleanedConversions(edm::Handle<reco::ConversionCollection>, bool);
173 
174  //function to find out if the track comes from a gamma conversion
176 
178  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
179 
180  //function to filter the Kshort collection
181  virtual std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedKshort(edm::Handle<reco::VertexCompositeCandidateCollection>, bool);
182 
183  //function to filter the Lambda collection
184  virtual std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedLambda(edm::Handle<reco::VertexCompositeCandidateCollection>, bool);
185 
186  //function to find out if the track comes from a V0 decay
188 
190  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
191 
192  //function to filter the nuclear interaction collection
193  virtual std::auto_ptr<reco::PFDisplacedVertexCollection> GetCleanedNI(edm::Handle<reco::PFDisplacedVertexCollection>, bool);
194 
195  //function to find out if the track comes from a nuclear interaction
197 
199  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double, reco::TransientTrack);
200 
201  //function to filter the inclusive vertex finder collection
202  virtual std::auto_ptr<reco::VertexCollection> GetCleanedIVF(edm::Handle<reco::VertexCollection>, bool);
203 
204  //function to find out if the track comes from a inclusive vertex
205  static bool ComesFromIVF(const reco::TrackRef, const reco::VertexCollection&, reco::Vertex*);
206 
208  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
209 
210  //function to find the vertex with the highest TrackWeight for a certain track
211  static reco::VertexRef TrackWeightAssociation(const reco::TrackBaseRef&, std::vector<reco::VertexRef>*);
212 
213 
214  // ----------member data ---------------------------
215 
217 
220 
223 
225 
228 
231  std::auto_ptr<reco::ConversionCollection> cleanedConvCollP;
232 
235  std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedKshortCollP;
236 
239  std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedLambdaCollP;
240 
243  std::auto_ptr<reco::PFDisplacedVertexCollection> cleanedNICollP;
244 
247  std::auto_ptr<reco::VertexCollection> cleanedIVFCollP;
248 
250 
252  bool missingColls; // is true if there is a diplaced vertex collection in the event
253 
256 
257  int maxNumWarnings_; // CV: print Warning if TrackExtra objects don't exist in input file,
258  int numWarnings_; // but only a few times
259 
260 
262 
263  VertexState BSVertexState;
264 
265 };
266 
267 #endif
VertexStepPair FindAssociation(const reco::TrackRef &, std::vector< reco::VertexRef > *, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
virtual std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedLambda(edm::Handle< reco::VertexCompositeCandidateCollection >, bool)
edm::InputTag IFVVertexCollection_
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
std::vector< TrackQualityPair > TrackQualityPairVector
edm::ESHandle< MagneticField > bFieldH
const double tw_1st_50
const double lamMass
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
edm::InputTag ConversionsCollection_
virtual std::auto_ptr< reco::ConversionCollection > GetCleanedConversions(edm::Handle< reco::ConversionCollection >, bool)
const double fz_1st_70_cum
const double f1_1st_50_cum
const double sc_2nd_f3_0_cum
const double sc_2nd_f3_1_cum
const double kMass
static bool ComesFromNI(const reco::TrackRef, const reco::PFDisplacedVertexCollection &, reco::PFDisplacedVertex *)
static reco::VertexRef FindConversionVertex(const reco::TrackRef, const reco::Conversion &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
edm::InputTag KshortCollection_
void EraseVertex(std::vector< reco::VertexRef > *, reco::VertexRef)
edm::InputTag LambdaCollection_
static reco::VertexRef FindClosest3D(reco::TransientTrack, std::vector< reco::VertexRef > *, double tWeight=0.)
std::pair< reco::VertexRef, TrackQualityPair > VertexTrackQuality
VertexDistanceXY distanceComputerXY
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const double sc_2nd_f1_1_cum
const double f3_1st_50_cum
edm::InputTag input_VertexCollection_
std::auto_ptr< TrackToVertexAssMap > CreateTrackToVertexMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
static reco::VertexRef FindNIVertex(const reco::TrackRef, const reco::PFDisplacedVertex &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double, reco::TransientTrack)
const double fz_1st_50
const double sc_1st_70_cum
const double fz_2nd_fz_cum
std::pair< reco::VertexRef, int > VertexStepPair
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
edm::Handle< reco::VertexCollection > ivfVertexCollH
std::pair< int, int > StepQualityPair
const double sc_1st_50
static reco::VertexRef FindV0Vertex(const reco::TrackRef, const reco::VertexCompositeCandidate &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
std::auto_ptr< reco::VertexCollection > cleanedIVFCollP
const double sc_2nd_fz_0_cum
std::vector< VertexPtsumPair > VertexPtsumVector
const double tw_2nd_fz_cum
static reco::VertexRef FindClosestZ(const reco::TrackRef, std::vector< reco::VertexRef > *, double tWeight=0.)
edm::InputTag input_BeamSpot_
edm::InputTag NIVertexCollection_
const double tw_1st_90_cum
const double sc_2nd_f1_0_cum
const double f1_1st_70_cum
edm::Handle< reco::PFDisplacedVertexCollection > displVertexCollH
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedKshortCollP
static reco::VertexRef FindIVFVertex(const reco::TrackRef, const reco::Vertex &, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
static reco::VertexRef TrackWeightAssociation(const reco::TrackBaseRef &, std::vector< reco::VertexRef > *)
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::TrackCollection, int > > TrackToVertexAssMap
const double f3_1st_50
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedLambdaCollP
const double tw_2nd_f3_cum
edm::Handle< reco::VertexCollection > vtxcollH
std::auto_ptr< TrackToVertexAssMap > SortAssociationMap(TrackToVertexAssMap *)
std::auto_ptr< reco::PFDisplacedVertexCollection > cleanedNICollP
const double fz_1st_50_cum
Block of elements.
virtual std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedKshort(edm::Handle< reco::VertexCompositeCandidateCollection >, bool)
std::pair< reco::VertexRef, float > VertexPtsumPair
virtual std::auto_ptr< reco::VertexCollection > GetCleanedIVF(edm::Handle< reco::VertexCollection >, bool)
std::pair< int, double > StepDistancePair
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollLambdaH
std::vector< StepQualityPair > StepQualityPairVector
std::vector< reco::VertexRef > * CreateVertexVector(edm::Handle< reco::VertexCollection >)
const double tw_2nd_f1_cum
int DefineQuality(StepDistancePairVector, int, double)
static bool ComesFromConversion(const reco::TrackRef, const reco::ConversionCollection &, reco::Conversion *)
virtual std::auto_ptr< reco::PFDisplacedVertexCollection > GetCleanedNI(edm::Handle< reco::PFDisplacedVertexCollection >, bool)
static bool ComesFromV0Decay(const reco::TrackRef, const reco::VertexCompositeCandidateCollection &, reco::VertexCompositeCandidate *)
const double f3_1st_70_cum
std::pair< reco::TrackRef, int > TrackQualityPair
edm::Handle< reco::BeamSpot > beamspotH
const double f3_2nd_f3_cum
static bool ComesFromIVF(const reco::TrackRef, const reco::VertexCollection &, reco::Vertex *)
edm::Handle< reco::ConversionCollection > convCollH
const double sc_2nd_fz_1_cum
std::auto_ptr< VertexToTrackAssMap > CreateVertexToTrackMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
edm::AssociationMap< edm::OneToManyWithQuality< reco::TrackCollection, reco::VertexCollection, int > > VertexToTrackAssMap
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollKshortH
PF_PU_AssoMapAlgos(const edm::ParameterSet &)
std::vector< StepDistancePair > StepDistancePairVector
std::auto_ptr< reco::ConversionCollection > cleanedConvCollP