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.

92  {
94  theHits.clear();
95  theDetId = 0;
96  theStackMember = 0;
97 
98  theRows.clear();
99  theCols.clear();
100 }

References bscTrigger_cfi::theHits.

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

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 }

References HLT_FULL_cff::setDetId.

◆ ~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.

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 }

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

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

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 }

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

◆ findCols() [1/3]

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

Definition at line 143 of file TTCluster.h.

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

References groupFilesInBlocks::temp.

◆ findCols() [2/3]

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

Definition at line 121 of file TTCluster.cc.

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 }

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

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

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 }

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

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

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

References groupFilesInBlocks::temp.

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

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 }

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

◆ 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 12 Cluster width

this is only the actual size in RPhi

This takes care of 1-Pixel clusters

Definition at line 15 of file TTCluster.cc.

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 }

References funct::abs(), mps_fire::i, and bscTrigger_cfi::theHits.

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

57 { return theCols; }

References TTCluster< T >::theCols.

◆ getDetId()

template<typename T>
DetId TTCluster< T >::getDetId ( void  ) const
inline

Detector element.

Definition at line 44 of file TTCluster.h.

44 { return theDetId; }

References TTCluster< T >::theDetId.

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

40 { return theHits; }

References TTCluster< T >::theHits.

◆ getRows()

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

Definition at line 56 of file TTCluster.h.

56 { return theRows; }

References TTCluster< T >::theRows.

◆ getStackMember()

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

Definition at line 46 of file TTCluster.h.

46 { return theStackMember; }

References TTCluster< T >::theStackMember.

◆ print()

template<typename T >
std::string TTCluster< T >::print ( unsigned int  i = 0) const

Information.

Definition at line 156 of file TTCluster.h.

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 }

References mps_fire::i, dqmiolumiharvest::j, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_QueryRunRegistry::string, and bscTrigger_cfi::theHits.

Referenced by operator<<().

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

52  {
53  theRows = a;
54  theCols = b;
55  }

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

◆ setDetId()

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

Definition at line 45 of file TTCluster.h.

45 { theDetId = aDetId; }

References TTCluster< T >::theDetId.

◆ setHits()

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

Definition at line 41 of file TTCluster.h.

41 { theHits = aHits; }

References TTCluster< T >::theHits.

◆ setStackMember()

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

Definition at line 47 of file TTCluster.h.

47 { theStackMember = aStackMember; }

References TTCluster< T >::theStackMember.

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().

Point2DBase
Definition: Point2DBase.h:9
hitIter
hitCont::const_iterator hitIter
Definition: DTMeantimerPatternReco.cc:35
mps_fire.i
i
Definition: mps_fire.py:428
TTCluster::setCoordinates
void setCoordinates(std::vector< int > a, std::vector< int > b)
Definition: TTCluster.h:52
TTCluster::theCols
std::vector< int > theCols
Definition: TTCluster.h:78
TTCluster::setDetId
void setDetId(DetId aDetId)
Definition: TTCluster.h:45
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
cuy.col
col
Definition: cuy.py:1010
TTCluster::setStackMember
void setStackMember(unsigned int aStackMember)
Definition: TTCluster.h:47
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
TTCluster::getRows
std::vector< int > getRows() const
Definition: TTCluster.h:56
TTCluster::theRows
std::vector< int > theRows
Definition: TTCluster.h:77
b
double b
Definition: hdecay.h:118
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
TTCluster::theDetId
DetId theDetId
Definition: TTCluster.h:74
a
double a
Definition: hdecay.h:119
TTCluster::theStackMember
unsigned int theStackMember
Definition: TTCluster.h:75
TTCluster::findRows
std::vector< int > findRows() const
Rows and columns to get rid of Digi collection.
Definition: TTCluster.h:137
TTCluster::theHits
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
Phase2TrackerDigi
Definition: Phase2TrackerDigi.h:12
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
TTCluster::setHits
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:41
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
TTCluster::getCols
std::vector< int > getCols() const
Definition: TTCluster.h:57
TTCluster::findCols
std::vector< int > findCols() const
Definition: TTCluster.h:143
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66