CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
MeasurementPoint findAverageLocalCoordinates () const
 
template<>
MeasurementPoint findAverageLocalCoordinates () const
 
std::vector< int > findCols () const
 
template<>
std::vector< int > findCols () const
 
template<>
std::vector< int > findCols () const
 
template<>
MeasurementPoint findHitLocalCoordinates (unsigned int hitIdx) const
 
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
 
template<>
std::vector< int > findRows () const
 
template<>
unsigned int findWidth () const
 
unsigned int findWidth () const
 Cluster width. More...
 
template<>
unsigned int findWidth () const
 
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.

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

109 {
111  this->setHits( aHits );
112  this->setDetId( aDetId );
113  this->setStackMember( aStackMember );
114 
115  theRows.clear();
116  theCols.clear();
117  if ( storeLocal )
118  {
119  this->setCoordinates( this->findRows(), this->findCols() );
120  }
121 }
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:148
std::vector< int > findRows() const
Rows and columns to get rid of Digi collection.
Definition: TTCluster.h:141
void setCoordinates(std::vector< int > a, std::vector< int > b)
Definition: TTCluster.h:56
std::vector< int > theCols
Definition: TTCluster.h:78
void setHits(std::vector< T > aHits)
Definition: TTCluster.h:45
std::vector< int > theRows
Definition: TTCluster.h:77
template<typename T >
TTCluster< T >::~TTCluster ( )

Destructor.

Definition at line 125 of file TTCluster.h.

125 {}

Member Function Documentation

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

Loop over the hits and calculate the average coordinates

Definition at line 61 of file TTCluster.cc.

References j.

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

Definition at line 148 of file TTCluster.h.

References groupFilesInBlocks::temp.

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

Definition at line 110 of file TTCluster.cc.

References i, and groupFilesInBlocks::temp.

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 }
int i
Definition: DBlmapReader.cc:9
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

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 findQualityFiles::size.

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

Single hit coordinates Average cluster coordinates

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

References groupFilesInBlocks::temp.

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

Definition at line 98 of file TTCluster.cc.

References i, and groupFilesInBlocks::temp.

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 }
int i
Definition: DBlmapReader.cc:9
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

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(), 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().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 }
int i
Definition: DBlmapReader.cc:9
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:57
template<typename T>
unsigned int TTCluster< T >::findWidth ( ) const

Cluster width.

template<>
unsigned int TTCluster< edm::Ref< edm::DetSetVector< Phase2TrackerDigi >, Phase2TrackerDigi > >::findWidth ( ) const
template<typename T>
std::vector< int > TTCluster< T >::getCols ( ) const
inline

Definition at line 58 of file TTCluster.h.

References TTCluster< T >::theCols.

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

Detector element.

Definition at line 48 of file TTCluster.h.

References TTCluster< T >::theDetId.

48 { 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 44 of file TTCluster.h.

References TTCluster< T >::theHits.

44 { 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 57 of file TTCluster.h.

References TTCluster< T >::theRows.

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

Definition at line 50 of file TTCluster.h.

References TTCluster< T >::theStackMember.

50 { 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 162 of file TTCluster.h.

References i, j, convertSQLitetoXML_cfg::output, and AlCaHLTBitMon_QueryRunRegistry::string.

163 {
164  std::string padding("");
165  for ( unsigned int j = 0; j != i; ++j )
166  {
167  padding+="\t";
168  }
169 
170  std::stringstream output;
171  output<<padding<<"TTCluster:\n";
172  padding+='\t';
173  output << padding << "DetId: " << theDetId.rawId() << '\n';
174  output << padding << "member: " << theStackMember << ", cluster size: " << theHits.size() << '\n';
175  return output.str();
176 }
int i
Definition: DBlmapReader.cc:9
std::vector< T > theHits
Data members.
Definition: TTCluster.h:73
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int j
Definition: DBlmapReader.cc:9
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 56 of file TTCluster.h.

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

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

Definition at line 49 of file TTCluster.h.

References TTCluster< T >::theDetId.

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

Definition at line 45 of file TTCluster.h.

References TTCluster< T >::theHits.

45 { 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 51 of file TTCluster.h.

References TTCluster< T >::theStackMember.

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

Member Data Documentation

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

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

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

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

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