CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes
RealisticCluster Class Reference

#include <RealisticCluster.h>

Classes

struct  LayerInfo
 

Public Member Functions

void addHitAndFraction (unsigned int hit, float fraction)
 
Hit3DPosition getCenterOfGravity (unsigned int layerId) const
 
float getEnergy () const
 
float getExclusiveEnergy () const
 
float getExclusiveEnergyFraction () const
 
unsigned int getLayersNum () const
 
float getMaxEnergy (unsigned int layerId) const
 
Hit3DPosition getMaxEnergyPosition (unsigned int layerId) const
 
const std::vector< std::pair
< unsigned int, float > > & 
hitsIdsAndFractions () const
 
void increaseEnergy (float value)
 
void increaseExclusiveEnergy (float value)
 
bool isVisible () const
 
void modifyFractionByIndex (float fraction, unsigned int index)
 
void modifyFractionForHitId (float fraction, unsigned int hitId)
 
 RealisticCluster ()
 
void setCenterOfGravity (unsigned int layerId, const Hit3DPosition &position)
 
void setLayersNum (unsigned int numberOfLayers)
 
bool setMaxEnergyHit (unsigned int layerId, float newEnergy, const Hit3DPosition position)
 
void setVisible (bool vis)
 

Private Types

using Hit3DPosition = std::array< float, 3 >
 

Private Attributes

float exclusiveEnergy
 
std::vector< std::pair
< unsigned int, float > > 
hitIdsAndFractions_
 
std::vector< LayerInfolayerInfo_
 
float totalEnergy
 
bool visible
 

Detailed Description

Definition at line 8 of file RealisticCluster.h.

Member Typedef Documentation

using RealisticCluster::Hit3DPosition = std::array<float, 3>
private

Definition at line 9 of file RealisticCluster.h.

Constructor & Destructor Documentation

RealisticCluster::RealisticCluster ( )
inline

Definition at line 20 of file RealisticCluster.h.

Member Function Documentation

void RealisticCluster::addHitAndFraction ( unsigned int  hit,
float  fraction 
)
inline

Definition at line 64 of file RealisticCluster.h.

References hitIdsAndFractions_.

64 { hitIdsAndFractions_.emplace_back(hit, fraction); }
std::vector< std::pair< unsigned int, float > > hitIdsAndFractions_
Hit3DPosition RealisticCluster::getCenterOfGravity ( unsigned int  layerId) const
inline

Definition at line 45 of file RealisticCluster.h.

References layerInfo_.

45 { return layerInfo_[layerId].centerOfGravityAtLayer_; }
std::vector< LayerInfo > layerInfo_
float RealisticCluster::getEnergy ( ) const
inline

Definition at line 33 of file RealisticCluster.h.

References totalEnergy.

33 { return totalEnergy; }
float RealisticCluster::getExclusiveEnergy ( ) const
inline

Definition at line 35 of file RealisticCluster.h.

References exclusiveEnergy.

35 { return exclusiveEnergy; }
float RealisticCluster::getExclusiveEnergyFraction ( ) const
inline

Definition at line 25 of file RealisticCluster.h.

References exclusiveEnergy, validate-o2o-wbm::f, HLT_FULL_cff::fraction, and totalEnergy.

25  {
26  float fraction = 0.f;
27  if (totalEnergy > 0.f) {
28  fraction = exclusiveEnergy / totalEnergy;
29  }
30  return fraction;
31  }
unsigned int RealisticCluster::getLayersNum ( ) const
inline

Definition at line 62 of file RealisticCluster.h.

References layerInfo_.

62 { return layerInfo_.size(); }
std::vector< LayerInfo > layerInfo_
float RealisticCluster::getMaxEnergy ( unsigned int  layerId) const
inline

Definition at line 58 of file RealisticCluster.h.

References layerInfo_.

58 { return layerInfo_[layerId].maxEnergyHitAtLayer_; }
std::vector< LayerInfo > layerInfo_
Hit3DPosition RealisticCluster::getMaxEnergyPosition ( unsigned int  layerId) const
inline

