CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
reco::PFRecHit Class Reference

Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClusterAlgo. More...

#include <PFRecHit.h>

Classes

struct  Neighbours
 

Public Types

enum  { NONE =0 }
 
using CornersVec = CaloCellGeometry::CornersVec
 
using PositionType = GlobalPoint::BasicVectorType
 
using RepCorners = CaloCellGeometry::RepCorners
 
using REPPoint = RhoEtaPhi
 
using REPPointVector = RepCorners
 

Public Member Functions

void addNeighbour (short x, short y, short z, unsigned int)
 
CaloCellGeometry const & caloCell () const
 calo cell More...
 
void clearNeighbours ()
 
int depth () const
 depth for segemntation More...
 
unsigned detId () const
 rechit detId More...
 
float energy () const
 rechit energy More...
 
RepCorners const & getCornersREP () const
 
CornersVec const & getCornersXYZ () const
 rechit corners More...
 
unsigned int getNeighbour (short x, short y, short z) const
 
bool hasCaloCell () const
 
PFLayer::Layer layer () const
 rechit layer More...
 
const std::vector< unsigned short > & neighbourInfos ()
 
Neighbours neighbours () const
 
Neighbours neighbours4 () const
 
Neighbours neighbours8 () const
 
bool operator< (const PFRecHit &rhs) const
 comparison < operator More...
 
bool operator<= (const PFRecHit &rhs) const
 comparison <= operator More...
 
PFRecHitoperator= (const PFRecHit &other)=default
 
PFRecHitoperator= (PFRecHit &&other)=default
 
bool operator> (const PFRecHit &rhs) const
 comparison > operator More...
 
bool operator>= (const PFRecHit &rhs) const
 comparison >= operator More...
 
 PFRecHit ()
 default constructor. Sets energy and position to zero More...
 
 PFRecHit (CaloCellGeometry const *caloCell, unsigned int detId, PFLayer::Layer layer, float energy)
 
 PFRecHit (const PFRecHit &other)=default
 copy More...
 
 PFRecHit (PFRecHit &&other)=default
 
PositionType const & position () const
 rechit cell centre x, y, z More...
 
RhoEtaPhi const & positionREP () const
 
double pt2 () const
 rechit momentum transverse to the beam, squared. More...
 
void setDepth (int depth)
 
void setEnergy (float energy)
 
void setTime (double time)
 
float time () const
 timing for cleaned hits More...
 
 ~PFRecHit ()=default
 destructor More...
 

Private Member Functions

Neighbours buildNeighbours (unsigned int n) const
 

Private Attributes

CaloCellGeometry const * caloCell_ = 0
 cell geometry More...
 
int depth_ =0
 depth More...
 
unsigned int detId_ =0
 cell detid More...
 
float energy_ =0
 rechit energy More...
 
PFLayer::Layer layer_ =PFLayer::NONE
 rechit layer More...
 
std::vector< unsigned short > neighbourInfos_
 
unsigned int neighbours4_ = 0
 
unsigned int neighbours8_ = 0
 
std::vector< unsigned int > neighbours_
 indices to existing neighbours (1 common side) More...
 
float time_ =-1
 time More...
 

Detailed Description

Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClusterAlgo.

Author
Colin Bernet
Date
July 2006

Feb 2014 [Michalis: 8 years later!Modifying the class to be able to generalize the neighbours for 3D calorimeters ]

Definition at line 31 of file PFRecHit.h.

Member Typedef Documentation

Definition at line 38 of file PFRecHit.h.

Definition at line 34 of file PFRecHit.h.

Definition at line 36 of file PFRecHit.h.

Definition at line 35 of file PFRecHit.h.

Definition at line 37 of file PFRecHit.h.

Member Enumeration Documentation

anonymous enum
Enumerator
NONE 

Definition at line 50 of file PFRecHit.h.

50  {
51  NONE=0
52  };

Constructor & Destructor Documentation

reco::PFRecHit::PFRecHit ( )
inline

default constructor. Sets energy and position to zero

Definition at line 54 of file PFRecHit.h.

Referenced by PFRecHit().

54 {}
reco::PFRecHit::PFRecHit ( CaloCellGeometry const *  caloCell,
unsigned int  detId,
PFLayer::Layer  layer,
float  energy 
)
inline

Definition at line 56 of file PFRecHit.h.

References operator=(), trackingPlots::other, PFRecHit(), and ~PFRecHit().

