File indexing completed on 2024-04-06 12:21:49
0001 #ifndef L1Trigger_TrackFindingTMTT_TP_h
0002 #define L1Trigger_TrackFindingTMTT_TP_h
0003
0004 #include "DataFormats/Math/interface/deltaPhi.h"
0005 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0006 #include "DataFormats/Common/interface/Ptr.h"
0007
0008 #include "L1Trigger/TrackFindingTMTT/interface/Settings.h"
0009 #include "L1Trigger/TrackFindingTMTT/interface/Utility.h"
0010
0011 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0012 #include "DataFormats/JetReco/interface/GenJet.h"
0013
0014 #include <vector>
0015 #include <list>
0016
0017 namespace tmtt {
0018
0019 class Stub;
0020
0021 typedef edm::Ptr<TrackingParticle> TrackingParticlePtr;
0022
0023 class TP {
0024 public:
0025
0026 TP(const TrackingParticlePtr& tpPtr, unsigned int index_in_vTPs, const Settings* settings);
0027
0028
0029 const TrackingParticlePtr& trackingParticlePtr() const { return trackingParticlePtr_; }
0030
0031 bool operator==(const TP& tpOther) const { return (this->index() == tpOther.index()); }
0032
0033
0034 void fillTruth(const std::list<Stub>& vStubs);
0035
0036
0037
0038
0039 unsigned int index() const { return index_in_vTPs_; }
0040
0041 int pdgId() const { return pdgId_; }
0042
0043 bool inTimeBx() const { return inTimeBx_; }
0044
0045 bool physicsCollision() const { return physicsCollision_; }
0046 int charge() const { return charge_; }
0047 float mass() const { return mass_; }
0048 float pt() const { return pt_; }
0049
0050 float qOverPt() const {
0051 constexpr float big = 9.9e9;
0052 return (pt_ > 0) ? charge_ / pt_ : big;
0053 }
0054 float eta() const { return eta_; }
0055 float theta() const { return theta_; }
0056 float tanLambda() const { return tanLambda_; }
0057 float phi0() const { return phi0_; }
0058
0059 float vx() const { return vx_; }
0060 float vy() const { return vy_; }
0061 float vz() const { return vz_; }
0062
0063 float d0() const { return d0_; }
0064 float z0() const { return z0_; }
0065
0066 float dphi(float rad) const { return asin(settings_->invPtToDphi() * rad * charge_ / pt_); }
0067
0068 float trkPhiAtR(float rad) const { return reco::deltaPhi(phi0_ - this->dphi(rad) - d0_ / rad, 0.); }
0069
0070 float trkZAtR(float rad) const { return (vz_ + rad * tanLambda_); }
0071
0072 float trkPhiAtStub(const Stub* stub) const;
0073
0074 float trkRAtStub(const Stub* stub) const;
0075
0076 float trkZAtStub(const Stub* stub) const;
0077
0078
0079 const std::vector<const Stub*>& assocStubs() const {
0080 return assocStubs_;
0081 }
0082 unsigned int numAssocStubs() const { return assocStubs_.size(); }
0083 unsigned int numLayers() const { return nLayersWithStubs_; }
0084
0085 bool use() const { return use_; }
0086
0087 bool useForEff() const { return useForEff_; }
0088
0089 bool useForAlgEff() const { return useForAlgEff_; }
0090
0091 void fillNearestJetInfo(const reco::GenJetCollection* genJets);
0092
0093
0094 float tpInJet(float genJetPtCut = 30.) const { return (tpInJet_ && nearestJetPt_ > genJetPtCut); }
0095 float nearestJetPt() const { return nearestJetPt_; }
0096
0097 private:
0098 void fillUse();
0099 void fillUseForEff();
0100 void fillUseForAlgEff();
0101
0102
0103 void calcNumLayers() { nLayersWithStubs_ = Utility::countLayers(settings_, assocStubs_, false); }
0104
0105 private:
0106 TrackingParticlePtr trackingParticlePtr_;
0107
0108 unsigned int index_in_vTPs_;
0109
0110 const Settings* settings_;
0111
0112 int pdgId_;
0113 bool inTimeBx_;
0114 bool physicsCollision_;
0115 int charge_;
0116 float mass_;
0117 float pt_;
0118 float eta_;
0119 float theta_;
0120 float tanLambda_;
0121 float phi0_;
0122 float vx_;
0123 float vy_;
0124 float vz_;
0125 float d0_;
0126 float z0_;
0127
0128 std::vector<const Stub*> assocStubs_;
0129 unsigned int nLayersWithStubs_;
0130
0131 bool use_;
0132 bool useForEff_;
0133 bool useForAlgEff_;
0134
0135 bool tpInJet_;
0136 float nearestJetPt_;
0137 };
0138
0139 }
0140
0141 #endif