Definition at line 56 of file RealisticCluster.h.

References layerInfo_.

56 { return layerInfo_[layerId].maxHitPosAtLayer_; }
std::vector< LayerInfo > layerInfo_
const std::vector<std::pair<unsigned int, float> >& RealisticCluster::hitsIdsAndFractions ( ) const
inline

Definition at line 76 of file RealisticCluster.h.

References hitIdsAndFractions_.

76 { return hitIdsAndFractions_; }
std::vector< std::pair< unsigned int, float > > hitIdsAndFractions_
void RealisticCluster::increaseEnergy ( float  value)
inline

Definition at line 22 of file RealisticCluster.h.

References totalEnergy, and relativeConstraints::value.

void RealisticCluster::increaseExclusiveEnergy ( float  value)
inline
bool RealisticCluster::isVisible ( ) const
inline

Definition at line 37 of file RealisticCluster.h.

References visible.

37 { return visible; }
void RealisticCluster::modifyFractionByIndex ( float  fraction,
unsigned int  index 
)
inline

Definition at line 74 of file RealisticCluster.h.

References HLT_FULL_cff::fraction, and hitIdsAndFractions_.

74 { hitIdsAndFractions_[index].second = fraction; }
std::vector< std::pair< unsigned int, float > > hitIdsAndFractions_
void RealisticCluster::modifyFractionForHitId ( float  fraction,
unsigned int  hitId 
)
inline

Definition at line 66 of file RealisticCluster.h.

References HLT_FULL_cff::fraction, and hitIdsAndFractions_.

66  {
67  auto it = std::find_if(hitIdsAndFractions_.begin(),
68  hitIdsAndFractions_.end(),
69  [&hitId](const std::pair<unsigned int, float>& element) { return element.first == hitId; });
70 
71  it->second = fraction;
72  }
std::vector< std::pair< unsigned int, float > > hitIdsAndFractions_
void RealisticCluster::setCenterOfGravity ( unsigned int  layerId,
const Hit3DPosition position 
)
inline

Definition at line 41 of file RealisticCluster.h.

References layerInfo_, and position.

41  {
42  layerInfo_[layerId].centerOfGravityAtLayer_ = position;
43  }
std::vector< LayerInfo > layerInfo_
static int position[264][3]
Definition: ReadPGInfo.cc:289
void RealisticCluster::setLayersNum ( unsigned int  numberOfLayers)
inline

Definition at line 60 of file RealisticCluster.h.

References layerInfo_.

60 { layerInfo_.resize(numberOfLayers); }
const map< TString, int > numberOfLayers(TString Year="2018")
Definition: DMRtrends.cc:254
std::vector< LayerInfo > layerInfo_
bool RealisticCluster::setMaxEnergyHit ( unsigned int  layerId,
float  newEnergy,
const Hit3DPosition  position 
)
inline

Definition at line 47 of file RealisticCluster.h.

References layerInfo_, and position.

47  {
48  if (newEnergy > layerInfo_[layerId].maxEnergyHitAtLayer_) {
49  layerInfo_[layerId].maxEnergyHitAtLayer_ = newEnergy;
50  layerInfo_[layerId].maxHitPosAtLayer_ = position;
51  return true;
52  } else
53  return false;
54  }
std::vector< LayerInfo > layerInfo_
static int position[264][3]
Definition: ReadPGInfo.cc:289
void RealisticCluster::setVisible ( bool  vis)
inline

Definition at line 39 of file RealisticCluster.h.

References visible.

39 { visible = vis; }

Member Data Documentation

float RealisticCluster::exclusiveEnergy
private
std::vector<std::pair<unsigned int, float> > RealisticCluster::hitIdsAndFractions_
private
std::vector<LayerInfo> RealisticCluster::layerInfo_
private
float RealisticCluster::totalEnergy
private

Definition at line 82 of file RealisticCluster.h.

Referenced by getEnergy(), getExclusiveEnergyFraction(), and increaseEnergy().

bool RealisticCluster::visible
private

Definition at line 84 of file RealisticCluster.h.

Referenced by isVisible(), and setVisible().