58  :
float energy_
rechit energy
Definition: PFRecHit.h:166
unsigned detId() const
rechit detId
Definition: PFRecHit.h:108
unsigned int detId_
cell detid
Definition: PFRecHit.h:160
CaloCellGeometry const * caloCell_
cell geometry
Definition: PFRecHit.h:157
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:163
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:111
float energy() const
rechit energy
Definition: PFRecHit.h:114
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:104
reco::PFRecHit::PFRecHit ( const PFRecHit other)
default

copy

reco::PFRecHit::PFRecHit ( PFRecHit &&  other)
default
reco::PFRecHit::~PFRecHit ( )
default

destructor

Referenced by PFRecHit().

Member Function Documentation

void reco::PFRecHit::addNeighbour ( short  x,
short  y,
short  z,
unsigned int  ref 
)

Definition at line 5 of file PFRecHit.cc.

References funct::abs(), neighbourInfos_, neighbours4_, neighbours8_, and neighbours_.

Referenced by PFRecHitNavigatorBase::associateNeighbour(), PFRecHitCaloNavigatorWithTime< EEDetId, EcalEndcapTopology >::associateNeighbour(), and setEnergy().

5  {
6  //bitmask interface to accomodate more advanced naighbour finding [i.e in z as well]
7  //bit 0 side for eta [0 for <=0 , 1 for >0]
8  //bits 1,2,3 : abs(eta) wrt the center
9  //bit 4 side for phi
10  //bits 5,6,7 : abs(phi) wrt the center
11  //bit 8 side for z
12  //bits 9,10,11 : abs(z) wrt the center
13 
14  unsigned short absx = std::abs(x);
15  unsigned short absy = std::abs(y);
16  unsigned short absz = std::abs(z);
17 
18  unsigned short bitmask=0;
19 
20 
21  if (x>0)
22  bitmask = bitmask | 1 ;
23  bitmask = bitmask | (absx << 1);
24  if (y>0)
25  bitmask = bitmask | (1<<4) ;
26  bitmask = bitmask | (absy << 5);
27  if (z>0)
28  bitmask = bitmask | (1<<8) ;
29  bitmask = bitmask | (absz << 9);
30 
31  auto pos = neighbours_.size();
32  if (z==0) {
33  pos = neighbours8_++;
34  //find only the 4 neighbours
35  if (absx+absy==1)
36  pos = neighbours4_++;
37  }
38  neighbours_.insert(neighbours_.begin()+pos,ref);
39  neighbourInfos_.insert(neighbourInfos_.begin()+pos,bitmask);
40 
41  assert( neighbours4_<5);
42  assert( neighbours8_<9);
43  assert( neighbours4_<=neighbours8_);
44  assert( neighbours8_<=neighbours_.size());
45 
46 }
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:176
unsigned int neighbours4_
Definition: PFRecHit.h:180
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:177
unsigned int neighbours8_
Definition: PFRecHit.h:181
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Neighbours reco::PFRecHit::buildNeighbours ( unsigned int  n) const
inlineprivate

Definition at line 154 of file PFRecHit.h.

References gen::n, reco::PFRecHit::Neighbours::Neighbours(), and neighbours_.

Referenced by neighbours(), neighbours4(), and neighbours8().

154 { return Neighbours(&neighbours_.front(),n);}
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:176
CaloCellGeometry const& reco::PFRecHit::caloCell ( ) const
inline

calo cell

Definition at line 104 of file PFRecHit.h.

References caloCell_.

Referenced by getCornersREP(), getCornersXYZ(), position(), and positionREP().

104 { return *caloCell_; }
CaloCellGeometry const * caloCell_
cell geometry
Definition: PFRecHit.h:157
void reco::PFRecHit::clearNeighbours ( )
inline

Definition at line 81 of file PFRecHit.h.

References neighbourInfos_, neighbours4_, neighbours8_, and neighbours_.

81  {
82  neighbours_.clear();
83  neighbourInfos_.clear();
85  }
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:176
unsigned int neighbours4_
Definition: PFRecHit.h:180
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:177
unsigned int neighbours8_
Definition: PFRecHit.h:181
int reco::PFRecHit::depth ( ) const
inline

depth for segemntation

Definition at line 121 of file PFRecHit.h.

References depth_.

Referenced by Basic2DGenericPFlowPositionCalc::calculateAndSetPositionActual(), and setDepth().

