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 public:
30  TTCluster();
31  TTCluster(std::vector<T> aHits, DetId aDetId, unsigned int aStackMember, bool storeLocal);
32 
34  ~TTCluster();
35 
38 
40  std::vector<T> getHits() const { return theHits; }
41  void setHits(std::vector<T> aHits) { theHits = aHits; }
42 
44  DetId getDetId() const { return theDetId; }
45  void setDetId(DetId aDetId) { theDetId = aDetId; }
46  unsigned int getStackMember() const { return theStackMember; }
47  void setStackMember(unsigned int aStackMember) { theStackMember = aStackMember; }
48 
50  std::vector<int> findRows() const;
51  std::vector<int> findCols() const;
52  void setCoordinates(std::vector<int> a, std::vector<int> b) {
53  theRows = a;
54  theCols = b;
55  }
56  std::vector<int> getRows() const { return theRows; }
57  std::vector<int> getCols() const { return theCols; }
58 
60  unsigned int findWidth() const;
61 
64  MeasurementPoint findHitLocalCoordinates(unsigned int hitIdx) const;
67 
69  std::string print(unsigned int i = 0) const;
70 
71 private:
73  std::vector<T> theHits;
75  unsigned int theStackMember;
76 
77  std::vector<int> theRows;
78  std::vector<int> theCols;
79 
80 };
81 
89 template <typename T>
94  theHits.clear();
95  theDetId = 0;
96  theStackMember = 0;
97 
98  theRows.clear();
99  theCols.clear();
100 }
101 
103 template <typename T>
104 TTCluster<T>::TTCluster(std::vector<T> aHits, DetId aDetId, unsigned int aStackMember, bool storeLocal) {
106  this->setHits(aHits);
107  this->setDetId(aDetId);
108  this->setStackMember(aStackMember);
109 
110  theRows.clear();
111  theCols.clear();
112  if (storeLocal) {
113  this->setCoordinates(this->findRows(), this->findCols());
114  }
115 }
116 
118 template <typename T>
120 
122 template <>
124 
127 template <>
129  unsigned int hitIdx) const;
130 
131 template <>
133 TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findAverageLocalCoordinates() const;
134 
136 template <typename T>
137 std::vector<int> TTCluster<T>::findRows() const {
138  std::vector<int> temp;
139  return temp;
140 }
141 
142 template <typename T>
143 std::vector<int> TTCluster<T>::findCols() const {
144  std::vector<int> temp;
145  return temp;
146 }
147 
148 template <>
149 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findRows() const;
150 
151 template <>
152 std::vector<int> TTCluster<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findCols() const;
153 
155 template <typename T>
156 std::string TTCluster<T>::print(unsigned int i) const {
157  std::string padding("");
158  for (unsigned int j = 0; j != i; ++j) {
159  padding += "\t";
160  }
161 
162  std::stringstream output;
163  output << padding << "TTCluster:\n";
164  padding += '\t';
165  output << padding << "DetId: " << theDetId.rawId() << '\n';
166  output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
167  return output.str();
168 }
169 
170 template <typename T>
171 std::ostream& operator<<(std::ostream& os, const TTCluster<T>& aTTCluster) {
172  return (os << aTTCluster.print());
173 }
174 
175 #endif
void setStackMember(unsigned int aStackMember)
Definition: TTCluster.h:47
void setDetId(DetId aDetId)
Definition: TTCluster.h:45
MeasurementPoint findHitLocalCoordinates(unsigned int hitIdx) const
DetId getDetId() const
Detector element.
Definition: TTCluster.h:44
std::vector< int > getCols() const
Definition: TTCluster.h:57
std::vector< int > findCols() const
Definition: TTCluster.h:143
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< int > findRows() const
Rows and columns to get rid of Digi collection.
Definition: TTCluster.h:137
void setCoordinates(std::vector< int > a, std::vector< int > b)
Definition: TTCluster.h:52
std::vector< int > theRows
Definition: TTCluster.h:77
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
~TTCluster()
Destructor.
Definition: TTCluster.h:119
unsigned int findWidth() const
Cluster width.
TTCluster()
Constructors.
Definition: TTCluster.h:92
std::vector< int > theCols
Definition: TTCluster.h:78
std::string print(unsigned int i=0) const
Information.
Definition: TTCluster.h:156
Definition: DetId.h:17
MeasurementPoint findAverageLocalCoordinatesCentered() const
DetId theDetId
Definition: TTCluster.h:74
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:41
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
double b
Definition: hdecay.h:118
MeasurementPoint findAverageLocalCoordinates() const
double a
Definition: hdecay.h:119
std::vector< T > getHits() const
Hits in the Cluster.
Definition: TTCluster.h:40
unsigned int getStackMember() const
Definition: TTCluster.h:46
unsigned int theStackMember
Definition: TTCluster.h:75
std::vector< int > getRows() const
Definition: TTCluster.h:56