CMS 3D CMS Logo

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  if (layer_.value() == -1) {
47  return str() + "|" + negdisk_.str() + "|" + stubindex_.str() + "|" + finephi.str();
48  } else {
49  return str() + "|" + stubindex_.str() + "|" + finephi.str();
50  }
51  }
52 
53  FPGAWord allStubIndex() const { return stubindex_; }
54 
55  unsigned int phiregionaddress() const;
57  std::string phiregionstr() const;
58 
59  void setAllStubIndex(int nstub); //should migrate away from using this method
60 
61  void setPhiCorr(int phiCorr);
62 
63  const FPGAWord& bend() const { return bend_; }
64 
65  const FPGAWord& r() const { return r_; }
66  const FPGAWord& z() const { return z_; }
67  const FPGAWord& negdisk() const { return negdisk_; }
68  const FPGAWord& phi() const { return phi_; }
69  const FPGAWord& phicorr() const { return phicorr_; }
70  const FPGAWord& alpha() const { return alpha_; }
71 
72  const FPGAWord& stubindex() const { return stubindex_; }
73  const FPGAWord& layer() const { return layer_; }
74  const FPGAWord& disk() const { return disk_; }
75  unsigned int layerdisk() const;
76 
77  bool isPSmodule() const { return (layerdisk_ < N_LAYER) ? (layerdisk_ < N_PSLAYER) : (r_.value() > 10); }
78 
79  double rapprox() const;
80  double zapprox() const;
81  double phiapprox(double phimin, double) const;
82 
83  L1TStub* l1tstub() { return l1tstub_; }
84  const L1TStub* l1tstub() const { return l1tstub_; }
86 
87  bool isBarrel() const { return layerdisk_ < N_LAYER; }
88 
89  private:
90  unsigned int layerdisk_;
91 
99 
101 
102  FPGAWord phicorr_; //Corrected for bend to nominal radius
103 
105 
108  };
109 
110 }; // namespace trklet
111 #endif
FPGAWord phi_
Definition: Stub.h:97
double zapprox() const
Definition: Stub.cc:166
FPGAWord alpha_
Definition: Stub.h:98
const FPGAWord & r() const
Definition: Stub.h:65
const FPGAWord & negdisk() const
Definition: Stub.h:67
double phiapprox(double phimin, double) const
Definition: Stub.cc:185
Stub(Settings const &settings)
Definition: Stub.cc:15
const FPGAWord & z() const
Definition: Stub.h:66
std::string strinner() const
Definition: Stub.h:42
FPGAWord r_
Definition: Stub.h:94
FPGAWord layer_
Definition: Stub.h:92
~Stub()=default
std::string strbare() const
Definition: Stub.h:40
bool isBarrel() const
Definition: Stub.h:87
const FPGAWord & bend() const
Definition: Stub.h:63
std::string phiregionaddressstr() const
Definition: Stub.cc:119
FPGAWord phicorr_
Definition: Stub.h:102
FPGAWord z_
Definition: Stub.h:95
const FPGAWord & disk() const
Definition: Stub.h:74
FPGAWord iphivmFineBins(int VMbits, int finebits) const
Definition: Stub.cc:109
FPGAWord disk_
Definition: Stub.h:93
void setAllStubIndex(int nstub)
Definition: Stub.cc:131
FPGAWord bend_
Definition: Stub.h:100
unsigned int phiregionaddress() const
Definition: Stub.cc:114
int value() const
Definition: FPGAWord.h:24
L1TStub * l1tstub()
Definition: Stub.h:83
FPGAWord negdisk_
Definition: Stub.h:96
unsigned int layerdisk() const
Definition: Stub.cc:193
double rapprox() const
Definition: Stub.cc:152
const L1TStub * l1tstub() const
Definition: Stub.h:84
const FPGAWord & stubindex() const
Definition: Stub.h:72
std::string str() const
Definition: Stub.h:28
void setPhiCorr(int phiCorr)
Definition: Stub.cc:141
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
int nbits() const
Definition: FPGAWord.h:25
bool isPSmodule() const
Definition: Stub.h:77
L1TStub * l1tstub_
Definition: Stub.h:106
const FPGAWord & phicorr() const
Definition: Stub.h:69
const FPGAWord & alpha() const
Definition: Stub.h:70
Settings const & settings_
Definition: Stub.h:107
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:85
const FPGAWord & layer() const
Definition: Stub.h:73
const FPGAWord & phi() const
Definition: Stub.h:68
unsigned int bits(unsigned int lsb, unsigned int nbit) const
Definition: FPGAWord.cc:74
std::string str() const
Definition: FPGAWord.cc:54
std::string phiregionstr() const
Definition: Stub.cc:125
FPGAWord stubindex_
Definition: Stub.h:104
unsigned int layerdisk_
Definition: Stub.h:90
constexpr int N_LAYER
Definition: Settings.h:25
FPGAWord allStubIndex() const
Definition: Stub.h:53