121 { return depth_; }
int depth_
depth
Definition: PFRecHit.h:172
unsigned reco::PFRecHit::detId ( ) const
inline
float reco::PFRecHit::energy ( ) const
inline
RepCorners const& reco::PFRecHit::getCornersREP ( ) const
inline

Definition at line 136 of file PFRecHit.h.

References caloCell(), and CaloCellGeometry::getCornersREP().

136 { return caloCell().getCornersREP();}
RepCorners const & getCornersREP() const
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:104
CornersVec const& reco::PFRecHit::getCornersXYZ ( ) const
inline

rechit corners

Definition at line 134 of file PFRecHit.h.

References caloCell(), and CaloCellGeometry::getCorners().

Referenced by LinkByRecHit::testECALAndPSByRecHit().

134 { return caloCell().getCorners(); }
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:104
unsigned int reco::PFRecHit::getNeighbour ( short  x,
short  y,
short  z 
) const

Definition at line 49 of file PFRecHit.cc.

References funct::abs(), mps_fire::i, SiStripPI::max, neighbourInfos_, and neighbours_.

Referenced by setEnergy().

49  {
50  unsigned short absx = abs(x);
51  unsigned short absy = abs(y);
52  unsigned short absz = abs(z);
53 
54  unsigned short bitmask=0;
55 
56  if (x>0)
57  bitmask = bitmask | 1 ;
58  bitmask = bitmask | (absx << 1);
59  if (y>0)
60  bitmask = bitmask | (1<<4) ;
61  bitmask = bitmask | (absy << 5);
62  if (z>0)
63  bitmask = bitmask | (1<<8) ;
64  bitmask = bitmask | (absz << 9);
65 
66  for (unsigned int i=0;i<neighbourInfos_.size();++i) {
67  if (neighbourInfos_[i] == bitmask)
68  return neighbours_[i];
69  }
71 }
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:176
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:177
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool reco::PFRecHit::hasCaloCell ( ) const
inline

Definition at line 105 of file PFRecHit.h.

References caloCell_.

Referenced by operator<<().

105 { return caloCell_; }
CaloCellGeometry const * caloCell_
cell geometry
Definition: PFRecHit.h:157
PFLayer::Layer reco::PFRecHit::layer ( ) const
inline
const std::vector<unsigned short>& reco::PFRecHit::neighbourInfos ( )
inline

Definition at line 98 of file PFRecHit.h.

References neighbourInfos_.

98  {
99  return neighbourInfos_;
100  }
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:177
Neighbours reco::PFRecHit::neighbours ( ) const
inline

Definition at line 94 of file PFRecHit.h.

References buildNeighbours(), and neighbours_.

94  {
95  return buildNeighbours(neighbours_.size());
96  }
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:176
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:154
Neighbours reco::PFRecHit::neighbours4 ( ) const
inline

Definition at line 87 of file PFRecHit.h.

References buildNeighbours(), and neighbours4_.

Referenced by RBXAndHPDCleaner::clean(), and SpikeAndDoubleSpikeCleaner::clean().

87  {
89  }
unsigned int neighbours4_
Definition: PFRecHit.h:180
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:154
Neighbours reco::PFRecHit::neighbours8 ( ) const
inline

Definition at line 90 of file PFRecHit.h.

References buildNeighbours(), and neighbours8_.

90  {
92  }
unsigned int neighbours8_
Definition: PFRecHit.h:181
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:154
bool reco::PFRecHit::operator< ( const PFRecHit rhs) const
inline

comparison < operator

Definition at line 149 of file PFRecHit.h.

References energy_.

149 { return (energy_< rhs.energy_); }
float energy_
rechit energy
Definition: PFRecHit.h:166
bool reco::PFRecHit::operator<= ( const PFRecHit rhs) const
inline

comparison <= operator

Definition at line 146 of file PFRecHit.h.

References energy_.

146 { return (energy_<=rhs.energy_); }
float energy_
rechit energy
Definition: PFRecHit.h:166
PFRecHit& reco::PFRecHit::operator= ( const PFRecHit other)
default

Referenced by PFRecHit().

PFRecHit& reco::PFRecHit::operator= ( PFRecHit &&  other)
default
bool reco::PFRecHit::operator> ( const PFRecHit rhs) const
inline

comparison > operator

Definition at line 143 of file PFRecHit.h.

References energy_.

143 { return (energy_> rhs.energy_); }
float energy_
rechit energy
Definition: PFRecHit.h:166
bool reco::PFRecHit::operator>= ( const PFRecHit rhs) const
inline

