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 
52  double getTriggerPosition() const;
53  double getTriggerBend() const;
54 
56  std::string print( unsigned int i = 0 ) const;
57 
58  private:
64  int theOffset;
65 
66 };
67 
75 template< typename T >
78 {
80  theDetId = 0;
81  theDisplacement = 999999;
82  theOffset = 0;
83 }
84 
86 template< typename T >
88 {
90  this->setDetId( aDetId );
91 
93  theDisplacement = 999999;
94  theOffset = 0;
95 }
96 
98 template< typename T >
100 
102 template< typename T >
104 {
105  return hitIdentifier==0 ? theClusterRef0 : theClusterRef1;
106 }
107 
108 template< typename T >
110 {
111  if(aTTCluster->getStackMember() == 0) theClusterRef0 = aTTCluster;
112  else if (aTTCluster->getStackMember() == 1) theClusterRef1 = aTTCluster;
113 }
114 
116 template< typename T >
118 
119 template< typename T >
120 void TTStub< T >::setTriggerDisplacement( int aDisplacement ) { theDisplacement = aDisplacement; }
121 
122 template< typename T >
123 double TTStub< T >::getTriggerOffset() const { return 0.5*theOffset; }
124 
125 template< typename T >
126 void TTStub< T >::setTriggerOffset( int anOffset ) { theOffset = anOffset; }
127 
129 template< typename T >
131 {
132  return this->getClusterRef(0)->findAverageLocalCoordinates().x();
133 }
134 
135 template< typename T >
137 {
138  if ( theDisplacement == 999999 )
139  return theDisplacement;
140 
141  return 0.5*( theDisplacement - theOffset );
142 }
143 
145 template< typename T >
146 std::string TTStub< T >::print( unsigned int i ) const
147 {
148  std::string padding("");
149  for ( unsigned int j = 0; j != i; ++j )
150  {
151  padding+="\t";
152  }
153 
154  std::stringstream output;
155  output<<padding<<"TTStub:\n";
156  padding+='\t';
157  output << padding << "DetId: " << theDetId.rawId() << ", position: " << this->getTriggerPosition();
158  output << ", bend: " << this->getTriggerBend() << '\n';
159  unsigned int iClu = 0;
160  output << padding << "cluster 0: address: " << theClusterRef0.get();
161  output << ", cluster size: " << theClusterRef0->getHits().size() << '\n';
162  output << padding << "cluster 1: address: " << theClusterRef1.get();
163  output << ", cluster size: " << theClusterRef1->getHits().size() << '\n';
164  return output.str();
165 }
166 
167 template< typename T >
168 std::ostream& operator << ( std::ostream& os, const TTStub< T >& aTTStub ) { return ( os << aTTStub.print() ); }
169 
170 #endif
171 
DetId getDetId() const
Detector element.
Definition: TTStub.h:40
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef0
Definition: TTStub.h:61
edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > theClusterRef1
Definition: TTStub.h:62
void setTriggerDisplacement(int aDisplacement)
In FULL-STRIP units! (hence, not implemented herein)
Definition: TTStub.h:120
double getTriggerOffset() const
In HALF-STRIP units!
Definition: TTStub.h:123
int theOffset
Definition: TTStub.h:64
double getTriggerBend() const
In FULL-STRIP units!
Definition: TTStub.h:136
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
void setDetId(DetId aDetId)
Definition: TTStub.h:41
double getTriggerDisplacement() const
Trigger information.
Definition: TTStub.h:117
Definition: DetId.h:18
void setTriggerOffset(int anOffset)
In FULL-STRIP units! (hence, not implemented herein)
Definition: TTStub.h:126
int theDisplacement
Definition: TTStub.h:63
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
TTStub()
Constructors.
Definition: TTStub.h:77
~TTStub()
Destructor.
Definition: TTStub.h:99
void addClusterRef(edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > aTTCluster)
Definition: TTStub.h:109
DetId theDetId
Data members.
Definition: TTStub.h:60
std::string print(unsigned int i=0) const
In FULL-STRIP units!
Definition: TTStub.h:146
double getTriggerPosition() const
In HALF-STRIP units!
Definition: TTStub.h:130
const edm::Ref< edmNew::DetSetVector< TTCluster< T > >, TTCluster< T > > & getClusterRef(unsigned int hitIdentifier) const
Clusters composing the Stub.
Definition: TTStub.h:103