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 (std::shared_ptr< const CaloCellGeometry > 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

std::shared_ptr< const CaloCellGeometrycaloCell_ = 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 37 of file PFRecHit.h.

Definition at line 33 of file PFRecHit.h.

Definition at line 35 of file PFRecHit.h.

Definition at line 34 of file PFRecHit.h.

Definition at line 36 of file PFRecHit.h.

Member Enumeration Documentation

anonymous enum
Enumerator
NONE 

Definition at line 49 of file PFRecHit.h.

49 { NONE = 0 };

Constructor & Destructor Documentation

reco::PFRecHit::PFRecHit ( )
inline

default constructor. Sets energy and position to zero

Definition at line 51 of file PFRecHit.h.

Referenced by PFRecHit().

51 {}
reco::PFRecHit::PFRecHit ( std::shared_ptr< const CaloCellGeometry caloCell,
unsigned int  detId,
PFLayer::Layer  layer,
float  energy 
)
inline

Definition at line 53 of file PFRecHit.h.

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

float energy_
rechit energy
Definition: PFRecHit.h:141
unsigned detId() const
rechit detId
Definition: PFRecHit.h:89
unsigned int detId_
cell detid
Definition: PFRecHit.h:135
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:138
std::shared_ptr< const CaloCellGeometry > caloCell_
cell geometry
Definition: PFRecHit.h:132
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:92
float energy() const
rechit energy
Definition: PFRecHit.h:95
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:85
def move(src, dest)
Definition: eostools.py:511
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  if (x > 0)
21  bitmask = bitmask | 1;
22  bitmask = bitmask | (absx << 1);
23  if (y > 0)
24  bitmask = bitmask | (1 << 4);
25  bitmask = bitmask | (absy << 5);
26  if (z > 0)
27  bitmask = bitmask | (1 << 8);
28  bitmask = bitmask | (absz << 9);
29 
30  auto pos = neighbours_.size();
31  if (z == 0) {
32  pos = neighbours8_++;
33  //find only the 4 neighbours
34  if (absx + absy == 1)
35  pos = neighbours4_++;
36  }
37  neighbours_.insert(neighbours_.begin() + pos, ref);
38  neighbourInfos_.insert(neighbourInfos_.begin() + pos, bitmask);
39 
40  assert(neighbours4_ < 5);
41  assert(neighbours8_ < 9);
42  assert(neighbours4_ <= neighbours8_);
43  assert(neighbours8_ <= neighbours_.size());
44  }
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:151
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:150
unsigned int neighbours4_
Definition: PFRecHit.h:154
unsigned int neighbours8_
Definition: PFRecHit.h:155
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Neighbours reco::PFRecHit::buildNeighbours ( unsigned int  n) const
inlineprivate

Definition at line 129 of file PFRecHit.h.

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

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

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

calo cell

Definition at line 85 of file PFRecHit.h.

References caloCell_.

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

85 { return *(caloCell_.get()); }
std::shared_ptr< const CaloCellGeometry > caloCell_
cell geometry
Definition: PFRecHit.h:132
void reco::PFRecHit::clearNeighbours ( )
inline

Definition at line 71 of file PFRecHit.h.

References neighbourInfos_, neighbours4_, neighbours8_, and neighbours_.

71  {
72  neighbours_.clear();
73  neighbourInfos_.clear();
75  }
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:151
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:150
unsigned int neighbours4_
Definition: PFRecHit.h:154
unsigned int neighbours8_
Definition: PFRecHit.h:155
int reco::PFRecHit::depth ( ) const
inline

depth for segemntation

Definition at line 101 of file PFRecHit.h.

References depth_.

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

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

Definition at line 114 of file PFRecHit.h.

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

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

rechit corners

Definition at line 112 of file PFRecHit.h.

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

Referenced by LinkByRecHit::testECALAndPSByRecHit().

112 { 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:85
unsigned int reco::PFRecHit::getNeighbour ( short  x,
short  y,
short  z 
) const

Definition at line 46 of file PFRecHit.cc.

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

Referenced by setEnergy().

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

Definition at line 86 of file PFRecHit.h.

References caloCell_.

Referenced by operator<<().

86 { return (caloCell_ != nullptr); }
std::shared_ptr< const CaloCellGeometry > caloCell_
cell geometry
Definition: PFRecHit.h:132
PFLayer::Layer reco::PFRecHit::layer ( ) const
inline
const std::vector<unsigned short>& reco::PFRecHit::neighbourInfos ( )
inline

Definition at line 82 of file PFRecHit.h.

References neighbourInfos_.

82 { return neighbourInfos_; }
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:151
Neighbours reco::PFRecHit::neighbours ( ) const
inline

Definition at line 80 of file PFRecHit.h.

References buildNeighbours(), and neighbours_.

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

Definition at line 77 of file PFRecHit.h.

References buildNeighbours(), and neighbours4_.

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

77 { return buildNeighbours(neighbours4_); }
unsigned int neighbours4_
Definition: PFRecHit.h:154
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:129
Neighbours reco::PFRecHit::neighbours8 ( ) const
inline

Definition at line 78 of file PFRecHit.h.

References buildNeighbours(), and neighbours8_.

78 { return buildNeighbours(neighbours8_); }
unsigned int neighbours8_
Definition: PFRecHit.h:155
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:129
bool reco::PFRecHit::operator< ( const PFRecHit rhs) const
inline

comparison < operator

Definition at line 126 of file PFRecHit.h.

References energy_.

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

comparison <= operator

Definition at line 123 of file PFRecHit.h.

References energy_.

123 { return (energy_ <= rhs.energy_); }
float energy_
rechit energy
Definition: PFRecHit.h:141
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 120 of file PFRecHit.h.

References energy_.

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

comparison >= operator

Definition at line 117 of file PFRecHit.h.

References energy_.

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

rechit cell centre x, y, z

Definition at line 107 of file PFRecHit.h.

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

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

107 { 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:85
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
RhoEtaPhi const& reco::PFRecHit::positionREP ( ) const
inline

Definition at line 109 of file PFRecHit.h.

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

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

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

rechit momentum transverse to the beam, squared.

Definition at line 104 of file PFRecHit.h.

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

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

Definition at line 70 of file PFRecHit.h.

References depth(), and depth_.

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

Member Data Documentation

std::shared_ptr<const CaloCellGeometry> reco::PFRecHit::caloCell_ = 0
private

cell geometry

Definition at line 132 of file PFRecHit.h.

Referenced by caloCell(), and hasCaloCell().

int reco::PFRecHit::depth_ = 0
private

depth

Definition at line 147 of file PFRecHit.h.

Referenced by depth(), and setDepth().

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

cell detid

Definition at line 135 of file PFRecHit.h.

Referenced by detId().

float reco::PFRecHit::energy_ = 0
private

rechit energy

Definition at line 141 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 138 of file PFRecHit.h.

Referenced by layer().

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

Definition at line 151 of file PFRecHit.h.

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

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

Definition at line 154 of file PFRecHit.h.

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

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

Definition at line 155 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 150 of file PFRecHit.h.

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

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

time

Definition at line 144 of file PFRecHit.h.

Referenced by setTime(), and time().