CMS 3D CMS Logo

L1TStub.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_L1TStub_h
2 #define L1Trigger_TrackFindingTracklet_interface_L1TStub_h
3 
5 
6 #include <iostream>
7 #include <fstream>
8 #include <cassert>
9 #include <cmath>
10 #include <vector>
11 
12 namespace trklet {
13 
14  class L1TStub {
15  public:
16  L1TStub();
17 
19  int region,
20  int layerdisk,
22  int isPSmodule,
23  int isFlipped,
24  bool tiltedBarrel,
25  unsigned int tiltedRingId,
26  unsigned int endcapRingId,
27  unsigned int detId,
28  double x,
29  double y,
30  double z,
31  double bend,
32  double strip,
33  std::vector<int> tps);
34 
35  ~L1TStub() = default;
36 
37  void write(std::ofstream& out);
38 
39  double diphi();
40 
41  double iphiouter();
42 
43  double diz();
44 
45  unsigned int layer() const { return layer_; }
46  int disk() const {
47  if (layerdisk_ < N_LAYER) {
48  return 0;
49  }
50  int disk = layerdisk_ - N_LAYER + 1;
51  if (z_ < 0.0) {
52  return -disk;
53  }
54  return disk;
55  }
56 
57  double x() const { return x_; }
58  double y() const { return y_; }
59  double z() const { return z_; }
60  double r() const { return std::hypot(x_, y_); }
61  double pt() const { return pt_; }
62  double r2() const { return x_ * x_ + y_ * y_; }
63  double bend() const { return bend_; }
64 
65  double phi() const { return atan2(y_, x_); }
66 
67  unsigned int iphi() const { return iphi_; }
68  unsigned int iz() const { return iz_; }
69 
70  void setiphi(int iphi) { iphi_ = iphi; }
71  void setiz(int iz) { iz_ = iz; }
72 
73  double sigmax() const { return sigmax_; }
74  double sigmaz() const { return sigmaz_; }
75 
76  bool operator==(const L1TStub& other) const;
77 
78  void lorentzcor(double shift);
79 
80  int eventid() const { return eventid_; }
81  std::vector<int> tps() const { return tps_; }
82 
83  void setAllStubIndex(unsigned int index) { allstubindex_ = index; }
84  void setUniqueIndex(unsigned int index) { uniqueindex_ = index; }
85  void setCoords(double x, double y, double z) {
86  x_ = x;
87  y_ = y;
88  z_ = z;
89  }
90 
91  unsigned int allStubIndex() const { return allstubindex_; }
92  unsigned int uniqueIndex() const { return uniqueindex_; }
93 
94  unsigned int strip() const { return strip_; }
95 
96  double alpha(double pitch) const;
97 
98  //Scaled to go between -1 and +1
99  double alphanorm() const;
100 
101  void setXY(double x, double y);
102 
103  unsigned int isPSmodule() const { return isPSmodule_; }
104  unsigned int isFlipped() const { return isFlipped_; }
105 
106  bool isTilted() const { return tiltedBarrel_; } // Tilted barrel
107 
108  // Tilted module ring no. (Increasing 1 to 12 as |z| increases).
109  unsigned int tiltedRingId() const { return tiltedRingId_; }
110  // Endcap disk module ring number (1-15 as r increases).
111  unsigned int endcapRingId() const { return endcapRingId_; }
112  unsigned int detId() const { return detId_; } // Of lower sensor in module
113 
114  bool tpmatch(int tp) const;
115  bool tpmatch2(int tp) const;
116 
117  const std::string& DTClink() const { return DTClink_; }
118 
119  int layerdisk() const { return layerdisk_; }
120 
121  int region() const { return region_; }
122 
123  const std::string& stubword() const { return stubword_; }
124 
125  private:
128  int region_;
130  int eventid_;
131  std::vector<int> tps_;
132  unsigned int iphi_;
133  unsigned int iz_;
134  unsigned int layer_;
135  unsigned int strip_;
136  double x_;
137  double y_;
138  double z_;
139  double sigmax_;
140  double sigmaz_;
141  double pt_;
142  double bend_;
143  unsigned int allstubindex_;
144  unsigned int uniqueindex_;
145  unsigned int isPSmodule_;
146  unsigned int isFlipped_;
148  unsigned int tiltedRingId_;
149  unsigned int endcapRingId_;
150  unsigned int detId_;
151  };
152 }; // namespace trklet
153 #endif
unsigned int tiltedRingId() const
Definition: L1TStub.h:109
double phi() const
Definition: L1TStub.h:65
double sigmax() const
Definition: L1TStub.h:73
unsigned int iz_
Definition: L1TStub.h:133
unsigned int layer() const
Definition: L1TStub.h:45
double pt() const
Definition: L1TStub.h:61
void setXY(double x, double y)
Definition: L1TStub.cc:103
double bend() const
Definition: L1TStub.h:63
std::vector< int > tps_
Definition: L1TStub.h:131
unsigned int tiltedRingId_
Definition: L1TStub.h:148
double sigmaz_
Definition: L1TStub.h:140
unsigned int strip_
Definition: L1TStub.h:135
const std::string & DTClink() const
Definition: L1TStub.h:117
unsigned int isPSmodule_
Definition: L1TStub.h:145
double z() const
Definition: L1TStub.h:59
double x() const
Definition: L1TStub.h:57
void write(std::ofstream &out)
Definition: L1TStub.cc:58
~L1TStub()=default
double y() const
Definition: L1TStub.h:58
std::string DTClink_
Definition: L1TStub.h:127
unsigned int isPSmodule() const
Definition: L1TStub.h:103
double sigmax_
Definition: L1TStub.h:139
bool tiltedBarrel_
Definition: L1TStub.h:147
std::string stubword_
Definition: L1TStub.h:129
unsigned int strip() const
Definition: L1TStub.h:94
unsigned int detId() const
Definition: L1TStub.h:112
int layerdisk() const
Definition: L1TStub.h:119
bool tpmatch2(int tp) const
Definition: L1TStub.cc:117
int disk() const
Definition: L1TStub.h:46
unsigned int isFlipped() const
Definition: L1TStub.h:104
unsigned int uniqueindex_
Definition: L1TStub.h:144
void setUniqueIndex(unsigned int index)
Definition: L1TStub.h:84
unsigned int endcapRingId_
Definition: L1TStub.h:149
unsigned int allStubIndex() const
Definition: L1TStub.h:91
unsigned int iz() const
Definition: L1TStub.h:68
double alpha(double pitch) const
Definition: L1TStub.cc:79
bool isTilted() const
Definition: L1TStub.h:106
double alphanorm() const
Definition: L1TStub.cc:91
bool operator==(const L1TStub &other) const
Definition: L1TStub.cc:68
unsigned int layer_
Definition: L1TStub.h:134
const std::string & stubword() const
Definition: L1TStub.h:123
void setCoords(double x, double y, double z)
Definition: L1TStub.h:85
double pt_
Definition: L1TStub.h:141
int eventid() const
Definition: L1TStub.h:80
unsigned int allstubindex_
Definition: L1TStub.h:143
unsigned int isFlipped_
Definition: L1TStub.h:146
void setiphi(int iphi)
Definition: L1TStub.h:70
void lorentzcor(double shift)
Definition: L1TStub.cc:72
double iphiouter()
double r() const
Definition: L1TStub.h:60
static unsigned int const shift
unsigned int endcapRingId() const
Definition: L1TStub.h:111
void setAllStubIndex(unsigned int index)
Definition: L1TStub.h:83
unsigned int detId_
Definition: L1TStub.h:150
void setiz(int iz)
Definition: L1TStub.h:71
unsigned int iphi_
Definition: L1TStub.h:132
double sigmaz() const
Definition: L1TStub.h:74
unsigned int iphi() const
Definition: L1TStub.h:67
double bend_
Definition: L1TStub.h:142
bool tpmatch(int tp) const
Definition: L1TStub.cc:108
double r2() const
Definition: L1TStub.h:62
unsigned int uniqueIndex() const
Definition: L1TStub.h:92
int region() const
Definition: L1TStub.h:121
constexpr int N_LAYER
Definition: Settings.h:25
std::vector< int > tps() const
Definition: L1TStub.h:81