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().size() == 0 )
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().size() == 0 || this->getCols().size() == 0 )
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.size() != 0 )
68  {
69  if ( this->getRows().size() == 0 || this->getCols().size() == 0 )
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 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows() const
99 {
100  std::vector< int > temp;
101  temp.reserve(theHits.size());
102  for ( unsigned int i = 0; i < theHits.size(); i++ )
103  {
104  temp.push_back( theHits[i]->row() );
105  }
106  return temp;
107 }
108 
109 template< >
110 std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols() const
111 {
112  std::vector< int > temp;
113  temp.reserve(theHits.size());
114  for ( unsigned int i = 0; i < theHits.size(); i++ )
115  {
116  temp.push_back( theHits[i]->column() );
117  }
118  return temp;
119 }
120 
size
Write out results.
int i
Definition: DBlmapReader.cc:9
unsigned int row() const
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
hitCont::const_iterator hitIter
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
col
Definition: cuy.py:1008