Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:48

0001 #ifndef L1Trigger_TrackFindingTMTT_L1track2D_h
0002 #define L1Trigger_TrackFindingTMTT_L1track2D_h
0003 
0004 #include "FWCore/Utilities/interface/Exception.h"
0005 #include "L1Trigger/TrackFindingTMTT/interface/L1trackBase.h"
0006 #include "L1Trigger/TrackFindingTMTT/interface/Settings.h"
0007 #include "L1Trigger/TrackFindingTMTT/interface/Utility.h"
0008 #include "L1Trigger/TrackFindingTMTT/interface/TP.h"
0009 #include "L1Trigger/TrackFindingTMTT/interface/Stub.h"
0010 
0011 #include <vector>
0012 #include <utility>
0013 
0014 //=== L1 track cand found in 2 dimensions.
0015 //=== Gives access to all stubs on track and to its 2D helix parameters.
0016 //=== Also calculates & gives access to associated truth particle (Tracking Particle) if any.
0017 
0018 namespace tmtt {
0019 
0020   class L1track2D : public L1trackBase {
0021   public:
0022     // Give stubs on track, its cell location inside HT array, its 2D helix parameters.
0023     L1track2D(const Settings* settings,
0024               const std::vector<Stub*>& stubs,
0025               std::pair<unsigned int, unsigned int> cellLocationHT,
0026               std::pair<float, float> helix2D,
0027               unsigned int iPhiSec,
0028               unsigned int iEtaReg,
0029               unsigned int optoLinkID,
0030               bool mergedHTcell)
0031         : L1trackBase(),
0032           settings_(settings),
0033           stubs_(stubs),
0034           stubsConst_(stubs_.begin(), stubs_.end()),
0035           cellLocationHT_(cellLocationHT),
0036           helix2D_(helix2D),
0037           estValid_(false),
0038           estZ0_(0.),
0039           estTanLambda_(0.),
0040           iPhiSec_(iPhiSec),
0041           iEtaReg_(iEtaReg),
0042           optoLinkID_(optoLinkID),
0043           mergedHTcell_(mergedHTcell) {
0044       nLayers_ = Utility::countLayers(settings, stubs_);  // Count tracker layers these stubs are in
0045       matchedTP_ = Utility::matchingTP(settings,
0046                                        stubs_,
0047                                        nMatchedLayers_,
0048                                        matchedStubs_);  // Find associated truth particle & calculate info about match.
0049     }
0050 
0051     ~L1track2D() override = default;
0052 
0053     //--- Get information about the reconstructed track.
0054 
0055     // Get stubs on track candidate.
0056     const std::vector<const Stub*>& stubsConst() const override { return stubsConst_; }
0057     const std::vector<Stub*>& stubs() const override { return stubs_; }
0058     // Get number of stubs on track candidate.
0059     unsigned int numStubs() const override { return stubs_.size(); }
0060     // Get number of tracker layers these stubs are in.
0061     unsigned int numLayers() const override { return nLayers_; }
0062     // Get cell location of track candidate in Hough Transform array in units of bin number.
0063     std::pair<unsigned int, unsigned int> cellLocationHT() const override { return cellLocationHT_; }
0064     // The two conventionally agreed track helix parameters relevant in this 2D plane.
0065     // i.e. (q/Pt, phi0).
0066     std::pair<float, float> helix2D() const { return helix2D_; }
0067 
0068     //--- User-friendlier access to the helix parameters obtained from track location inside HT array.
0069 
0070     float qOverPt() const override { return helix2D_.first; }
0071     float phi0() const override { return helix2D_.second; }
0072 
0073     //--- In the case of tracks found by the r-phi HT, a rough estimate of the (z0, tan_lambda) may be provided by any r-z
0074     //--- track filter run after the r-phi HT. These two functions give std::set/get access to these.
0075     //--- The "get" function returns a boolean indicating if an estimate exists (i.e. "set" has been called).
0076 
0077     void setTrkEstZ0andTanLam(float estZ0, float estTanLambda) {
0078       estZ0_ = estZ0;
0079       estTanLambda_ = estTanLambda;
0080       estValid_ = true;
0081     }
0082 
0083     bool trkEstZ0andTanLam(float& estZ0, float& estTanLambda) const {
0084       estZ0 = estZ0_;
0085       estTanLambda = estTanLambda_;
0086       return estValid_;
0087     }
0088 
0089     //--- Get phi sector and eta region used by track finding code that this track is in.
0090     unsigned int iPhiSec() const override { return iPhiSec_; }
0091     unsigned int iEtaReg() const override { return iEtaReg_; }
0092 
0093     //--- Opto-link ID used to send this track from HT to Track Fitter. Both read & write functions.
0094     unsigned int optoLinkID() const override { return optoLinkID_; }
0095     void setOptoLinkID(unsigned int linkID) { optoLinkID_ = linkID; }
0096 
0097     //--- Was this track produced from a marged HT cell (e.g. 2x2)?
0098     bool mergedHTcell() const { return mergedHTcell_; }
0099 
0100     //--- Get information about its association (if any) to a truth Tracking Particle.
0101 
0102     // Get matching tracking particle (=nullptr if none).
0103     const TP* matchedTP() const override { return matchedTP_; }
0104     // Get the matched stubs.
0105     const std::vector<const Stub*>& matchedStubs() const override { return matchedStubs_; }
0106     // Get number of matched stubs.
0107     unsigned int numMatchedStubs() const override { return matchedStubs_.size(); }
0108     // Get number of tracker layers with matched stubs.
0109     unsigned int numMatchedLayers() const override { return nMatchedLayers_; }
0110 
0111   private:
0112     //--- Configuration parameters
0113     const Settings* settings_;
0114 
0115     //--- Information about the reconstructed track from Hough transform.
0116     std::vector<Stub*> stubs_;
0117     std::vector<const Stub*> stubsConst_;
0118     unsigned int nLayers_;
0119     std::pair<unsigned int, unsigned int> cellLocationHT_;
0120     std::pair<float, float> helix2D_;
0121 
0122     //--- Rough estimate of r-z track parameters from r-z filter, which may be present in case of r-phi Hough transform
0123     bool estValid_;
0124     float estZ0_;
0125     float estTanLambda_;
0126 
0127     unsigned int iPhiSec_;
0128     unsigned int iEtaReg_;
0129     unsigned int optoLinkID_;
0130 
0131     bool mergedHTcell_;
0132 
0133     //--- Information about its association (if any) to a truth Tracking Particle.
0134     const TP* matchedTP_;
0135     std::vector<const Stub*> matchedStubs_;
0136     unsigned int nMatchedLayers_;
0137   };
0138 
0139 }  // namespace tmtt
0140 
0141 #endif