CMS 3D CMS Logo

TP.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_TP_h
2 #define L1Trigger_TrackFindingTMTT_TP_h
3 
7 
10 
13 
14 #include <vector>
15 #include <list>
16 
17 namespace tmtt {
18 
19  class Stub;
20 
22 
23  class TP {
24  public:
25  // Fill useful info about tracking particle.
26  TP(const TrackingParticlePtr& tpPtr, unsigned int index_in_vTPs, const Settings* settings);
27 
28  // Return pointer to original tracking particle.
30 
31  bool operator==(const TP& tpOther) const { return (this->index() == tpOther.index()); }
32 
33  // Fill truth info with association from tracking particle to stubs.
34  void fillTruth(const std::list<Stub>& vStubs);
35 
36  // == Functions for returning info about tracking particles ===
37 
38  // Location in InputData::vTPs_
39  unsigned int index() const { return index_in_vTPs_; }
40  // Basic TP properties
41  int pdgId() const { return pdgId_; }
42  // Did TP come from in-time or out-of-time bunch crossing?
43  bool inTimeBx() const { return inTimeBx_; }
44  // Did it come from the main physics collision or from pileup?
45  bool physicsCollision() const { return physicsCollision_; }
46  int charge() const { return charge_; }
47  float mass() const { return mass_; }
48  float pt() const { return pt_; }
49  // Protect against pt=0;
50  float qOverPt() const {
51  constexpr float big = 9.9e9;
52  return (pt_ > 0) ? charge_ / pt_ : big;
53  }
54  float eta() const { return eta_; }
55  float theta() const { return theta_; }
56  float tanLambda() const { return tanLambda_; }
57  float phi0() const { return phi0_; }
58  // TP production vertex (x,y,z) coordinates.
59  float vx() const { return vx_; }
60  float vy() const { return vy_; }
61  float vz() const { return vz_; }
62  // d0 and z0 impact parameters with respect to (x,y) = (0,0).
63  float d0() const { return d0_; }
64  float z0() const { return z0_; }
65  // Estimate track bend angle at a given radius, ignoring scattering.
66  float dphi(float rad) const { return asin(settings_->invPtToDphi() * rad * charge_ / pt_); }
67  // Estimated phi angle at which TP trajectory crosses a given radius rad, ignoring scattering.
68  float trkPhiAtR(float rad) const { return reco::deltaPhi(phi0_ - this->dphi(rad) - d0_ / rad, 0.); }
69  // Estimated z coord at which TP trajectory crosses a given radius rad, ignoring scattering.
70  float trkZAtR(float rad) const { return (vz_ + rad * tanLambda_); }
71  // Estimated phi angle at which TP trajectory crosses the module containing the given stub.
72  float trkPhiAtStub(const Stub* stub) const;
73  // Estimated r coord at which TP trajectory crosses the module containing the given stub.
74  float trkRAtStub(const Stub* stub) const;
75  // Estimated z coord at which TP trajectory crosses the module containing the given stub.
76  float trkZAtStub(const Stub* stub) const;
77 
78  // == Functions returning stubs produced by tracking particle.
79  const std::vector<const Stub*>& assocStubs() const {
80  return assocStubs_;
81  } // associated stubs. (Includes those failing tightened front-end electronics cuts supplied by user). (Which stubs are returned is affected by "StubMatchStrict" config param.)
82  unsigned int numAssocStubs() const { return assocStubs_.size(); }
83  unsigned int numLayers() const { return nLayersWithStubs_; }
84  // TP is worth keeping (e.g. for fake rate measurement)
85  bool use() const { return use_; }
86  // TP can be used for efficiency measurement (good kinematics, in-time Bx, optionally specified PDG ID).
87  bool useForEff() const { return useForEff_; }
88  // TP can be used for algorithmic efficiency measurement (also requires stubs in enough layers).
89  bool useForAlgEff() const { return useForAlgEff_; }
90 
91  void fillNearestJetInfo(const reco::GenJetCollection* genJets); // Store info (deltaR, pt) with nearest jet
92 
93  // Check if TP is in a jet (for performance studies in jets)
94  float tpInJet(float genJetPtCut = 30.) const { return (tpInJet_ && nearestJetPt_ > genJetPtCut); }
95  float nearestJetPt() const { return nearestJetPt_; } // -ve if no nearest jet.
96 
97  private:
98  void fillUse(); // Fill the use_ flag.
99  void fillUseForEff(); // Fill the useForEff_ flag.
100  void fillUseForAlgEff(); // Fill the useforAlgEff_ flag.
101 
102  // Calculate how many tracker layers this TP has stubs in.
104 
105  private:
106  TrackingParticlePtr trackingParticlePtr_; // Pointer to original TrackingParticle.
107 
108  unsigned int index_in_vTPs_; // location of this TP in InputData::vTPs
109 
110  const Settings* settings_; // Configuration parameters
111 
112  int pdgId_;
113  bool inTimeBx_; // TP came from in-time bunch crossing.
114  bool physicsCollision_; // True if TP from physics collision rather than pileup.
115  int charge_;
116  float mass_;
117  float pt_; // TP kinematics
118  float eta_;
119  float theta_;
120  float tanLambda_;
121  float phi0_;
122  float vx_; // TP production point.
123  float vy_;
124  float vz_;
125  float d0_; // d0 impact parameter with respect to (x,y) = (0,0)
126  float z0_; // z0 impact parameter with respect to (x,y) = (0,0)
127 
128  std::vector<const Stub*> assocStubs_;
129  unsigned int nLayersWithStubs_; // Number of tracker layers with stubs from this TP.
130 
131  bool use_; // TP is worth keeping (e.g. for fake rate measurement)
132  bool useForEff_; // TP can be used for tracking efficiency measurement.
133  bool useForAlgEff_; // TP can be used for tracking algorithmic efficiency measurement.
134 
135  bool tpInJet_;
137  };
138 
139 } // namespace tmtt
140 
141 #endif
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double invPtToDphi() const
Definition: Settings.h:397
float phi0_
Definition: TP.h:121
edm::Ptr< TrackingParticle > TrackingParticlePtr
Definition: TP.h:19
void fillNearestJetInfo(const reco::GenJetCollection *genJets)
Definition: TP.cc:166
int pdgId_
Definition: TP.h:112
bool use() const
Definition: TP.h:85
float z0() const
Definition: TP.h:64
bool useForAlgEff() const
Definition: TP.h:89
float theta_
Definition: TP.h:119
unsigned int numAssocStubs() const
Definition: TP.h:82
int charge_
Definition: TP.h:115
std::vector< GenJet > GenJetCollection
collection of GenJet objects
float dphi(float rad) const
Definition: TP.h:66
float phi0() const
Definition: TP.h:57
bool useForEff_
Definition: TP.h:132
float vy_
Definition: TP.h:123
void fillUseForEff()
Definition: TP.cc:103
float vx() const
Definition: TP.h:59
bool useForEff() const
Definition: TP.h:87
float vx_
Definition: TP.h:122
float theta() const
Definition: TP.h:55
int charge() const
Definition: TP.h:46
float trkRAtStub(const Stub *stub) const
Definition: TP.cc:152
unsigned int index_in_vTPs_
Definition: TP.h:108
void calcNumLayers()
Definition: TP.h:103
void fillUse()
Definition: TP.cc:61
float eta() const
Definition: TP.h:54
float nearestJetPt_
Definition: TP.h:136
Definition: TP.h:23
TrackingParticlePtr trackingParticlePtr_
Definition: TP.h:106
unsigned int index() const
Definition: TP.h:39
float mass() const
Definition: TP.h:47
float trkPhiAtStub(const Stub *stub) const
Definition: TP.cc:143
const TrackingParticlePtr & trackingParticlePtr() const
Definition: TP.h:29
float tanLambda() const
Definition: TP.h:56
float vz_
Definition: TP.h:124
bool operator==(const TP &tpOther) const
Definition: TP.h:31
TP(const TrackingParticlePtr &tpPtr, unsigned int index_in_vTPs, const Settings *settings)
Definition: TP.cc:16
bool useForAlgEff_
Definition: TP.h:133
bool tpInJet_
Definition: TP.h:135
float mass_
Definition: TP.h:116
bool inTimeBx() const
Definition: TP.h:43
float pt_
Definition: TP.h:117
const Settings * settings_
Definition: TP.h:110
bool use_
Definition: TP.h:131
bool physicsCollision() const
Definition: TP.h:45
float d0_
Definition: TP.h:125
int pdgId() const
Definition: TP.h:41
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
float trkZAtR(float rad) const
Definition: TP.h:70
float eta_
Definition: TP.h:118
bool physicsCollision_
Definition: TP.h:114
float qOverPt() const
Definition: TP.h:50
float pt() const
Definition: TP.h:48
float d0() const
Definition: TP.h:63
float trkPhiAtR(float rad) const
Definition: TP.h:68
float z0_
Definition: TP.h:126
float vz() const
Definition: TP.h:61
Definition: big.h:8
void fillUseForAlgEff()
Definition: TP.cc:134
const std::vector< const Stub * > & assocStubs() const
Definition: TP.h:79
void fillTruth(const std::list< Stub > &vStubs)
Definition: TP.cc:45
bool inTimeBx_
Definition: TP.h:113
float nearestJetPt() const
Definition: TP.h:95
unsigned int countLayers(const Settings *settings, const std::vector< const Stub *> &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
unsigned int nLayersWithStubs_
Definition: TP.h:129
unsigned int numLayers() const
Definition: TP.h:83
float tanLambda_
Definition: TP.h:120
std::vector< const Stub * > assocStubs_
Definition: TP.h:128
float vy() const
Definition: TP.h:60
float tpInJet(float genJetPtCut=30.) const
Definition: TP.h:94
float trkZAtStub(const Stub *stub) const
Definition: TP.cc:161