CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TTCluster< T > Class Template Reference

NOTE: this is needed even if it seems not. More...

#include <TTCluster.h>

Public Member Functions

template<>
MeasurementPoint findAverageLocalCoordinates () const
 Unweighted average local cluster coordinates. More...
 
MeasurementPoint findAverageLocalCoordinates () const
 
template<>
MeasurementPoint findAverageLocalCoordinates () const
 
MeasurementPoint findAverageLocalCoordinatesCentered () const
 
template<>
MeasurementPoint findAverageLocalCoordinatesCentered () const
 Unweighted average local cluster coordinates, using center of the strips. More...
 
std::vector< int > findCols () const
 
template<>
std::vector< int > findCols () const
 
template<>
std::vector< int > findCols () const
 
template<>
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
 Get hit local coordinates. More...
 
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
 
template<>
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
 
std::vector< int > findRows () const
 Rows and columns to get rid of Digi collection. More...
 
template<>
std::vector< int > findRows () const
 Coordinates stored locally. More...
 
template<>
std::vector< int > findRows () const
 
template<>
unsigned int findWidth () const
 Implementation of methods of TTCluster. More...
 
unsigned int findWidth () const
 Cluster width. More...
 
template<>
unsigned int findWidth () const
 Cluster width. More...
 
std::vector< int > getCols () const
 
DetId getDetId () const
 Detector element. More...
 
std::vector< TgetHits () const
 Hits in the Cluster. More...
 
std::vector< int > getRows () const
 
unsigned int getStackMember () const
 
std::string print (unsigned int i=0) const
 Information. More...
 
void setCoordinates (std::vector< int > a, std::vector< int > b)
 
void setDetId (DetId aDetId)
 
void setHits (std::vector< T > aHits)
 
void setStackMember (unsigned int aStackMember)
 
 TTCluster ()
 Constructors. More...
 
 TTCluster (std::vector< T > aHits, DetId aDetId, unsigned int aStackMember, bool storeLocal)
 Another Constructor. More...
 
 ~TTCluster ()
 Destructor. More...
 

Private Attributes

std::vector< int > theCols
 
DetId theDetId
 
std::vector< TtheHits
 Data members. More...
 
std::vector< int > theRows
 
unsigned int theStackMember
 

Detailed Description

template<typename T>
class TTCluster< T >

NOTE: this is needed even if it seems not.

Class to store the L1 Track Trigger clusters.

After moving from SimDataFormats to DataFormats, the template structure of the class was maintained in order to accomodate any types other than Phase2TrackerDigis in case there is such a need in the future.

Author
Nicola Pozzobon
Emmanuele Salvati
Date
2013, Jul 12

Definition at line 27 of file TTCluster.h.

Constructor & Destructor Documentation

template<typename T >
TTCluster< T >::TTCluster ( )

Constructors.

Close class.

Implementation of methods

Here, in the header file, the methods which do not depend on the specific type <T> that can fit the template. Other methods, with type-specific features, are implemented in the source file.Default Constructor NOTE: to be used with setSomething(...) methods

Set default data members

Definition at line 93 of file TTCluster.h.

References TTCluster< T >::theCols, TTCluster< T >::theDetId, TTCluster< T >::theHits, TTCluster< T >::theRows, and TTCluster< T >::theStackMember.

