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

◆ TTCluster() [1/2]

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 bscTrigger_cfi::theHits.

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

◆ TTCluster() [2/2]

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 HLT_2023v12_cff::setDetId.

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
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
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

◆ ~TTCluster()

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

Destructor.

Definition at line 119 of file TTCluster.h.

119 {}

Member Function Documentation

◆ findAverageLocalCoordinates() [1/3]

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 > 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
std::vector< int > getRows() const
Definition: TTCluster.h:56
std::vector< int > getCols() const
Definition: TTCluster.h:57
hitCont::const_iterator hitIter

◆ findAverageLocalCoordinates() [2/3]

template<typename T>
MeasurementPoint TTCluster< T >::findAverageLocalCoordinates ( ) const

◆ findAverageLocalCoordinates() [3/3]

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

◆ findAverageLocalCoordinatesCentered() [1/2]

template<typename T>
MeasurementPoint TTCluster< T >::findAverageLocalCoordinatesCentered ( ) const

◆ findAverageLocalCoordinatesCentered() [2/2]

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 > 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
std::vector< int > getRows() const
Definition: TTCluster.h:56
std::vector< int > getCols() const
Definition: TTCluster.h:57
hitCont::const_iterator hitIter

◆ findCols() [1/3]

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

Definition at line 143 of file TTCluster.h.

References groupFilesInBlocks::temp.

143  {
144  std::vector<int> temp;
145  return temp;
146 }

◆ findCols() [2/3]

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

◆ findCols() [3/3]

template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findCols ( ) const

◆ findHitLocalCoordinates() [1/3]

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< T > theHits
Data members.
Definition: TTCluster.h:73
std::vector< int > getRows() const
Definition: TTCluster.h:56
std::vector< int > getCols() const
Definition: TTCluster.h:57
col
Definition: cuy.py:1009

◆ findHitLocalCoordinates() [2/3]

template<typename T>
MeasurementPoint TTCluster< T >::findHitLocalCoordinates ( unsigned int  hitIdx) const

Single hit coordinates Average cluster coordinates

◆ findHitLocalCoordinates() [3/3]

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

Single hit coordinates Average cluster coordinates

◆ findRows() [1/3]

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.

137  {
138  std::vector<int> temp;
139  return temp;
140 }

◆ findRows() [2/3]

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

◆ findRows() [3/3]

template<>
std::vector< int > TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findRows ( ) const

◆ findWidth() [1/3]

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

◆ findWidth() [2/3]

template<typename T>
unsigned int TTCluster< T >::findWidth ( ) const

Cluster width.

◆ findWidth() [3/3]

template<>
unsigned int TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findWidth ( ) const

Cluster width.

◆ getCols()

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

Definition at line 57 of file TTCluster.h.

References TTCluster< T >::theCols.

57 { return theCols; }
std::vector< int > theCols
Definition: TTCluster.h:78

◆ getDetId()

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

◆ getHits()

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

◆ getRows()

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

◆ getStackMember()

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

◆ print()

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, AlCaHLTBitMon_QueryRunRegistry::string, and bscTrigger_cfi::theHits.

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 }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
DetId theDetId
Definition: TTCluster.h:74
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
unsigned int theStackMember
Definition: TTCluster.h:75

◆ setCoordinates()

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.

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:120
double a
Definition: hdecay.h:121

◆ setDetId()

template<typename T>
void TTCluster< T >::setDetId ( DetId  aDetId)
inline

Definition at line 45 of file TTCluster.h.

References TTCluster< T >::theDetId.

45 { theDetId = aDetId; }
DetId theDetId
Definition: TTCluster.h:74

◆ setHits()

template<typename T>
void TTCluster< T >::setHits ( std::vector< T aHits)
inline

Definition at line 41 of file TTCluster.h.

References TTCluster< T >::theHits.

41 { theHits = aHits; }
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73

◆ setStackMember()

template<typename T>
void TTCluster< T >::setStackMember ( unsigned int  aStackMember)
inline

Definition at line 47 of file TTCluster.h.

References TTCluster< T >::theStackMember.

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

Member Data Documentation

◆ theCols

template<typename T>
std::vector<int> TTCluster< T >::theCols
private

Definition at line 78 of file TTCluster.h.

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

◆ theDetId

template<typename T>
DetId TTCluster< T >::theDetId
private

Definition at line 74 of file TTCluster.h.

Referenced by TTCluster< T >::getDetId(), and TTCluster< T >::setDetId().

◆ theHits

template<typename T>
std::vector<T> TTCluster< T >::theHits
private

Data members.

Definition at line 73 of file TTCluster.h.

Referenced by TTCluster< T >::getHits(), and TTCluster< T >::setHits().

◆ theRows

template<typename T>
std::vector<int> TTCluster< T >::theRows
private

Definition at line 77 of file TTCluster.h.

Referenced by TTCluster< T >::getRows(), and TTCluster< T >::setCoordinates().

◆ theStackMember

template<typename T>
unsigned int TTCluster< T >::theStackMember
private

Definition at line 75 of file TTCluster.h.

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