CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
CaloCellGeometry
caloCell_ = nullptr
 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.

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.

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
def move
Definition: eostools.py:511
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
reco::PFRecHit::PFRecHit ( const PFRecHit other)
default

copy

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

destructor

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(), cms::cuda::assert(), neighbourInfos_, neighbours4_, neighbours8_, and neighbours_.

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

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);
43  assert(neighbours8_ <= neighbours_.size());
44  }
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
assert(be >=bs)
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 dqmiodumpmetadata::n, 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 46 of file PFRecHit.cc.

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

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

Referenced by HGCalShowerShapeHelper::ShowerShapeCalc::setFilteredHitsAndFractions().

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

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

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

Definition at line 73 of file PFRecHit.h.

References time(), and time_.

Referenced by PFHBHERecHitCreator::importRecHits(), PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >::importRecHits(), and PFHFRecHitCreator::importRecHits().

73 { time_ = time; }
float time() const
timing for cleaned hits
Definition: PFRecHit.h:102
float time_
time
Definition: PFRecHit.h:154
float reco::PFRecHit::time ( ) const
inline

Member Data Documentation

std::shared_ptr<const CaloCellGeometry> reco::PFRecHit::caloCell_ = nullptr
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().