Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-14 01:44:00

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_Track_h
0002 #define L1Trigger_TrackFindingTracklet_interface_Track_h
0003 
0004 #include <iostream>
0005 #include <fstream>
0006 #include <cassert>
0007 #include <cmath>
0008 #include <vector>
0009 #include <map>
0010 
0011 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0012 #include "L1Trigger/TrackFindingTracklet/interface/Util.h"
0013 #include "L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h"
0014 #include "L1Trigger/TrackFindingTracklet/interface/TrackPars.h"
0015 
0016 namespace trklet {
0017 
0018   class Track {
0019   public:
0020     // Create track from digitized helix params & stubs
0021     Track(TrackPars<int> ipars,  // digi helix
0022           int ichisqrphi,        // digi chi2
0023           int ichisqrz,
0024           double chisqrphi,
0025           double chisqrz,
0026           int hitpattern,
0027           std::map<int, int> stubID,
0028           const std::vector<L1TStub>& l1stub,
0029           int seed);
0030 
0031     ~Track() = default;
0032 
0033     void setDuplicate(bool flag) { duplicate_ = flag; }
0034     void setSector(int nsec) { sector_ = nsec; }
0035     void setStubIDpremerge(std::vector<std::pair<int, int>> stubIDpremerge) { stubIDpremerge_ = stubIDpremerge; }
0036     void setStubIDprefit(std::vector<std::pair<int, int>> stubIDprefit) { stubIDprefit_ = stubIDprefit; }
0037 
0038     const TrackPars<int>& pars() const { return ipars_; }
0039 
0040     int ichisq() const { return ichisqrphi_ + ichisqrz_; }
0041 
0042     const std::map<int, int>& stubID() const { return stubID_; }
0043     const std::vector<L1TStub>& stubs() const { return l1stub_; }
0044 
0045     //These are not used? Should be removed?
0046     const std::vector<std::pair<int, int>>& stubIDpremerge() const { return stubIDpremerge_; }
0047     const std::vector<std::pair<int, int>>& stubIDprefit() const { return stubIDprefit_; }
0048 
0049     int hitpattern() const { return hitpattern_; }
0050     int seed() const { return seed_; }
0051     int duplicate() const { return duplicate_; }
0052     int sector() const { return sector_; }
0053 
0054     double pt(Settings const& settings) const {
0055       return (settings.c() * settings.bfield() * 0.01) / (ipars_.rinv() * settings.krinvpars());
0056     }
0057 
0058     // Get floating point helix params by undigitized digi helix params
0059     double phi0(Settings const& settings) const;
0060 
0061     //The following return the floating point track parameters by undigitizing the digitized parameters
0062     double eta(Settings const& settings) const { return (asinh(ipars_.t() + 0.5) * settings.ktpars()); }
0063     double tanL(Settings const& settings) const { return (ipars_.t() + 0.5) * settings.ktpars(); }
0064     double z0(Settings const& settings) const { return (ipars_.z0() + 0.5) * settings.kz0pars(); }
0065     double rinv(Settings const& settings) const { return (ipars_.rinv() + 0.5) * settings.krinvpars(); }
0066     double d0(Settings const& settings) const { return (ipars_.d0() + 0.5) * settings.kd0pars(); }
0067     double chisq() const { return chisqrphi_ + chisqrz_; }
0068 
0069     double chisqrphi() const { return chisqrphi_; }
0070     double chisqrz() const { return chisqrz_; }
0071 
0072     int nPSstubs() const {
0073       int npsstubs = 0;
0074       for (const auto& istub : l1stub_) {
0075         if (istub.layer() < N_PSLAYER)
0076           npsstubs++;
0077       }
0078       return npsstubs;
0079     }
0080 
0081   private:
0082     TrackPars<int> ipars_;  //digitized track parameters
0083     int ichisqrphi_;
0084     int ichisqrz_;
0085 
0086     double chisqrphi_;
0087     double chisqrz_;
0088 
0089     int hitpattern_;
0090 
0091     std::vector<std::pair<int, int>> stubIDpremerge_;
0092     std::vector<std::pair<int, int>> stubIDprefit_;
0093     std::map<int, int> stubID_;
0094     std::vector<L1TStub> l1stub_;
0095 
0096     unsigned int nstubs_;
0097     int seed_;
0098     bool duplicate_;
0099     int sector_;
0100   };
0101 
0102 };  // namespace trklet
0103 #endif