CMS 3D CMS Logo

TTCluster.cc
Go to the documentation of this file.
1 
12 
14 template <>
16  int rowMin = 99999999;
17  int rowMax = 0;
19  for (unsigned int i = 0; i < theHits.size(); i++) {
20  int row = 0;
21  if (this->getRows().empty()) {
22  row = theHits[i]->row();
23  } else {
24  row = this->getRows()[i];
25  }
26  if (row < rowMin)
27  rowMin = row;
28  if (row > rowMax)
29  rowMax = row;
30  }
31  return abs(rowMax - rowMin + 1);
32 }
33 
35 template <>
37  unsigned int hitIdx) const {
40  if (this->getRows().empty() || this->getCols().empty()) {
41  MeasurementPoint mp(theHits[hitIdx]->row(), theHits[hitIdx]->column());
42  return mp;
43  } else {
44  int row = this->getRows()[hitIdx];
45  int col = this->getCols()[hitIdx];
46  MeasurementPoint mp(row, col);
47  return mp;
48  }
49 }
50 
52 template <>
55  double averageCol = 0.0;
56  double averageRow = 0.0;
57 
59  if (!theHits.empty()) {
60  if (this->getRows().empty() || this->getCols().empty()) {
61  typename std::vector<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::const_iterator hitIter;
62  for (hitIter = theHits.begin(); hitIter != theHits.end(); hitIter++) {
63  averageCol += (*hitIter)->column();
64  averageRow += (*hitIter)->row();
65  }
66  averageCol /= theHits.size();
67  averageRow /= theHits.size();
68  } else {
69  for (unsigned int j = 0; j < theHits.size(); j++) {
70  averageCol += theCols[j];
71  averageRow += theRows[j];
72  }
73  averageCol /= theHits.size();
74  averageRow /= theHits.size();
75  }
76  }
77  return MeasurementPoint(averageRow, averageCol);
78 }
79 
81 template <>
83  edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::findAverageLocalCoordinatesCentered() const {
84  double averageCol = 0.0;
85  double averageRow = 0.0;
86 
88  if (!theHits.empty()) {
89  if (this->getRows().empty() || this->getCols().empty()) {
90  typename std::vector<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>, Phase2TrackerDigi> >::const_iterator hitIter;
91  for (hitIter = theHits.begin(); hitIter != theHits.end(); hitIter++) {
92  averageCol += (*hitIter)->column() + 0.5;
93  averageRow += (*hitIter)->row() + 0.5;
94  }
95  averageCol /= theHits.size();
96  averageRow /= theHits.size();
97  } else {
98  for (unsigned int j = 0; j < theHits.size(); j++) {
99  averageCol += theCols[j] + 0.5;
100  averageRow += theRows[j] + 0.5;
101  }
102  averageCol /= theHits.size();
103  averageRow /= theHits.size();
104  }
105  }
106  return MeasurementPoint(averageRow, averageCol);
107 }
108 
110 template <>
112  std::vector<int> temp;
113  temp.reserve(theHits.size());
114  for (unsigned int i = 0; i < theHits.size(); i++) {
115  temp.push_back(theHits[i]->row());
116  }
117  return temp;
118 }
119 
120 template <>
122  std::vector<int> temp;
123  temp.reserve(theHits.size());
124  for (unsigned int i = 0; i < theHits.size(); i++) {
125  temp.push_back(theHits[i]->column());
126  }
127  return temp;
128 }
Point2DBase
Definition: Point2DBase.h:9
hitIter
hitCont::const_iterator hitIter
Definition: DTMeantimerPatternReco.cc:35
mps_fire.i
i
Definition: mps_fire.py:428
cuy.col
col
Definition: cuy.py:1010
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::Ref
Definition: AssociativeIterator.h:58
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
TTCluster.h
Phase2TrackerDigi
Definition: Phase2TrackerDigi.h:12
bscTrigger_cfi.theHits
theHits
Definition: bscTrigger_cfi.py:18
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66