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...
 
uint32_t flags () const
 
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, uint32_t flags=0)
 
 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 setFlags (uint32_t flags)
 
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...
 
uint32_t flags_ = 0
 
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,
uint32_t  flags = 0 
)
inline

Definition at line 53 of file PFRecHit.h.

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

float energy_
rechit energy
Definition: PFRecHit.h:151
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
unsigned int detId_
cell detid
Definition: PFRecHit.h:145
uint32_t flags_
Definition: PFRecHit.h:168
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:148
std::shared_ptr< const CaloCellGeometry > caloCell_
cell geometry
Definition: PFRecHit.h:142
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:96
float energy() const
rechit energy
Definition: PFRecHit.h:99
uint32_t flags() const
Definition: PFRecHit.h:111
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:89
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 
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 short > neighbourInfos_
Definition: PFRecHit.h:161
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:160
unsigned int neighbours4_
Definition: PFRecHit.h:164
unsigned int neighbours8_
Definition: PFRecHit.h:165
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Neighbours reco::PFRecHit::buildNeighbours ( unsigned int  n) const
inlineprivate

Definition at line 139 of file PFRecHit.h.

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

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

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

calo cell

Definition at line 89 of file PFRecHit.h.

References caloCell_.

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

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

Definition at line 75 of file PFRecHit.h.

References neighbourInfos_, neighbours4_, neighbours8_, and neighbours_.

75  {
76  neighbours_.clear();
77  neighbourInfos_.clear();
79  }
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:161
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:160
unsigned int neighbours4_
Definition: PFRecHit.h:164
unsigned int neighbours8_
Definition: PFRecHit.h:165
int reco::PFRecHit::depth ( ) const
inline

depth for segemntation

Definition at line 105 of file PFRecHit.h.

References depth_.

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

105 { return depth_; }
int depth_
depth
Definition: PFRecHit.h:157
unsigned reco::PFRecHit::detId ( ) const
inline
float reco::PFRecHit::energy ( ) const
inline
uint32_t reco::PFRecHit::flags ( ) const
inline

Definition at line 111 of file PFRecHit.h.

References flags_.

Referenced by FlagsCleanerECAL::checkFlags(), and setFlags().

111 { return flags_; }
uint32_t flags_
Definition: PFRecHit.h:168
RepCorners const& reco::PFRecHit::getCornersREP ( ) const
inline

Definition at line 124 of file PFRecHit.h.

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

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

rechit corners

Definition at line 122 of file PFRecHit.h.

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

Referenced by LinkByRecHit::testECALAndPSByRecHit().

122 { 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:89
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 short > neighbourInfos_
Definition: PFRecHit.h:161
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:160
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool reco::PFRecHit::hasCaloCell ( ) const
inline

Definition at line 90 of file PFRecHit.h.

References caloCell_.

Referenced by operator<<().

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

Definition at line 86 of file PFRecHit.h.

References neighbourInfos_.

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

Definition at line 84 of file PFRecHit.h.

References buildNeighbours(), and neighbours_.

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

Definition at line 81 of file PFRecHit.h.

References buildNeighbours(), and neighbours4_.

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

81 { return buildNeighbours(neighbours4_); }
unsigned int neighbours4_
Definition: PFRecHit.h:164
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:139
Neighbours reco::PFRecHit::neighbours8 ( ) const
inline

Definition at line 82 of file PFRecHit.h.

References buildNeighbours(), and neighbours8_.

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

comparison < operator

Definition at line 136 of file PFRecHit.h.

References energy_.

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

comparison <= operator

Definition at line 133 of file PFRecHit.h.

References energy_.

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

References energy_.

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

comparison >= operator

Definition at line 127 of file PFRecHit.h.

References energy_.

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

rechit cell centre x, y, z

Definition at line 117 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().

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

Definition at line 119 of file PFRecHit.h.

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

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

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

rechit momentum transverse to the beam, squared.

Definition at line 108 of file PFRecHit.h.

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

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

Definition at line 74 of file PFRecHit.h.

References depth(), and depth_.

Referenced by PFHBHERecHitCreatorMaxSample::importRecHits().

74 { depth_ = depth; }
int depth_
depth
Definition: PFRecHit.h:157
int depth() const
depth for segemntation
Definition: PFRecHit.h:105
void reco::PFRecHit::setEnergy ( float  energy)
inline
void reco::PFRecHit::setFlags ( uint32_t  flags)
inline

Definition at line 114 of file PFRecHit.h.

References flags(), and flags_.

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.LabelItem::__init__().

114 { flags_ = flags; }
uint32_t flags_
Definition: PFRecHit.h:168
uint32_t flags() const
Definition: PFRecHit.h:111
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 142 of file PFRecHit.h.

Referenced by caloCell(), and hasCaloCell().

int reco::PFRecHit::depth_ = 0
private

depth

Definition at line 157 of file PFRecHit.h.

Referenced by depth(), and setDepth().

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

cell detid

Definition at line 145 of file PFRecHit.h.

Referenced by detId().

float reco::PFRecHit::energy_ = 0
private

rechit energy

Definition at line 151 of file PFRecHit.h.

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

uint32_t reco::PFRecHit::flags_ = 0
private

Definition at line 168 of file PFRecHit.h.

Referenced by flags(), and setFlags().

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

rechit layer

Definition at line 148 of file PFRecHit.h.

Referenced by layer().

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

Definition at line 161 of file PFRecHit.h.

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

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

Definition at line 164 of file PFRecHit.h.

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

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

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

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

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

time

Definition at line 154 of file PFRecHit.h.

Referenced by setTime(), and time().