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 
20 
22 
26 
29 
34 
37 
40 
44 
46 
48 
49 //
50 // constants, enums and typedefs
51 //
52 
53 const double kMass = 0.49765;
54 const double lamMass = 1.11568;
55 
56 /*limits for the quality criteria*/
57 
58 const double tw_90 = 1.e-2;
59 const double tw_70 = 1.e-1;
60 const double tw_50 = 2.e-1;
61 
62 const double sec_70 = 5.;
63 const double sec_50 = 19.;
64 
65 const double fin_70 = 1.e-1;
66 const double fin_50 = 3.e-1;
67 
70 
71 typedef std::pair<reco::TrackRef, int> TrackQualityPair;
72 typedef std::vector<TrackQualityPair > TrackQualityPairVector;
73 
74 typedef std::pair<reco::VertexRef, int> VertexStepPair;
75 
76 typedef std::pair<reco::VertexRef, TrackQualityPair> VertexTrackQuality;
77 
78 typedef std::pair <reco::VertexRef, float> VertexPtsumPair;
79 typedef std::vector< VertexPtsumPair > VertexPtsumVector;
80 
82 
83  public:
84 
85  //dedicated constructor for the algorithms
87 
88  //get all needed collections at the beginning
90 
91  //create the track to vertex association map
92  std::auto_ptr<TrackToVertexAssMap> CreateTrackToVertexMap(edm::Handle<reco::TrackCollection>, const edm::EventSetup&);
93 
94  //create the vertex to track association map
95  std::auto_ptr<VertexToTrackAssMap> CreateVertexToTrackMap(edm::Handle<reco::TrackCollection>, const edm::EventSetup&);
96 
97  //function to sort the vertices in the AssociationMap by the sum of (pT - pT_Error)**2
98  std::auto_ptr<TrackToVertexAssMap> SortAssociationMap(TrackToVertexAssMap*);
99 
100  protected:
101  //protected functions
102 
103  //create helping vertex vector to remove associated vertices
104  std::vector<reco::VertexRef>* CreateVertexVector(edm::Handle<reco::VertexCollection>);
105 
106  //erase one vertex from the vertex vector
107  void EraseVertex(std::vector<reco::VertexRef>*, reco::VertexRef);
108 
109  //find an association for a certain track
110  VertexStepPair FindAssociation(const reco::TrackRef&, std::vector<reco::VertexRef>*,
113 
114  //get the quality for a certain association
115  int DefineQuality(int, int, double);
116 
117  private:
118 
119  // private methods for internal usage
120 
121  //function to find the closest vertex in z for a certain track
122  static reco::VertexRef FindClosestZ(const reco::TrackRef, std::vector<reco::VertexRef>*, double tWeight = 0.);
123 
124  //function to find the closest vertex in 3D for a certain track
125  static reco::VertexRef FindClosest3D(reco::TransientTrack, std::vector<reco::VertexRef>*, double tWeight = 0.);
126 
127  //function to calculate the deltaR between a vector and a vector connecting two points
129 
130  //function to filter the conversion collection
131  static std::auto_ptr<reco::ConversionCollection> GetCleanedConversions(edm::Handle<reco::ConversionCollection>,
133 
134  //function to find out if the track comes from a gamma conversion
136 
139  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
140 
141  //function to filter the Kshort collection
142  static std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedKshort(edm::Handle<reco::VertexCompositeCandidateCollection>, edm::Handle<reco::BeamSpot>, bool);
143 
144  //function to filter the Lambda collection
145  static std::auto_ptr<reco::VertexCompositeCandidateCollection> GetCleanedLambda(edm::Handle<reco::VertexCompositeCandidateCollection>, edm::Handle<reco::BeamSpot>, bool);
146 
147  //function to find out if the track comes from a V0 decay
150 
153  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
154 
155  //function to filter the nuclear interaction collection
156  static std::auto_ptr<reco::PFDisplacedVertexCollection> GetCleanedNI(edm::Handle<reco::PFDisplacedVertexCollection>, edm::Handle<reco::BeamSpot>, bool);
157 
158  //function to find out if the track comes from a nuclear interaction
160 
163  edm::Handle<reco::BeamSpot>, std::vector<reco::VertexRef>*, double);
164 
165  //function to find the vertex with the highest TrackWeight for a certain track
166  static reco::VertexRef TrackWeightAssociation(const reco::TrackBaseRef&, std::vector<reco::VertexRef>*);
167 
168 
169  // ----------member data ---------------------------
170 
172 
175 
178 
180 
183 
186  std::auto_ptr<reco::ConversionCollection> cleanedConvCollP;
187 
190  std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedKshortCollP;
191 
194  std::auto_ptr<reco::VertexCompositeCandidateCollection> cleanedLambdaCollP;
195 
198  std::auto_ptr<reco::PFDisplacedVertexCollection> cleanedNICollP;
199 
201 
203  bool missingColls; // is true if there is a diplaced vertex collection in the event
204 
206 
207  int maxNumWarnings_; // CV: print Warning if TrackExtra objects don't exist in input file,
208  int numWarnings_; // but only a few times
209 
210 };
211 
212 #endif
VertexStepPair FindAssociation(const reco::TrackRef &, std::vector< reco::VertexRef > *, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
std::vector< TrackQualityPair > TrackQualityPairVector
edm::ESHandle< MagneticField > bFieldH
const double lamMass
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
edm::InputTag ConversionsCollection_
const double kMass
int DefineQuality(int, int, double)
edm::InputTag KshortCollection_
static std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedKshort(edm::Handle< reco::VertexCompositeCandidateCollection >, edm::Handle< reco::BeamSpot >, bool)
void EraseVertex(std::vector< reco::VertexRef > *, reco::VertexRef)
edm::InputTag LambdaCollection_
static reco::VertexRef FindClosest3D(reco::TransientTrack, std::vector< reco::VertexRef > *, double tWeight=0.)
const double tw_70
static bool ComesFromNI(const reco::TrackRef, reco::PFDisplacedVertexCollection, reco::PFDisplacedVertex *)
std::pair< reco::VertexRef, TrackQualityPair > VertexTrackQuality
const double fin_70
edm::InputTag input_VertexCollection_
std::auto_ptr< TrackToVertexAssMap > CreateTrackToVertexMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
static bool ComesFromConversion(const reco::TrackRef, reco::ConversionCollection, reco::Conversion *)
std::pair< reco::VertexRef, int > VertexStepPair
static std::auto_ptr< reco::VertexCompositeCandidateCollection > GetCleanedLambda(edm::Handle< reco::VertexCompositeCandidateCollection >, edm::Handle< reco::BeamSpot >, bool)
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
static std::auto_ptr< reco::PFDisplacedVertexCollection > GetCleanedNI(edm::Handle< reco::PFDisplacedVertexCollection >, edm::Handle< reco::BeamSpot >, bool)
std::vector< VertexPtsumPair > VertexPtsumVector
static reco::VertexRef FindClosestZ(const reco::TrackRef, std::vector< reco::VertexRef > *, double tWeight=0.)
static reco::VertexRef FindNIVertex(const reco::TrackRef, reco::PFDisplacedVertex, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
edm::InputTag input_BeamSpot_
edm::InputTag NIVertexCollection_
static bool ComesFromV0Decay(const reco::TrackRef, reco::VertexCompositeCandidateCollection, reco::VertexCompositeCandidateCollection, reco::VertexCompositeCandidate *)
edm::Handle< reco::PFDisplacedVertexCollection > displVertexCollH
void GetInputCollections(edm::Event &, const edm::EventSetup &)
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedKshortCollP
static reco::VertexRef TrackWeightAssociation(const reco::TrackBaseRef &, std::vector< reco::VertexRef > *)
edm::AssociationMap< edm::OneToManyWithQuality< reco::VertexCollection, reco::TrackCollection, int > > TrackToVertexAssMap
std::auto_ptr< reco::VertexCompositeCandidateCollection > cleanedLambdaCollP
edm::Handle< reco::VertexCollection > vtxcollH
std::auto_ptr< TrackToVertexAssMap > SortAssociationMap(TrackToVertexAssMap *)
std::auto_ptr< reco::PFDisplacedVertexCollection > cleanedNICollP
const double sec_50
Block of elements.
std::pair< reco::VertexRef, float > VertexPtsumPair
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
static double dR(math::XYZPoint, math::XYZVector, edm::Handle< reco::BeamSpot >)
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollLambdaH
std::vector< reco::VertexRef > * CreateVertexVector(edm::Handle< reco::VertexCollection >)
static reco::VertexRef FindConversionVertex(const reco::TrackRef, reco::Conversion, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
const double tw_50
const double sec_70
static std::auto_ptr< reco::ConversionCollection > GetCleanedConversions(edm::Handle< reco::ConversionCollection >, edm::Handle< reco::BeamSpot >, bool)
std::pair< reco::TrackRef, int > TrackQualityPair
edm::Handle< reco::BeamSpot > beamspotH
edm::Handle< reco::ConversionCollection > convCollH
static reco::VertexRef FindV0Vertex(const reco::TrackRef, reco::VertexCompositeCandidate, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, std::vector< reco::VertexRef > *, double)
std::auto_ptr< VertexToTrackAssMap > CreateVertexToTrackMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
edm::AssociationMap< edm::OneToManyWithQuality< reco::TrackCollection, reco::VertexCollection, int > > VertexToTrackAssMap
const double tw_90
edm::Handle< reco::VertexCompositeCandidateCollection > vertCompCandCollKshortH
PF_PU_AssoMapAlgos(const edm::ParameterSet &)
std::auto_ptr< reco::ConversionCollection > cleanedConvCollP
const double fin_50