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
tmtt::TP::trkPhiAtStub
float trkPhiAtStub(const Stub *stub) const
Definition: TP.cc:143
tmtt::TP::mass_
float mass_
Definition: TP.h:116
tmtt::Settings::invPtToDphi
double invPtToDphi() const
Definition: Settings.h:397
tmtt::TP::inTimeBx
bool inTimeBx() const
Definition: TP.h:43
GenJetCollection.h
L1CaloJetHTTProducer_cfi.genJets
genJets
Definition: L1CaloJetHTTProducer_cfi.py:7
tmtt::TP::vz_
float vz_
Definition: TP.h:124
tmtt::TP::operator==
bool operator==(const TP &tpOther) const
Definition: TP.h:31
tmtt::TP::useForAlgEff_
bool useForAlgEff_
Definition: TP.h:133
tmtt::Utility::countLayers
unsigned int countLayers(const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
tmtt::TP::d0_
float d0_
Definition: TP.h:125
reco::GenJetCollection
std::vector< GenJet > GenJetCollection
collection of GenJet objects
Definition: GenJetCollection.h:14
tmtt::TP::pt_
float pt_
Definition: TP.h:117
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
deltaPhi.h
tmtt::TP::trkZAtR
float trkZAtR(float rad) const
Definition: TP.h:70
tmtt::TP::physicsCollision_
bool physicsCollision_
Definition: TP.h:114
tmtt::TP::eta_
float eta_
Definition: TP.h:118
tmtt::TP::use_
bool use_
Definition: TP.h:131
tmtt::TP::settings_
const Settings * settings_
Definition: TP.h:110
tmtt::TP::physicsCollision
bool physicsCollision() const
Definition: TP.h:45
tmtt::TP::qOverPt
float qOverPt() const
Definition: TP.h:50
tmtt::TP::pt
float pt() const
Definition: TP.h:48
tmtt::TP::pdgId
int pdgId() const
Definition: TP.h:41
tmtt::TP::trkPhiAtR
float trkPhiAtR(float rad) const
Definition: TP.h:68
tmtt::TP::z0_
float z0_
Definition: TP.h:126
tmtt::TP
Definition: TP.h:23
tmtt::TP::vz
float vz() const
Definition: TP.h:61
tmtt::TP::d0
float d0() const
Definition: TP.h:63
tmtt::TP::assocStubs
const std::vector< const Stub * > & assocStubs() const
Definition: TP.h:79
tmtt::TP::fillTruth
void fillTruth(const std::list< Stub > &vStubs)
Definition: TP.cc:45
Utility.h
tmtt::TP::inTimeBx_
bool inTimeBx_
Definition: TP.h:113
tmtt::TP::fillUseForAlgEff
void fillUseForAlgEff()
Definition: TP.cc:134
tmtt::TP::nLayersWithStubs_
unsigned int nLayersWithStubs_
Definition: TP.h:129
tmtt::TP::tpInJet
float tpInJet(float genJetPtCut=30.) const
Definition: TP.h:94
tmtt::TP::nearestJetPt
float nearestJetPt() const
Definition: TP.h:95
tmtt::TP::tanLambda_
float tanLambda_
Definition: TP.h:120
tmtt::TP::assocStubs_
std::vector< const Stub * > assocStubs_
Definition: TP.h:128
tmtt::TP::numLayers
unsigned int numLayers() const
Definition: TP.h:83
tmtt::TP::vy
float vy() const
Definition: TP.h:60
tmtt::TP::trkZAtStub
float trkZAtStub(const Stub *stub) const
Definition: TP.cc:161
tmtt::TP::fillNearestJetInfo
void fillNearestJetInfo(const reco::GenJetCollection *genJets)
Definition: TP.cc:166
tmtt::TP::pdgId_
int pdgId_
Definition: TP.h:112
tmtt::TP::use
bool use() const
Definition: TP.h:85
tmtt::TP::useForAlgEff
bool useForAlgEff() const
Definition: TP.h:89
tmtt::Settings
Definition: Settings.h:17
tmtt::TP::phi0_
float phi0_
Definition: TP.h:121
Ptr.h
tmtt::TP::charge_
int charge_
Definition: TP.h:115
tmtt::TP::dphi
float dphi(float rad) const
Definition: TP.h:66
tmtt::TP::phi0
float phi0() const
Definition: TP.h:57
tmtt::TP::vy_
float vy_
Definition: TP.h:123
tmtt::TP::z0
float z0() const
Definition: TP.h:64
tmtt::TP::useForEff_
bool useForEff_
Definition: TP.h:132
edm::Ptr< TrackingParticle >
tmtt::TP::theta_
float theta_
Definition: TP.h:119
tmtt::TP::vx
float vx() const
Definition: TP.h:59
TrackingParticle.h
tmtt::TP::numAssocStubs
unsigned int numAssocStubs() const
Definition: TP.h:82
tmtt::TP::charge
int charge() const
Definition: TP.h:46
tmtt::TP::trkRAtStub
float trkRAtStub(const Stub *stub) const
Definition: TP.cc:152
Settings.h
tmtt::TrackingParticlePtr
edm::Ptr< TrackingParticle > TrackingParticlePtr
Definition: TP.h:19
tmtt::TP::calcNumLayers
void calcNumLayers()
Definition: TP.h:103
tmtt::TP::fillUseForEff
void fillUseForEff()
Definition: TP.cc:103
tmtt::TP::useForEff
bool useForEff() const
Definition: TP.h:87
tmtt::TP::vx_
float vx_
Definition: TP.h:122
tmtt::TP::nearestJetPt_
float nearestJetPt_
Definition: TP.h:136
big
Definition: big.h:8
tmtt::TP::theta
float theta() const
Definition: TP.h:55
GenJet.h
tmtt::TP::index_in_vTPs_
unsigned int index_in_vTPs_
Definition: TP.h:108
tmtt::TP::mass
float mass() const
Definition: TP.h:47
tmtt::TP::index
unsigned int index() const
Definition: TP.h:39
tmtt::TP::trackingParticlePtr_
TrackingParticlePtr trackingParticlePtr_
Definition: TP.h:106
tmtt::TP::trackingParticlePtr
const TrackingParticlePtr & trackingParticlePtr() const
Definition: TP.h:29
tmtt::Stub
Definition: Stub.h:43
tmtt::TP::fillUse
void fillUse()
Definition: TP.cc:61
tmtt::TP::tanLambda
float tanLambda() const
Definition: TP.h:56
tmtt
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
tmtt::TP::eta
float eta() const
Definition: TP.h:54
tmtt::TP::TP
TP(const TrackingParticlePtr &tpPtr, unsigned int index_in_vTPs, const Settings *settings)
Definition: TP.cc:16
tmtt::TP::tpInJet_
bool tpInJet_
Definition: TP.h:135