Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:28

0001 #ifndef L1Trigger_TrackFindingTracklet_interface_Stub_h
0002 #define L1Trigger_TrackFindingTracklet_interface_Stub_h
0003 
0004 #include <iostream>
0005 #include <fstream>
0006 #include <cassert>
0007 #include <cmath>
0008 
0009 #include "L1Trigger/TrackFindingTracklet/interface/FPGAWord.h"
0010 #include "L1Trigger/TrackFindingTracklet/interface/L1TStub.h"
0011 #include "L1Trigger/TrackFindingTracklet/interface/Util.h"
0012 #include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
0013 
0014 namespace trklet {
0015 
0016   class Globals;
0017 
0018   class Stub {
0019   public:
0020     Stub(Settings const& settings);
0021 
0022     Stub(L1TStub& stub, Settings const& settings, Globals& globals);
0023 
0024     ~Stub() = default;
0025 
0026     FPGAWord iphivmFineBins(int VMbits, int finebits) const;
0027 
0028     std::string str() const {
0029       if (layer_.value() != -1) {
0030         return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
0031       } else {
0032         if (isPSmodule()) {
0033           return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
0034         } else {
0035           return "000" + r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + alpha_.str() + "|" + bend_.str();
0036         }
0037       }
0038     }
0039 
0040     std::string strbare() const { return bend_.str() + r_.str() + z_.str() + phi_.str(); }
0041 
0042     std::string strinner() const {
0043       unsigned int nbitsfinephi = 8;
0044       FPGAWord finephi(
0045           phicorr_.bits(phicorr_.nbits() - nbitsfinephi, nbitsfinephi), nbitsfinephi, true, __LINE__, __FILE__);
0046       return str() + "|" + stubindex_.str() + "|" + finephi.str();
0047     }
0048 
0049     FPGAWord allStubIndex() const { return stubindex_; }
0050 
0051     unsigned int phiregionaddress() const;
0052     std::string phiregionaddressstr() const;
0053 
0054     void setAllStubIndex(int nstub);  //should migrate away from using this method
0055 
0056     void setPhiCorr(int phiCorr);
0057 
0058     const FPGAWord& bend() const { return bend_; }
0059 
0060     const FPGAWord& r() const { return r_; }
0061     const FPGAWord& z() const { return z_; }
0062     const FPGAWord& phi() const { return phi_; }
0063     const FPGAWord& phicorr() const { return phicorr_; }
0064     const FPGAWord& alpha() const { return alpha_; }
0065 
0066     const FPGAWord& stubindex() const { return stubindex_; }
0067     const FPGAWord& layer() const { return layer_; }
0068     const FPGAWord& disk() const { return disk_; }
0069     unsigned int layerdisk() const;
0070 
0071     bool isPSmodule() const { return (layerdisk_ < N_LAYER) ? (layerdisk_ < N_PSLAYER) : (r_.value() > 10); }
0072 
0073     double rapprox() const;
0074     double zapprox() const;
0075     double phiapprox(double phimin, double) const;
0076 
0077     L1TStub* l1tstub() { return l1tstub_; }
0078     const L1TStub* l1tstub() const { return l1tstub_; }
0079     void setl1tstub(L1TStub* l1tstub) { l1tstub_ = l1tstub; }
0080 
0081     bool isBarrel() const { return layerdisk_ < N_LAYER; }
0082 
0083   private:
0084     unsigned int layerdisk_;
0085 
0086     FPGAWord layer_;
0087     FPGAWord disk_;
0088     FPGAWord r_;
0089     FPGAWord z_;
0090     FPGAWord phi_;
0091     FPGAWord alpha_;
0092 
0093     FPGAWord bend_;
0094 
0095     FPGAWord phicorr_;  //Corrected for bend to nominal radius
0096 
0097     FPGAWord stubindex_;
0098 
0099     L1TStub* l1tstub_;
0100     Settings const& settings_;
0101   };
0102 
0103 };  // namespace trklet
0104 #endif