CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Conversion.h
Go to the documentation of this file.
1 #ifndef EgammaCandidates_Conversion_h
2 #define EgammaCandidates_Conversion_h
3 
12 #include <bitset>
21 
22 namespace reco {
23  class Conversion {
24  public:
25  enum ConversionAlgorithm { undefined = 0, ecalSeeded = 1, trackerOnly = 2, mixed = 3, pflow = 4, algoSize = 5 };
26 
37  };
38 
39  static const std::string algoNames[];
40 
41  // Default constructor
42  Conversion();
43 
46  const std::vector<math::XYZPointF>& trackPositionAtEcal,
47  const reco::Vertex& convVtx,
48  const std::vector<reco::CaloClusterPtr>& matchingBC,
49  const float DCA,
50  const std::vector<math::XYZPointF>& innPoint,
51  const std::vector<math::XYZVectorF>& trackPin,
52  const std::vector<math::XYZVectorF>& trackPout,
53  const std::vector<uint8_t>& nHitsBeforeVtx,
54  const std::vector<Measurement1DFloat>& dlClosestHitToVtx,
55  uint8_t nSharedHits,
56  const float mva,
58 
60  const std::vector<reco::TrackRef>& tr,
61  const std::vector<math::XYZPointF>& trackPositionAtEcal,
62  const reco::Vertex& convVtx,
63  const std::vector<reco::CaloClusterPtr>& matchingBC,
64  const float DCA,
65  const std::vector<math::XYZPointF>& innPoint,
66  const std::vector<math::XYZVectorF>& trackPin,
67  const std::vector<math::XYZVectorF>& trackPout,
68  const float mva,
70 
72  const std::vector<reco::TrackRef>& tr,
73  const reco::Vertex& convVtx,
75 
78  const reco::Vertex& convVtx,
80 
82  Conversion* clone() const;
86  std::vector<edm::RefToBase<reco::Track> > const& tracks() const;
90  bool isConverted() const;
92  unsigned int nTracks() const { return tracks().size(); }
94  double MVAout() const { return theMVAout_; }
96  std::vector<float> const oneLegMVA() { return theOneLegMVA_; }
98  double pairInvariantMass() const;
100  double pairCotThetaSeparation() const;
110  double EoverP() const;
114  double EoverPrefittedTracks() const;
115  // Dist of minimum approach between tracks
116  double distOfMinimumApproach() const { return theMinDistOfApproach_; }
117  // deltaPhi tracks at innermost point
118  double dPhiTracksAtVtx() const;
119  // deltaPhi tracks at ECAl
120  double dPhiTracksAtEcal() const;
121  // deltaEta tracks at ECAl
122  double dEtaTracksAtEcal() const;
123 
124  //impact parameter and decay length computed with respect to given beamspot or vertex
125  //computed from refittedPairMomentum
126 
127  //transverse impact parameter
128  double dxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const;
129  //longitudinal impact parameter
130  double dz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const;
131  //transverse decay length
132  double lxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const;
133  //longitudinal decay length
134  double lz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const;
135  //z position of intersection with beamspot in rz plane (possible tilt of beamspot is neglected)
136  double zOfPrimaryVertexFromTracks(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const {
137  return dz(myBeamSpot) + myBeamSpot.z();
138  }
139 
142  const std::vector<math::XYZPointF>& ecalImpactPosition() const { return thePositionAtEcal_; }
143  // pair of BC matching a posteriori the tracks
144  const std::vector<reco::CaloClusterPtr>& bcMatchingWithTracks() const { return theMatchingBCs_; }
146  std::vector<double> tracksSigned_d0() const;
148  const std::vector<math::XYZPointF>& tracksInnerPosition() const { return theTrackInnerPosition_; }
150  const std::vector<math::XYZVectorF>& tracksPout() const { return theTrackPout_; }
152  const std::vector<math::XYZVectorF>& tracksPin() const { return theTrackPin_; }
154  const std::vector<uint8_t>& nHitsBeforeVtx() const { return nHitsBeforeVtx_; }
156  const std::vector<Measurement1DFloat>& dlClosestHitToVtx() const { return dlClosestHitToVtx_; }
158  uint8_t nSharedHits() const { return nSharedHits_; }
159 
161  void setMVAout(const float& mva) { theMVAout_ = mva; }
163  void setOneLegMVA(const std::vector<float>& mva) { theOneLegMVA_ = mva; }
164  // Set the ptr to the Super cluster if not set in the constructor
167  void setConversionAlgorithm(const ConversionAlgorithm a, bool set = true) {
168  if (set)
169  algorithm_ = a;
170  else
172  }
173  ConversionAlgorithm algo() const;
174  std::string algoName() const;
177 
178  bool quality(ConversionQuality q) const { return (qualityMask_ & (1 << q)) >> q; }
179  void setQuality(ConversionQuality q, bool b);
180 
181  private:
185  std::vector<edm::RefToBase<reco::Track> > trackToBaseRefs_;
187  std::vector<math::XYZPointF> thePositionAtEcal_;
191  std::vector<reco::CaloClusterPtr> theMatchingBCs_;
193  std::vector<math::XYZPointF> theTrackInnerPosition_;
195  std::vector<math::XYZVectorF> theTrackPin_;
197  std::vector<math::XYZVectorF> theTrackPout_;
199  std::vector<uint8_t> nHitsBeforeVtx_;
201  std::vector<Measurement1DFloat> dlClosestHitToVtx_;
203  std::vector<float> theOneLegMVA_;
207  float theMVAout_;
208  uint16_t qualityMask_;
210  uint8_t nSharedHits_;
212  uint8_t algorithm_;
213  };
214 
216 
218  switch (algorithm_) {
219  case undefined:
220  return "undefined";
221  case ecalSeeded:
222  return "ecalSeeded";
223  case trackerOnly:
224  return "trackerOnly";
225  case mixed:
226  return "mixed";
227  case pflow:
228  return "pflow";
229  }
230  return "undefined";
231  }
232 
234  if (int(a) < int(algoSize) && int(a) > 0)
235  return algoNames[int(a)];
236  return "undefined";
237  }
238 
240  if (b) //regular OR if setting value to true
241  qualityMask_ |= (1 << q);
242  else // doing "half-XOR" if unsetting value
243  qualityMask_ &= (~(1 << q));
244  }
245 
246 } // namespace reco
247 
248 #endif
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:88
static const std::string algoNames[]
Definition: Conversion.h:39
std::vector< math::XYZVectorF > theTrackPout_
P_out of tracks.
Definition: Conversion.h:197
ConversionAlgorithm algo() const
Definition: Conversion.h:215
bool quality(ConversionQuality q) const
Definition: Conversion.h:178
void setQuality(ConversionQuality q, bool b)
Definition: Conversion.h:239
double EoverP() const
Definition: Conversion.cc:213
const std::vector< Measurement1DFloat > & dlClosestHitToVtx() const
Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positi...
Definition: Conversion.h:156
reco::CaloClusterPtrVector caloCluster_
vector pointer to a/multiple seed CaloCluster(s)
Definition: Conversion.h:183
double zOfPrimaryVertexFromTracks(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.h:136
double distOfMinimumApproach() const
Definition: Conversion.h:116
std::vector< double > tracksSigned_d0() const
signed transverse impact parameter for each track
Definition: Conversion.cc:245
double lxy(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.cc:337
static ConversionAlgorithm algoByName(const std::string &name)
Definition: Conversion.cc:139
double pairCotThetaSeparation() const
Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used.
Definition: Conversion.cc:179
void setConversionAlgorithm(const ConversionAlgorithm a, bool set=true)
Conversion Track algorithm/provenance.
Definition: Conversion.h:167
double pairInvariantMass() const
if nTracks=2 returns the pair invariant mass. Original tracks are used here
Definition: Conversion.cc:159
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:206
uint8_t nSharedHits_
number of shared hits between tracks
Definition: Conversion.h:210
double EoverPrefittedTracks() const
Definition: Conversion.cc:229
const std::vector< math::XYZVectorF > & tracksPout() const
Vector of track momentum measured at the outermost hit.
Definition: Conversion.h:150
double MVAout() const
get the value of the TMVA output
Definition: Conversion.h:94
uint16_t qualityMask_
Definition: Conversion.h:208
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:16
const std::vector< reco::CaloClusterPtr > & bcMatchingWithTracks() const
Definition: Conversion.h:144
std::vector< float > theOneLegMVA_
vectors of TMVA outputs from pflow for one leg conversions
Definition: Conversion.h:203
std::string algoName() const
Definition: Conversion.h:217
std::vector< math::XYZPointF > theTrackInnerPosition_
P_in of tracks.
Definition: Conversion.h:193
std::vector< float > const oneLegMVA()
get the MVS output from PF for one leg conversions
Definition: Conversion.h:96
unsigned int nTracks() const
Number of tracks= 0,1,2.
Definition: Conversion.h:92
Conversion * clone() const
returns a clone of the candidate
Definition: Conversion.cc:148
math::XYZTLorentzVectorF refittedPair4Momentum() const
Conversion track pair 4-momentum from the tracks refitted with vertex constraint. ...
Definition: Conversion.cc:198
const std::vector< math::XYZVectorF > & tracksPin() const
Vector of track momentum measured at the innermost hit.
Definition: Conversion.h:152
uint8_t algorithm_
conversion algorithm/provenance
Definition: Conversion.h:212
const std::vector< math::XYZPointF > & tracksInnerPosition() const
Vector containing the position of the innermost hit of each track.
Definition: Conversion.h:148
math::XYZVectorF pairMomentum() const
Conversion tracks momentum from the tracks inner momentum.
Definition: Conversion.cc:191
const std::vector< math::XYZPointF > & ecalImpactPosition() const
Definition: Conversion.h:142
uint8_t nSharedHits() const
number of shared hits btw the two track
Definition: Conversion.h:158
double dEtaTracksAtEcal() const
Definition: Conversion.cc:303
double dz(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.cc:324
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< math::XYZVectorF > theTrackPin_
P_in of tracks.
Definition: Conversion.h:195
float theMVAout_
TMVA output.
Definition: Conversion.h:207
double b
Definition: hdecay.h:118
std::vector< reco::CaloClusterPtr > theMatchingBCs_
Clusters mathing the tracks (these are not the seeds)
Definition: Conversion.h:191
double lz(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.cc:350
void setMVAout(const float &mva)
set the value of the TMVA output
Definition: Conversion.h:161
float theMinDistOfApproach_
Distance of min approach of the two tracks.
Definition: Conversion.h:205
std::vector< math::XYZPointF > thePositionAtEcal_
position at the ECAl surface of the track extrapolation
Definition: Conversion.h:187
void setOneLegMVA(const std::vector< float > &mva)
set the MVS output from PF for one leg conversions
Definition: Conversion.h:163
double a
Definition: hdecay.h:119
std::vector< edm::RefToBase< reco::Track > > trackToBaseRefs_
vector Track RefToBase
Definition: Conversion.h:185
const std::vector< uint8_t > & nHitsBeforeVtx() const
Vector of the number of hits before the vertex along each track trajector.
Definition: Conversion.h:154
std::vector< Measurement1DFloat > dlClosestHitToVtx_
signed decay length and uncertainty from nearest hit on track to conversion vertex ...
Definition: Conversion.h:201
double dPhiTracksAtEcal() const
Definition: Conversion.cc:270
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:22
reco::Vertex theConversionVertex_
Fitted Kalman conversion vertex.
Definition: Conversion.h:189
bool isConverted() const
Bool flagging objects having track size &gt;0.
Definition: Conversion.cc:152
std::vector< uint8_t > nHitsBeforeVtx_
number of hits before the vertex on each trackerOnly
Definition: Conversion.h:199
reco::CaloClusterPtrVector caloCluster() const
Pointer to CaloCluster (foe Egamma Conversions it points to a SuperCluster)
Definition: Conversion.h:84
void setMatchingSuperCluster(const reco::CaloClusterPtrVector &sc)
Definition: Conversion.h:165
double dPhiTracksAtVtx() const
Definition: Conversion.cc:255
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
double dxy(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
Definition: Conversion.cc:313