94 {
96  theHits.clear();
97  theDetId = 0;
98  theStackMember = 0;
99 
100  theRows.clear();
101  theCols.clear();
102 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
std::vector< int > theCols
Definition: TTCluster.h:79
DetId theDetId
Definition: TTCluster.h:75
std::vector< int > theRows
Definition: TTCluster.h:78
unsigned int theStackMember
Definition: TTCluster.h:76
template<typename T>
TTCluster< T >::TTCluster ( std::vector< T aHits,
DetId  aDetId,
unsigned int  aStackMember,
bool  storeLocal 
)

Another Constructor.

Set data members

Definition at line 106 of file TTCluster.h.

References TTCluster< T >::findCols(), TTCluster< T >::findRows(), TTCluster< T >::setCoordinates(), TTCluster< T >::setDetId(), TTCluster< T >::setHits(), TTCluster< T >::setStackMember(), TTCluster< T >::theCols, and TTCluster< T >::theRows.

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 }
void setStackMember(unsigned int aStackMember)
Definition: TTCluster.h:51
void setDetId(DetId aDetId)
Definition: TTCluster.h:49
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
void setCoordinates(std::vector< int > a, std::vector< int > b)
Definition: TTCluster.h:56
std::vector< int > theCols
Definition: TTCluster.h:79
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:45
std::vector< int > theRows
Definition: TTCluster.h:78
template<typename T >
TTCluster< T >::~TTCluster ( )

Member Function Documentation

template<>
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinates ( ) const

Unweighted average local cluster coordinates.

Loop over the hits and calculate the average coordinates

Definition at line 61 of file TTCluster.cc.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::vector< int > getRows() const
Definition: TTCluster.h:57
std::vector< int > theCols
Definition: TTCluster.h:79
std::vector< int > getCols() const
Definition: TTCluster.h:58
hitCont::const_iterator hitIter
std::vector< int > theRows
Definition: TTCluster.h:78
template<typename T>
MeasurementPoint TTCluster< T >::findAverageLocalCoordinates ( ) const
template<>
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinates ( ) const
template<typename T>
MeasurementPoint TTCluster< T >::findAverageLocalCoordinatesCentered ( ) const
template<>
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findAverageLocalCoordinatesCentered ( ) const

Unweighted average local cluster coordinates, using center of the strips.

Loop over the hits and calculate the average coordinates

Definition at line 98 of file TTCluster.cc.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::vector< int > getRows() const
Definition: TTCluster.h:57
std::vector< int > theCols
Definition: TTCluster.h:79
std::vector< int > getCols() const
Definition: TTCluster.h:58
hitCont::const_iterator hitIter
std::vector< int > theRows
Definition: TTCluster.h:78
template<typename T >
std::vector< int > TTCluster< T >::findCols ( ) const

Definition at line 149 of file TTCluster.h.

References TTCluster< T >::findRows(), and groupFilesInBlocks::temp.

Referenced by TTCluster< edm::Ref >::setStackMember(), and TTCluster< T >::TTCluster().

150 {
151  std::vector< int > temp;
152  return temp;
153 }
template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols ( ) const

Definition at line 147 of file TTCluster.cc.

References mps_fire::i, and groupFilesInBlocks::temp.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols ( ) const
template<>
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Get hit local coordinates.

NOTE in this case, DO NOT add 0.5 to get the center of the pixel

Definition at line 41 of file TTCluster.cc.

References cuy::col, and relativeConstraints::empty.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
std::vector< int > getRows() const
Definition: TTCluster.h:57
std::vector< int > getCols() const
Definition: TTCluster.h:58
col
Definition: cuy.py:1010
template<typename T>
MeasurementPoint TTCluster< T >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Single hit coordinates Average cluster coordinates

Referenced by TTCluster< edm::Ref >::getCols(), and TTCluster< T >::~TTCluster().

template<>
MeasurementPoint TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Single hit coordinates Average cluster coordinates

template<typename T >
std::vector< int > TTCluster< T >::findRows ( ) const

Rows and columns to get rid of Digi collection.

Operations with coordinates stored locally.

Definition at line 142 of file TTCluster.h.

References groupFilesInBlocks::temp.

Referenced by TTCluster< T >::findCols(), TTCluster< edm::Ref >::setStackMember(), and TTCluster< T >::TTCluster().

143 {
144  std::vector< int > temp;
145  return temp;
146 }
template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows ( ) const

Coordinates stored locally.

Definition at line 135 of file TTCluster.cc.

References mps_fire::i, and groupFilesInBlocks::temp.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows ( ) const
template<>
unsigned int TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findWidth ( ) const

Implementation of methods of TTCluster.

Here, in the source file, the methods which do depend on the specific type <T> that can fit the template.

