CMS 3D CMS Logo

TTCluster.h
Go to the documentation of this file.
1 
14 #ifndef L1_TRACK_TRIGGER_CLUSTER_FORMAT_H
15 #define L1_TRACK_TRIGGER_CLUSTER_FORMAT_H
16 
25 
26 template< typename T >
27 class TTCluster
28 {
29  public:
31  TTCluster();
32  TTCluster( std::vector< T > aHits,
33  DetId aDetId,
34  unsigned int aStackMember,
35  bool storeLocal );
36 
38  ~TTCluster();
39 
42 
44  std::vector< T > getHits() const { return theHits; }
45  void setHits( std::vector< T > aHits ) { theHits = aHits; }
46 
48  DetId getDetId() const { return theDetId; }
49  void setDetId( DetId aDetId ) { theDetId = aDetId; }
50  unsigned int getStackMember() const { return theStackMember; }
51  void setStackMember( unsigned int aStackMember ) { theStackMember = aStackMember; }
52 
54  std::vector< int > findRows() const;
55  std::vector< int > findCols() const;
56  void setCoordinates( std::vector< int > a, std::vector< int > b ) { theRows = a; theCols = b; }
57  std::vector< int > getRows() const { return theRows; }
58  std::vector< int > getCols() const { return theCols; }
59 
61  unsigned int findWidth() const;
62 
65  MeasurementPoint findHitLocalCoordinates( unsigned int hitIdx ) const;
68 
70  std::string print( unsigned int i = 0 ) const;
71 
72  private:
74  std::vector< T > theHits;
76  unsigned int theStackMember;
77 
78  std::vector< int > theRows;
79  std::vector< int > theCols;
80 
81 };
82 
90 template< typename T >
94 {
96  theHits.clear();
97  theDetId = 0;
98  theStackMember = 0;
99 
100  theRows.clear();
101  theCols.clear();
102 }
103 
105 template< typename T >
106 TTCluster< T >::TTCluster( std::vector< T > aHits,
107  DetId aDetId,
108  unsigned int aStackMember,
109  bool storeLocal )
110 {
112  this->setHits( aHits );
113  this->setDetId( aDetId );
114  this->setStackMember( aStackMember );
115 
116  theRows.clear();
117  theCols.clear();
118  if ( storeLocal )
119  {
120  this->setCoordinates( this->findRows(), this->findCols() );
121  }
122 }
123 
125 template< typename T >
127 
129 template< >
131 
134 template< >
136 
137 template< >
138 MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinates() const;
139 
141 template< typename T >
142 std::vector< int > TTCluster< T >::findRows() const
143 {
144  std::vector< int > temp;
145  return temp;
146 }
147 
148 template< typename T >
149 std::vector< int > TTCluster< T >::findCols() const
150 {
151  std::vector< int > temp;
152  return temp;
153 }
154 
155 template< >
156 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows() const;
157 
158 template< >
159 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols() const;
160 
162 template< typename T >
163 std::string TTCluster< T >::print( unsigned int i ) const
164 {
165  std::string padding("");
166  for ( unsigned int j = 0; j != i; ++j )
167  {
168  padding+="\t";
169  }
170 
171  std::stringstream output;
172  output<<padding<<"TTCluster:\n";
173  padding+='\t';
174  output << padding << "DetId: " << theDetId.rawId() << '\n';
175  output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
176  return output.str();
177 }
178 
179 template< typename T >
180 std::ostream& operator << ( std::ostream& os, const TTCluster< T >& aTTCluster )
181 {
182  return ( os << aTTCluster.print() );
183 }
184 
185 #endif
186 
std::vector< T > getHits() const
Hits in the Cluster.
Definition: TTCluster.h:44
void setStackMember(unsigned int aStackMember)
Definition: TTCluster.h:51
void setDetId(DetId aDetId)
Definition: TTCluster.h:49
MeasurementPoint findHitLocalCoordinates(unsigned int hitIdx) const
DetId getDetId() const
Detector element.
Definition: TTCluster.h:48
std::vector< int > findCols() const
Definition: TTCluster.h:149
std::vector< int > findRows() const
Rows and columns to get rid of Digi collection.
Definition: TTCluster.h:142
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
void setCoordinates(std::vector< int > a, std::vector< int > b)
Definition: TTCluster.h:56
~TTCluster()
Destructor.
Definition: TTCluster.h:126
unsigned int findWidth() const
Cluster width.
TTCluster()
Constructors.
Definition: TTCluster.h:93
std::string print(unsigned int i=0) const
Information.
Definition: TTCluster.h:163
std::vector< int > getRows() const
Definition: TTCluster.h:57
std::vector< int > theCols
Definition: TTCluster.h:79
Definition: DetId.h:18
MeasurementPoint findAverageLocalCoordinatesCentered() const
DetId theDetId
Definition: TTCluster.h:75
std::vector< int > getCols() const
Definition: TTCluster.h:58
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:45
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
double b
Definition: hdecay.h:120
MeasurementPoint findAverageLocalCoordinates() const
std::vector< int > theRows
Definition: TTCluster.h:78
double a
Definition: hdecay.h:121
unsigned int getStackMember() const
Definition: TTCluster.h:50
unsigned int theStackMember
Definition: TTCluster.h:76