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 {
24  public:
26  TTStub();
27  TTStub( DetId aDetId );
28 
30  ~TTStub();
31 
34 
36  const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > >& getClusterRef( unsigned int hitIdentifier ) const;
38 
40  DetId getDetId() const { return theDetId; }
41  void setDetId( DetId aDetId ) { theDetId = aDetId; }
42 
44  double getTriggerDisplacement() const;
45  void setTriggerDisplacement( int aDisplacement );
46  double getTriggerOffset() const;
47  void setTriggerOffset( int anOffset );
48  double getRealTriggerOffset() const;
49  void setRealTriggerOffset( float anOffset );
50 
51 
52 
56  double getTriggerPosition() const;
57  double getTriggerBend() const;
58  double getHardwareBend() const;
59  void setHardwareBend( float aBend );
60 
62  std::string print( unsigned int i = 0 ) const;
63 
64  private:
70  int theOffset;
73 
74  static constexpr float dummyBend = 999999; // Dumy value should be away from potential bends
75 };
76 
84 template< typename T >
87 {
89  theDetId = 0;
91  theOffset = 0;
92  theRealOffset = 0;
94 }
95 
97 template< typename T >
99 {
101  this->setDetId( aDetId );
102 
105  theOffset = 0;
106  theRealOffset = 0;
108 }
109 
111 template< typename T >
113 
115 template< typename T >
117 {
118  return hitIdentifier==0 ? theClusterRef0 : theClusterRef1;
119 }
120 
121 template< typename T >
123 {
124  if(aTTCluster->getStackMember() == 0) theClusterRef0 = aTTCluster;
125  else if (aTTCluster->getStackMember() == 1) theClusterRef1 = aTTCluster;
126 }
127 
129 template< typename T >
131 
132 template< typename T >
133 void TTStub< T >::setTriggerDisplacement( int aDisplacement ) { theDisplacement = aDisplacement; }
134 
135 template< typename T >
136 double TTStub< T >::getTriggerOffset() const { return 0.5*theOffset; }
137 
138 template< typename T >
139 void TTStub< T >::setTriggerOffset( int anOffset ) { theOffset = anOffset; }
140 
141 template< typename T >
142 double TTStub< T >::getRealTriggerOffset() const { return 0.5*theRealOffset; }
143 
144 template< typename T >
145 void TTStub< T >::setRealTriggerOffset( float anOffset ) { theRealOffset = anOffset; }
146 
147 template< typename T >
148 void TTStub< T >::setHardwareBend( float aBend ) { theHardwareBend = aBend; }
149 
150 
152 template< typename T >
154 {
155  return this->getClusterRef(0)->findAverageLocalCoordinates().x();
156 }
157 
158 template< typename T >
160 {
161  if ( theDisplacement == dummyBend )
162  return theDisplacement;
163 
164  return 0.5*( theDisplacement - theOffset );
165 }
166 
167 template< typename T >
169 {
170  if ( theHardwareBend == dummyBend )
171  return this->getTriggerBend(); // If not set make it transparent
172 
173  return theHardwareBend;
174 }
175 
176 
178 template< typename T >
179 std::string TTStub< T >::print( unsigned int i ) const
180 {
181  std::string padding("");
182  for ( unsigned int j = 0; j != i; ++j )
183  {
184  padding+="\t";
185  }
186 
187  std::stringstream output;
188  output<<padding<<"TTStub:\n";
189  padding+='\t';
190  output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->getTriggerPosition();
191  output << ", bend: " << this->getTriggerBend() << '\n';
192  output << ", hardware bend: " << this->getHardwareBend() << '\n';
193  output << padding << "cluster 0: address: " << theClusterRef0.get();
194  output << ", cluster size: " << theClusterRef0->getHits().size() << '\n';
195  output << padding << "cluster 1: address: " << theClusterRef1.get();
196  output << ", cluster size: " << theClusterRef1->getHits().size() << '\n';
197  return output.str();
198 }
199 
200 template< typename T >
201 std::ostream& operator << ( std::ostream& os, const TTStub< T >& aTTStub ) { return ( os << aTTStub.print() ); }
202 
203 #endif
204 
float theRealOffset
Definition: TTStub.h:71
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
DetId getDetId() const
Detector element.
Definition: TTStub.h:40
#define constexpr
double getHardwareBend() const
In FULL-STRIP units!
Definition: TTStub.h:168
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef0
Definition: TTStub.h:67
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef1
Definition: TTStub.h:68
void setHardwareBend(float aBend)
In FULL-STRIP units!
Definition: TTStub.h:148
void setTriggerDisplacement(int aDisplacement)
In FULL-STRIP units! (hence, not implemented herein)
Definition: TTStub.h:133
double getTriggerOffset() const
In HALF-STRIP units!
Definition: TTStub.h:136
int theOffset
Definition: TTStub.h:70
double getTriggerBend() const
In FULL-STRIP units!
Definition: TTStub.h:159
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
static float dummyBend
Definition: TTStub.h:74
void setDetId(DetId aDetId)
Definition: TTStub.h:41
double getTriggerDisplacement() const
Trigger information.
Definition: TTStub.h:130
Definition: DetId.h:18
void setTriggerOffset(int anOffset)
In FULL-STRIP units! (hence, not implemented herein)
Definition: TTStub.h:139
int theDisplacement
Definition: TTStub.h:69
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
TTStub()
Constructors.
Definition: TTStub.h:86
~TTStub()
Destructor.
Definition: TTStub.h:112
void addClusterRef(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aTTCluster)
Definition: TTStub.h:122
DetId theDetId
Data members.
Definition: TTStub.h:66
std::string print(unsigned int i=0) const
In HALF-STRIP units!
Definition: TTStub.h:179
void setRealTriggerOffset(float anOffset)
In FULL-STRIP units! (hence, not implemented herein)
Definition: TTStub.h:145
double getRealTriggerOffset() const
In HALF-STRIP units!
Definition: TTStub.h:142
double getTriggerPosition() const
In HALF-STRIP units!
Definition: TTStub.h:153
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & getClusterRef(unsigned int hitIdentifier) const
Clusters composing the Stub.
Definition: TTStub.h:116
float theHardwareBend
Definition: TTStub.h:72