Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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       if (layer_.value() == -1) {
0047         return str() + "|" + negdisk_.str() + "|" + stubindex_.str() + "|" + finephi.str();
0048       } else {
0049         return str() + "|" + stubindex_.str() + "|" + finephi.str();
0050       }
0051     }
0052 
0053     FPGAWord allStubIndex() const { return stubindex_; }
0054 
0055     unsigned int phiregionaddress() const;
0056     std::string phiregionaddressstr() const;
0057     std::string phiregionstr() const;
0058 
0059     void setAllStubIndex(int nstub);  //should migrate away from using this method
0060 
0061     void setPhiCorr(int phiCorr);
0062 
0063     const FPGAWord& bend() const { return bend_; }
0064 
0065     const FPGAWord& r() const { return r_; }
0066     const FPGAWord& z() const { return z_; }
0067     const FPGAWord& negdisk() const { return negdisk_; }
0068     const FPGAWord& phi() const { return phi_; }
0069     const FPGAWord& phicorr() const { return phicorr_; }
0070     const FPGAWord& alpha() const { return alpha_; }
0071 
0072     const FPGAWord& stubindex() const { return stubindex_; }
0073     const FPGAWord& layer() const { return layer_; }
0074     const FPGAWord& disk() const { return disk_; }
0075     unsigned int layerdisk() const;
0076 
0077     bool isPSmodule() const { return (layerdisk_ < N_LAYER) ? (layerdisk_ < N_PSLAYER) : (r_.value() > 10); }
0078 
0079     double rapprox() const;
0080     double zapprox() const;
0081     double phiapprox(double phimin, double) const;
0082 
0083     L1TStub* l1tstub() { return l1tstub_; }
0084     const L1TStub* l1tstub() const { return l1tstub_; }
0085     void setl1tstub(L1TStub* l1tstub) { l1tstub_ = l1tstub; }
0086 
0087     bool isBarrel() const { return layerdisk_ < N_LAYER; }
0088 
0089   private:
0090     unsigned int layerdisk_;
0091 
0092     FPGAWord layer_;
0093     FPGAWord disk_;
0094     FPGAWord r_;
0095     FPGAWord z_;
0096     FPGAWord negdisk_;
0097     FPGAWord phi_;
0098     FPGAWord alpha_;
0099 
0100     FPGAWord bend_;
0101 
0102     FPGAWord phicorr_;  //Corrected for bend to nominal radius
0103 
0104     FPGAWord stubindex_;
0105 
0106     L1TStub* l1tstub_;
0107     Settings const& settings_;
0108   };
0109 
0110 };  // namespace trklet
0111 #endif