CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Stub.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_Stub_h
2 #define L1Trigger_TrackFindingTracklet_interface_Stub_h
3 
4 #include <iostream>
5 #include <fstream>
6 #include <cassert>
7 #include <cmath>
8 
13 
14 namespace trklet {
15 
16  class Globals;
17 
18  class Stub {
19  public:
20  Stub(Settings const& settings);
21 
22  Stub(L1TStub& stub, Settings const& settings, Globals& globals);
23 
24  ~Stub() = default;
25 
26  FPGAWord iphivmFineBins(int VMbits, int finebits) const;
27 
28  std::string str() const {
29  if (layer_.value() != -1) {
30  return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
31  } else {
32  if (isPSmodule()) {
33  return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
34  } else {
35  return "000" + r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + alpha_.str() + "|" + bend_.str();
36  }
37  }
38  }
39 
40  std::string strbare() const { return bend_.str() + r_.str() + z_.str() + phi_.str(); }
41 
43  unsigned int nbitsfinephi = 8;
44  FPGAWord finephi(
45  phicorr_.bits(phicorr_.nbits() - nbitsfinephi, nbitsfinephi), nbitsfinephi, true, __LINE__, __FILE__);
46  return str() + "|" + stubindex_.str() + "|" + finephi.str();
47  }
48 
49  FPGAWord allStubIndex() const { return stubindex_; }
50 
51  unsigned int phiregionaddress() const;
53 
54  void setAllStubIndex(int nstub); //should migrate away from using this method
55 
56  void setPhiCorr(int phiCorr);
57 
58  const FPGAWord& bend() const { return bend_; }
59 
60  const FPGAWord& r() const { return r_; }
61  const FPGAWord& z() const { return z_; }
62  const FPGAWord& phi() const { return phi_; }
63  const FPGAWord& phicorr() const { return phicorr_; }
64  const FPGAWord& alpha() const { return alpha_; }
65 
66  const FPGAWord& stubindex() const { return stubindex_; }
67  const FPGAWord& layer() const { return layer_; }
68  const FPGAWord& disk() const { return disk_; }
69  unsigned int layerdisk() const;
70 
71  bool isPSmodule() const { return (layerdisk_ < N_LAYER) ? (layerdisk_ < N_PSLAYER) : (r_.value() > 10); }
72 
73  double rapprox() const;
74  double zapprox() const;
75  double phiapprox(double phimin, double) const;
76 
77  L1TStub* l1tstub() { return l1tstub_; }
78  const L1TStub* l1tstub() const { return l1tstub_; }
80 
81  bool isBarrel() const { return layerdisk_ < N_LAYER; }
82 
83  private:
84  unsigned int layerdisk_;
85 
92 
94 
95  FPGAWord phicorr_; //Corrected for bend to nominal radius
96 
98 
101  };
102 
103 }; // namespace trklet
104 #endif
const FPGAWord & stubindex() const
Definition: Stub.h:66
const FPGAWord & bend() const
Definition: Stub.h:58
const FPGAWord & disk() const
Definition: Stub.h:68
FPGAWord phi_
Definition: Stub.h:90
const FPGAWord & phicorr() const
Definition: Stub.h:63
FPGAWord alpha_
Definition: Stub.h:91
std::string strinner() const
Definition: Stub.h:42
Stub(Settings const &settings)
Definition: Stub.cc:15
int nbits() const
Definition: FPGAWord.h:25
FPGAWord r_
Definition: Stub.h:88
FPGAWord layer_
Definition: Stub.h:86
const L1TStub * l1tstub() const
Definition: Stub.h:78
~Stub()=default
bool isPSmodule() const
Definition: Stub.h:71
const FPGAWord & layer() const
Definition: Stub.h:67
FPGAWord allStubIndex() const
Definition: Stub.h:49
std::string phiregionaddressstr() const
Definition: Stub.cc:117
double phiapprox(double phimin, double) const
Definition: Stub.cc:177
FPGAWord phicorr_
Definition: Stub.h:95
FPGAWord z_
Definition: Stub.h:89
FPGAWord disk_
Definition: Stub.h:87
double zapprox() const
Definition: Stub.cc:158
int value() const
Definition: FPGAWord.h:24
void setAllStubIndex(int nstub)
Definition: Stub.cc:123
FPGAWord bend_
Definition: Stub.h:93
std::string strbare() const
Definition: Stub.h:40
unsigned int bits(unsigned int lsb, unsigned int nbit) const
Definition: FPGAWord.cc:74
L1TStub * l1tstub()
Definition: Stub.h:77
bool isBarrel() const
Definition: Stub.h:81
const FPGAWord & z() const
Definition: Stub.h:61
void setPhiCorr(int phiCorr)
Definition: Stub.cc:133
constexpr unsigned int N_PSLAYER
Definition: Settings.h:23
const FPGAWord & phi() const
Definition: Stub.h:62
FPGAWord iphivmFineBins(int VMbits, int finebits) const
Definition: Stub.cc:107
L1TStub * l1tstub_
Definition: Stub.h:99
const FPGAWord & alpha() const
Definition: Stub.h:64
unsigned int layerdisk() const
Definition: Stub.cc:185
unsigned int phiregionaddress() const
Definition: Stub.cc:112
std::string str() const
Definition: FPGAWord.cc:54
Settings const & settings_
Definition: Stub.h:100
double rapprox() const
Definition: Stub.cc:144
const FPGAWord & r() const
Definition: Stub.h:60
std::string str() const
Definition: Stub.h:28
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:79
FPGAWord stubindex_
Definition: Stub.h:97
unsigned int layerdisk_
Definition: Stub.h:84
constexpr int N_LAYER
Definition: Settings.h:21