CMS 3D CMS Logo

TTCluster.cc
Go to the documentation of this file.
1 
12 
14 template< >
16 {
17  int rowMin = 99999999;
18  int rowMax = 0;
20  for ( unsigned int i = 0; i < theHits.size(); i++ )
21  {
22  int row = 0;
23  if ( this->getRows().empty() )
24  {
25  row = theHits[i]->row();
26  }
27  else
28  {
29  row = this->getRows()[i];
30  }
31  if ( row < rowMin )
32  rowMin = row;
33  if ( row > rowMax )
34  rowMax = row;
35  }
36  return abs( rowMax - rowMin + 1 );
37 }
38 
40 template< >
42 {
45  if ( this->getRows().empty() || this->getCols().empty() )
46  {
47  MeasurementPoint mp( theHits[hitIdx]->row(), theHits[hitIdx]->column() );
48  return mp;
49  }
50  else
51  {
52  int row = this->getRows()[hitIdx];
53  int col = this->getCols()[hitIdx];
54  MeasurementPoint mp( row, col );
55  return mp;
56  }
57 }
58 
60 template< >
61 MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinates() const
62 {
63  double averageCol = 0.0;
64  double averageRow = 0.0;
65 
67  if ( !theHits.empty() )
68  {
69  if ( this->getRows().empty() || this->getCols().empty() )
70  {
71  typename std::vector< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::const_iterator hitIter;
72  for ( hitIter = theHits.begin();
73  hitIter != theHits.end();
74  hitIter++ )
75  {
76  averageCol += (*hitIter)->column();
77  averageRow += (*hitIter)->row();
78  }
79  averageCol /= theHits.size();
80  averageRow /= theHits.size();
81  }
82  else
83  {
84  for ( unsigned int j = 0; j < theHits.size(); j++ )
85  {
86  averageCol += theCols[j];
87  averageRow += theRows[j];
88  }
89  averageCol /= theHits.size();
90  averageRow /= theHits.size();
91  }
92  }
93  return MeasurementPoint( averageRow, averageCol );
94 }
95 
97 template< >
98 MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinatesCentered() const
99 {
100  double averageCol = 0.0;
101  double averageRow = 0.0;
102 
104  if ( !theHits.empty() )
105  {
106  if ( this->getRows().empty() || this->getCols().empty() )
107  {
108  typename std::vector< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::const_iterator hitIter;
109  for ( hitIter = theHits.begin();
110  hitIter != theHits.end();
111  hitIter++ )
112  {
113  averageCol += (*hitIter)->column()+0.5;
114  averageRow += (*hitIter)->row()+0.5;
115  }
116  averageCol /= theHits.size();
117  averageRow /= theHits.size();
118  }
119  else
120  {
121  for ( unsigned int j = 0; j < theHits.size(); j++ )
122  {
123  averageCol += theCols[j]+0.5;
124  averageRow += theRows[j]+0.5;
125  }
126  averageCol /= theHits.size();
127  averageRow /= theHits.size();
128  }
129  }
130  return MeasurementPoint( averageRow, averageCol );
131 }
132 
134 template< >
135 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows() const
136 {
137  std::vector< int > temp;
138  temp.reserve(theHits.size());
139  for ( unsigned int i = 0; i < theHits.size(); i++ )
140  {
141  temp.push_back( theHits[i]->row() );
142  }
143  return temp;
144 }
145 
146 template< >
147 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols() const
148 {
149  std::vector< int > temp;
150  temp.reserve(theHits.size());
151  for ( unsigned int i = 0; i < theHits.size(); i++ )
152  {
153  temp.push_back( theHits[i]->column() );
154  }
155  return temp;
156 }
157 
unsigned int row() const
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
hitCont::const_iterator hitIter
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
col
Definition: cuy.py:1010