comparison >= operator

Definition at line 140 of file PFRecHit.h.

References energy_.

140 { return (energy_>=rhs.energy_); }
float energy_
rechit energy
Definition: PFRecHit.h:166
PositionType const& reco::PFRecHit::position ( ) const
inline

rechit cell centre x, y, z

Definition at line 129 of file PFRecHit.h.

References PV3DBase< T, PVType, FrameType >::basicVector(), caloCell(), and CaloCellGeometry::getPosition().

Referenced by KDTreeLinkerPSEcal::buildTree(), Basic2DGenericPFlowPositionCalc::calculateAndSetPositionActual(), PFAlgo::checkCleaning(), RBXAndHPDCleaner::clean(), pt2(), and LinkByRecHit::testECALAndPSByRecHit().

129 { return caloCell().getPosition().basicVector(); }
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:104
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
RhoEtaPhi const& reco::PFRecHit::positionREP ( ) const
inline

Definition at line 131 of file PFRecHit.h.

References caloCell(), and CaloCellGeometry::repPos().

Referenced by SpikeAndDoubleSpikeCleaner::clean(), and operator<<().

131 { return caloCell().repPos(); }
RhoEtaPhi const & repPos() const
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:104
double reco::PFRecHit::pt2 ( ) const
inline

rechit momentum transverse to the beam, squared.

Definition at line 124 of file PFRecHit.h.

References energy_, Basic3DVector< T >::mag2(), Basic3DVector< T >::perp2(), and position().

124  { return energy_ * energy_ *
125  ( position().perp2()/ position().mag2());}
float energy_
rechit energy
Definition: PFRecHit.h:166
T perp2() const
Squared magnitude of transverse component.
PositionType const & position() const
rechit cell centre x, y, z
Definition: PFRecHit.h:129
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
void reco::PFRecHit::setDepth ( int  depth)
inline

Definition at line 80 of file PFRecHit.h.

References depth(), and depth_.

Referenced by PFHBHERecHitCreatorMaxSample::importRecHits().

80 { depth_ = depth; }
int depth_
depth
Definition: PFRecHit.h:172
int depth() const
depth for segemntation
Definition: PFRecHit.h:121
void reco::PFRecHit::setEnergy ( float  energy)
inline
void reco::PFRecHit::setTime ( double  time)
inline
float reco::PFRecHit::time ( ) const
inline

Member Data Documentation

CaloCellGeometry const* reco::PFRecHit::caloCell_ = 0
private

cell geometry

Definition at line 157 of file PFRecHit.h.

Referenced by caloCell(), and hasCaloCell().

int reco::PFRecHit::depth_ =0
private

depth

Definition at line 172 of file PFRecHit.h.

Referenced by depth(), and setDepth().

unsigned int reco::PFRecHit::detId_ =0
private

cell detid

Definition at line 160 of file PFRecHit.h.

Referenced by detId().

float reco::PFRecHit::energy_ =0
private

rechit energy

Definition at line 166 of file PFRecHit.h.

Referenced by energy(), operator<(), operator<=(), operator>(), operator>=(), pt2(), and setEnergy().

PFLayer::Layer reco::PFRecHit::layer_ =PFLayer::NONE
private

rechit layer

Definition at line 163 of file PFRecHit.h.

Referenced by layer().

std::vector< unsigned short > reco::PFRecHit::neighbourInfos_
private

Definition at line 177 of file PFRecHit.h.

Referenced by addNeighbour(), clearNeighbours(), getNeighbour(), and neighbourInfos().

unsigned int reco::PFRecHit::neighbours4_ = 0
private

Definition at line 180 of file PFRecHit.h.

Referenced by addNeighbour(), clearNeighbours(), and neighbours4().

unsigned int reco::PFRecHit::neighbours8_ = 0
private

Definition at line 181 of file PFRecHit.h.

Referenced by addNeighbour(), clearNeighbours(), and neighbours8().

std::vector< unsigned int > reco::PFRecHit::neighbours_
private

indices to existing neighbours (1 common side)

Definition at line 176 of file PFRecHit.h.

Referenced by addNeighbour(), buildNeighbours(), clearNeighbours(), getNeighbour(), and neighbours().

float reco::PFRecHit::time_ =-1
private

time

Definition at line 169 of file PFRecHit.h.

Referenced by setTime(), and time().