Author
Nicola Pozzobon
Emmanuele Salvati
Date
2013, Jul 12Cluster width

this is only the actual size in RPhi

This takes care of 1-Pixel clusters

Definition at line 15 of file TTCluster.cc.

References funct::abs(), mps_fire::i, and Phase2TrackerDigi::row().

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > getRows() const
Definition: TTCluster.h:57
template<typename T>
unsigned int TTCluster< T >::findWidth ( ) const
template<>
unsigned int TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findWidth ( ) const

Cluster width.

template<typename T>
std::vector< int > TTCluster< T >::getCols ( ) const
inline

Definition at line 58 of file TTCluster.h.

58 { return theCols; }
std::vector< int > theCols
Definition: TTCluster.h:79
template<typename T>
DetId TTCluster< T >::getDetId ( void  ) const
inline

Detector element.

Definition at line 48 of file TTCluster.h.

48 { return theDetId; }
DetId theDetId
Definition: TTCluster.h:75
template<typename T>
std::vector< T > TTCluster< T >::getHits ( ) const
inline

Hits in the Cluster.

Data members: getABC( ... ) Helper methods: findABC( ... )

Definition at line 44 of file TTCluster.h.

44 { return theHits; }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
template<typename T>
std::vector< int > TTCluster< T >::getRows ( ) const
inline

Definition at line 57 of file TTCluster.h.

57 { return theRows; }
std::vector< int > theRows
Definition: TTCluster.h:78
template<typename T>
unsigned int TTCluster< T >::getStackMember ( ) const
inline

Definition at line 50 of file TTCluster.h.

50 { return theStackMember; }
unsigned int theStackMember
Definition: TTCluster.h:76
template<typename T >
std::string TTCluster< T >::print ( unsigned int  i = 0) const

Information.

Definition at line 163 of file TTCluster.h.

References mps_fire::i, convertSQLitetoXML_cfg::output, DetId::rawId(), AlCaHLTBitMon_QueryRunRegistry::string, TTCluster< T >::theDetId, TTCluster< T >::theHits, and TTCluster< T >::theStackMember.

Referenced by TTCluster< edm::Ref >::getCols().

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 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
DetId theDetId
Definition: TTCluster.h:75
unsigned int theStackMember
Definition: TTCluster.h:76
template<typename T>
void TTCluster< T >::setCoordinates ( std::vector< int >  a,
std::vector< int >  b 
)
inline

Definition at line 56 of file TTCluster.h.

Referenced by TTCluster< T >::TTCluster().

56 { theRows = a; theCols = b; }
std::vector< int > theCols
Definition: TTCluster.h:79
double b
Definition: hdecay.h:120
std::vector< int > theRows
Definition: TTCluster.h:78
double a
Definition: hdecay.h:121
template<typename T>
void TTCluster< T >::setDetId ( DetId  aDetId)
inline

Definition at line 49 of file TTCluster.h.

Referenced by TTCluster< T >::TTCluster().

49 { theDetId = aDetId; }
DetId theDetId
Definition: TTCluster.h:75
template<typename T>
void TTCluster< T >::setHits ( std::vector< T aHits)
inline

Definition at line 45 of file TTCluster.h.

Referenced by TTCluster< T >::TTCluster().

45 { theHits = aHits; }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:74
template<typename T>
void TTCluster< T >::setStackMember ( unsigned int  aStackMember)
inline

Definition at line 51 of file TTCluster.h.

Referenced by TTCluster< T >::TTCluster().

51 { theStackMember = aStackMember; }
unsigned int theStackMember
Definition: TTCluster.h:76

Member Data Documentation

template<typename T>
std::vector< int > TTCluster< T >::theCols
private
template<typename T>
DetId TTCluster< T >::theDetId
private
template<typename T>
std::vector< T > TTCluster< T >::theHits
private
template<typename T>
std::vector< int > TTCluster< T >::theRows
private
template<typename T>
unsigned int TTCluster< T >::theStackMember
private