CMS 3D CMS Logo

TTStub.h
Go to the documentation of this file.
1 
14 #ifndef L1_TRACK_TRIGGER_STUB_FORMAT_H
15 #define L1_TRACK_TRIGGER_STUB_FORMAT_H
16 
20 
21 template <typename T>
22 class TTStub {
23 public:
25  TTStub();
26  TTStub(DetId aDetId);
27 
29  ~TTStub();
30 
33 
35 
38  const edm::Ref<edmNew::DetSetVector<TTCluster<T> >, TTCluster<T> >& clusterRef(unsigned int hitStackMember) const;
39 
42 
44  DetId getDetId() const { return theDetId; }
45  void setDetId(DetId aDetId) { theDetId = aDetId; }
46 
51 
57  double rawBend() const;
58 
63  void setRawBend(int aDisplacement);
64 
70 
71  double bendOffset() const;
72 
75  void setBendOffset(int anOffset);
76 
78  void setModuleTypePS(bool isPSModule);
79 
81  bool moduleTypePS() const;
82 
86 
89  double innerClusterPosition() const;
90 
92  double bendFE() const;
93 
95  double bendBE() const;
96 
98  void setBendBE(float aBend);
99 
101  std::string print(unsigned int i = 0) const;
102 
103 private:
110  float theBendBE;
112 
113  static constexpr float dummyBend = 999999; // Dumy value should be away from potential bends
114 };
115 
123 template <typename T>
127  theDetId = 0;
128  theDisplacement = dummyBend;
129  theOffset = 0;
130  theBendBE = dummyBend;
131 }
132 
134 template <typename T>
137  this->setDetId(aDetId);
138 
140  theDisplacement = dummyBend;
141  theOffset = 0;
142  theBendBE = dummyBend;
143 }
144 
146 template <typename T>
148 
149 template <typename T>
151  unsigned int hitStackMember) const {
152  return (hitStackMember == 0) ? theClusterRef0 : theClusterRef1;
153 }
154 
155 template <typename T>
157  if (aTTCluster->getStackMember() == 0)
158  theClusterRef0 = aTTCluster;
159  else if (aTTCluster->getStackMember() == 1)
160  theClusterRef1 = aTTCluster;
161 }
162 
164 template <typename T>
165 double TTStub<T>::rawBend() const {
166  return 0.5 * theDisplacement;
167 }
168 
169 template <typename T>
170 void TTStub<T>::setRawBend(int aDisplacement) {
171  theDisplacement = aDisplacement;
172 }
173 
174 template <typename T>
175 double TTStub<T>::bendOffset() const {
176  return 0.5 * theOffset;
177 }
178 
179 template <typename T>
180 void TTStub<T>::setBendOffset(int anOffset) {
181  theOffset = anOffset;
182 }
183 
184 template <typename T>
185 void TTStub<T>::setBendBE(float aBend) {
186  theBendBE = aBend;
187 }
188 
189 template <typename T>
190 void TTStub<T>::setModuleTypePS(bool isPSModule) {
191  thePSModule = isPSModule;
192 } // set whether this is a PS module or not;
193 template <typename T>
195  return thePSModule;
196 } // check if a PS module
197 template <typename T>
199  return this->clusterRef(0)->findAverageLocalCoordinates().x(); //CBC3-style trigger info
200 }
201 
202 template <typename T>
203 double TTStub<T>::bendFE() const {
204  if (theDisplacement == dummyBend)
205  return theDisplacement;
206 
207  return 0.5 * (theDisplacement - theOffset);
208 }
209 
210 template <typename T>
211 double TTStub<T>::bendBE() const {
212  if (theBendBE == dummyBend)
213  return this->bendFE(); // If not set make it transparent
214 
215  return theBendBE;
216 }
217 
219 template <typename T>
220 std::string TTStub<T>::print(unsigned int i) const {
221  std::string padding("");
222  for (unsigned int j = 0; j != i; ++j) {
223  padding += "\t";
224  }
225 
226  std::stringstream output;
227  output << padding << "TTStub:\n";
228  padding += '\t';
229  output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->InnerClusterPosition();
230  output << ", bend: " << this->BendFE() << '\n';
231  output << ", hardware bend: " << this->BendBE() << '\n';
232  output << padding << "cluster 0: address: " << theClusterRef0.get();
233  output << ", cluster size: " << theClusterRef0->getHits().size() << '\n';
234  output << padding << "cluster 1: address: " << theClusterRef1.get();
235  output << ", cluster size: " << theClusterRef1->getHits().size() << '\n';
236  return output.str();
237 }
238 
239 template <typename T>
240 std::ostream& operator<<(std::ostream& os, const TTStub<T>& aTTStub) {
241  return (os << aTTStub.print());
242 }
243 
244 #endif
static constexpr float dummyBend
Definition: TTStub.h:113
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & clusterRef(unsigned int hitStackMember) const
Clusters composing the Stub – see https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWT...
Definition: TTStub.h:150
bool thePSModule
Definition: TTStub.h:111
void setBendOffset(int anOffset)
Definition: TTStub.h:180
std::string print(unsigned int i=0) const
Print Stub information for debugging purposes.
Definition: TTStub.h:220
double bendFE() const
BendFE(): In FULL-STRIP units from FE! Rename of getTriggerBend()
Definition: TTStub.h:203
void setModuleTypePS(bool isPSModule)
set whether this is a PS module or not;
Definition: TTStub.h:190
void setBendBE(float aBend)
setBendBE(): In HALF-STRIP units! Reduced resolution in BE boards. Rename of setHardwareBend() ...
Definition: TTStub.h:185
DetId getDetId() const
Detector element.
Definition: TTStub.h:44
float theBendBE
Definition: TTStub.h:110
void setRawBend(int aDisplacement)
Definition: TTStub.h:170
int theOffset
Definition: TTStub.h:109
double bendBE() const
BendBE(): In FULL-STRIP units! Reduced resolution from BE boards. Rename of getHardwareBend() ...
Definition: TTStub.h:211
double rawBend() const
Trigger info.
Definition: TTStub.h:165
bool moduleTypePS() const
check if a PS module
Definition: TTStub.h:194
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
double bendOffset() const
Definition: TTStub.h:175
void setDetId(DetId aDetId)
Definition: TTStub.h:45
Definition: DetId.h:17
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef1
Definition: TTStub.h:107
int theDisplacement
Definition: TTStub.h:108
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
TTStub()
Constructors.
Definition: TTStub.h:125
~TTStub()
Destructor.
Definition: TTStub.h:147
void addClusterRef(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aTTCluster)
Add a cluster reference, depending on which stack member it is on (inner = 0, outer = 1) ...
Definition: TTStub.h:156
DetId theDetId
Data members.
Definition: TTStub.h:105
Definition: output.py:1
double innerClusterPosition() const
Definition: TTStub.h:198
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef0
Definition: TTStub.h:106