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 92 of file TTCluster.h.

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

92  {
94  theHits.clear();
95  theDetId = 0;
96  theStackMember = 0;
97 
98  theRows.clear();
99  theCols.clear();
100 }
std::vector< int > theRows
Definition: TTCluster.h:77
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
std::vector< int > theCols
Definition: TTCluster.h:78
DetId theDetId
Definition: TTCluster.h:74
unsigned int theStackMember
Definition: TTCluster.h:75
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 104 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.

104  {
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 }
void setStackMember(unsigned int aStackMember)
Definition: TTCluster.h:47
void setDetId(DetId aDetId)
Definition: TTCluster.h:45
std::vector< int > findCols() const
Definition: TTCluster.h:143
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< int > theCols
Definition: TTCluster.h:78
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:41
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 54 of file TTCluster.cc.

References dqmiolumiharvest::j, and bscTrigger_cfi::theHits.

54  {
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 }
std::vector< int > getCols() const
Definition: TTCluster.h:57
std::vector< int > theRows
Definition: TTCluster.h:77
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
std::vector< int > theCols
Definition: TTCluster.h:78
hitCont::const_iterator hitIter
std::vector< int > getRows() const
Definition: TTCluster.h:56
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

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

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 83 of file TTCluster.cc.

References dqmiolumiharvest::j, and bscTrigger_cfi::theHits.

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

Definition at line 143 of file TTCluster.h.

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

Referenced by TTCluster< T >::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 > >::findCols ( ) const

Definition at line 121 of file TTCluster.cc.

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

121  {
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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
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 36 of file TTCluster.cc.

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

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

Single hit coordinates Average cluster coordinates

Referenced by TTCluster< T >::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 137 of file TTCluster.h.

References groupFilesInBlocks::temp.

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

137  {
138  std::vector<int> temp;
139  return temp;
140 }
template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows ( ) const

Coordinates stored locally.

Definition at line 111 of file TTCluster.cc.

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

111  {
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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
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 bscTrigger_cfi::theHits.

15  {
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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > getRows() const
Definition: TTCluster.h:56
template<typename T>
unsigned int TTCluster< T >::findWidth ( ) const

Cluster width.

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

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
template<typename T>
DetId TTCluster< T >::getDetId ( void  ) const
inline

Detector element.

Definition at line 44 of file TTCluster.h.

References TTCluster< T >::theDetId.

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

Hits in the Cluster.

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

Definition at line 40 of file TTCluster.h.

References TTCluster< T >::theHits.

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

Definition at line 56 of file TTCluster.h.

References TTCluster< T >::theRows.

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

Definition at line 46 of file TTCluster.h.

References TTCluster< T >::theStackMember.

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

Information.

Definition at line 156 of file TTCluster.h.

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

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

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

Definition at line 52 of file TTCluster.h.

References a, b, TTCluster< T >::theCols, and TTCluster< T >::theRows.

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

52  {
53  theRows = a;
54  theCols = b;
55  }
std::vector< int > theRows
Definition: TTCluster.h:77
std::vector< int > theCols
Definition: TTCluster.h:78
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
template<typename T>
void TTCluster< T >::setDetId ( DetId  aDetId)
inline

Definition at line 45 of file TTCluster.h.

References TTCluster< T >::theDetId.

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

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

Definition at line 41 of file TTCluster.h.

References TTCluster< T >::theHits.

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

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

Definition at line 47 of file TTCluster.h.

References TTCluster< T >::findCols(), TTCluster< T >::findRows(), and TTCluster< T >::theStackMember.

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

47 { theStackMember = aStackMember; }
unsigned int theStackMember
Definition: TTCluster.h:75

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