CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SiStripClusterInfo Class Reference

#include <SiStripClusterInfo.h>

Public Member Functions

float baryStrip () const
 
uint16_t charge () const
 
std::pair< uint16_t, uint16_t > chargeLR () const
 
const SiStripClustercluster () const
 
uint32_t detId () const
 
uint16_t firstStrip () const
 
void initEvent (const edm::EventSetup &iSetup)
 
bool IsAnythingBad () const
 
bool IsApvBad () const
 
bool IsFiberBad () const
 
bool IsModuleBad () const
 
bool IsModuleUsable () const
 
uint8_t maxCharge () const
 
uint16_t maxIndex () const
 
uint16_t maxStrip () const
 
float noise () const
 
float noiseRescaledByGain () const
 
void setCluster (const SiStripCluster &cluster, int detId)
 
float signalOverNoise () const
 
 SiStripClusterInfo (edm::ConsumesCollector &&, const std::string &qualityLabel="")
 
const SiStripGainsiStripGain () const
 
const SiStripQualitysiStripQuality () const
 
auto stripCharges () const -> decltype(cluster() ->amplitudes())
 
std::vector< float > stripGains () const
 
std::vector< float > stripNoises () const
 
std::vector< float > stripNoisesRescaledByGain () const
 
std::vector< bool > stripQualitiesBad () const
 
float variance () const
 
uint16_t width () const
 

Private Member Functions

float calculate_noise (const std::vector< float > &) const
 

Private Attributes

const SiStripClustercluster_ptr = nullptr
 
uint32_t detId_ = 0
 
const SiStripGainsiStripGain_ = nullptr
 
edm::ESGetToken< SiStripGain, SiStripGainRcdsiStripGainToken_
 
const SiStripNoisessiStripNoises_ = nullptr
 
edm::ESGetToken< SiStripNoises, SiStripNoisesRcdsiStripNoisesToken_
 
const SiStripQualitysiStripQuality_ = nullptr
 
edm::ESGetToken< SiStripQuality, SiStripQualityRcdsiStripQualityToken_
 

Detailed Description

Definition at line 21 of file SiStripClusterInfo.h.

Constructor & Destructor Documentation

◆ SiStripClusterInfo()

SiStripClusterInfo::SiStripClusterInfo ( edm::ConsumesCollector &&  iC,
const std::string &  qualityLabel = "" 
)

Member Function Documentation

◆ baryStrip()

float SiStripClusterInfo::baryStrip ( ) const
inline

Definition at line 33 of file SiStripClusterInfo.h.

References SiStripCluster::barycenter(), and cluster().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), and ApeEstimator::fillHitVariables().

33 { return cluster()->barycenter(); }
const SiStripCluster * cluster() const
float barycenter() const

◆ calculate_noise()

float SiStripClusterInfo::calculate_noise ( const std::vector< float > &  noise) const
private

Definition at line 82 of file SiStripClusterInfo.cc.

References mps_fire::i, noise(), mathSSE::sqrt(), stripCharges(), and width().

Referenced by noise(), and noiseRescaledByGain().

82  {
83  float noiseSumInQuadrature = 0;
84  int numberStripsOverThreshold = 0;
85  for (int i = 0; i < width(); i++) {
86  if (stripCharges()[i] != 0) {
87  noiseSumInQuadrature += noise.at(i) * noise.at(i);
88  numberStripsOverThreshold++;
89  }
90  }
91  return std::sqrt(noiseSumInQuadrature / numberStripsOverThreshold);
92 }
auto stripCharges() const -> decltype(cluster() ->amplitudes())
T sqrt(T t)
Definition: SSEVec.h:23
uint16_t width() const

◆ charge()

uint16_t SiStripClusterInfo::charge ( void  ) const
inline

◆ chargeLR()

std::pair< uint16_t, uint16_t > SiStripClusterInfo::chargeLR ( ) const

Definition at line 21 of file SiStripClusterInfo.cc.

References mps_fire::end, SiStripPI::max, and stripCharges().

Referenced by ApeEstimator::fillHitVariables().

21  {
22  std::vector<uint8_t>::const_iterator begin(stripCharges().begin()), end(stripCharges().end()), max;
23  max = max_element(begin, end);
24  return std::make_pair(accumulate(begin, max, uint16_t(0)), accumulate(max + 1, end, uint16_t(0)));
25 }
auto stripCharges() const -> decltype(cluster() ->amplitudes())

◆ cluster()

const SiStripCluster* SiStripClusterInfo::cluster ( ) const
inline

Definition at line 28 of file SiStripClusterInfo.h.

References cluster_ptr.

Referenced by baryStrip(), firstStrip(), setCluster(), stripCharges(), and width().

28 { return cluster_ptr; }
const SiStripCluster * cluster_ptr

◆ detId()

uint32_t SiStripClusterInfo::detId ( ) const
inline

Definition at line 30 of file SiStripClusterInfo.h.

References detId_.

Referenced by SiStripMonitorTrack::clusterInfos(), and setCluster().

30 { return detId_; }

◆ firstStrip()

uint16_t SiStripClusterInfo::firstStrip ( ) const
inline

◆ initEvent()

void SiStripClusterInfo::initEvent ( const edm::EventSetup iSetup)

Definition at line 10 of file SiStripClusterInfo.cc.

References edm::EventSetup::getData(), siStripGain_, siStripGainToken_, siStripNoises_, siStripNoisesToken_, siStripQuality_, and siStripQualityToken_.

Referenced by HitEff::analyze(), SiStripMonitorTrack::analyze(), TrackerDpgAnalysis::analyze(), ApeEstimator::analyze(), and ShallowClustersProducer::produce().

10  {
14 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
const SiStripNoises * siStripNoises_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > siStripNoisesToken_
const SiStripGain * siStripGain_
const SiStripQuality * siStripQuality_
edm::ESGetToken< SiStripGain, SiStripGainRcd > siStripGainToken_

◆ IsAnythingBad()

bool SiStripClusterInfo::IsAnythingBad ( ) const

Definition at line 94 of file SiStripClusterInfo.cc.

References IsApvBad(), IsFiberBad(), IsModuleBad(), and stripQualitiesBad().

94  {
95  std::vector<bool> stripBad = stripQualitiesBad();
96  return IsApvBad() || IsFiberBad() || IsModuleBad() ||
97  accumulate(stripBad.begin(), stripBad.end(), false, std::logical_or<bool>());
98 }
std::vector< bool > stripQualitiesBad() const

◆ IsApvBad()

bool SiStripClusterInfo::IsApvBad ( ) const

Definition at line 100 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripQuality::IsApvBad(), siStripQuality_, and width().

Referenced by IsAnythingBad().

100  {
101  return siStripQuality_->IsApvBad(detId_, firstStrip() / 128) ||
103 }
bool IsApvBad(uint32_t detid, short apvNb) const
uint16_t firstStrip() const
const SiStripQuality * siStripQuality_
uint16_t width() const

◆ IsFiberBad()

bool SiStripClusterInfo::IsFiberBad ( ) const

Definition at line 105 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripQuality::IsFiberBad(), siStripQuality_, and width().

Referenced by IsAnythingBad().

105  {
106  return siStripQuality_->IsFiberBad(detId_, firstStrip() / 256) ||
108 }
uint16_t firstStrip() const
const SiStripQuality * siStripQuality_
uint16_t width() const
bool IsFiberBad(uint32_t detid, short fiberNb) const

◆ IsModuleBad()

bool SiStripClusterInfo::IsModuleBad ( ) const

Definition at line 110 of file SiStripClusterInfo.cc.

References detId_, SiStripQuality::IsModuleBad(), and siStripQuality_.

Referenced by IsAnythingBad().

110 { return siStripQuality_->IsModuleBad(detId_); }
bool IsModuleBad(uint32_t detid) const
const SiStripQuality * siStripQuality_

◆ IsModuleUsable()

bool SiStripClusterInfo::IsModuleUsable ( ) const

Definition at line 112 of file SiStripClusterInfo.cc.

References detId_, SiStripQuality::IsModuleUsable(), and siStripQuality_.

Referenced by ApeEstimator::fillHitVariables().

const SiStripQuality * siStripQuality_
bool IsModuleUsable(uint32_t detid) const

◆ maxCharge()

uint8_t SiStripClusterInfo::maxCharge ( ) const
inline

Definition at line 44 of file SiStripClusterInfo.h.

References mps_fire::end, and stripCharges().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), and ApeEstimator::fillHitVariables().

44 { return *std::max_element(stripCharges().begin(), stripCharges().end()); }
auto stripCharges() const -> decltype(cluster() ->amplitudes())

◆ maxIndex()

uint16_t SiStripClusterInfo::maxIndex ( ) const
inline

Definition at line 45 of file SiStripClusterInfo.h.

References mps_fire::end, and stripCharges().

Referenced by SiStripMonitorTrack::clusterInfos(), ApeEstimator::fillHitVariables(), and maxStrip().

45  {
46  return std::max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();
47  }
auto stripCharges() const -> decltype(cluster() ->amplitudes())

◆ maxStrip()

uint16_t SiStripClusterInfo::maxStrip ( ) const
inline

Definition at line 34 of file SiStripClusterInfo.h.

References firstStrip(), and maxIndex().

Referenced by ApeEstimator::fillHitVariables().

34 { return firstStrip() + maxIndex(); }
uint16_t firstStrip() const
uint16_t maxIndex() const

◆ noise()

float SiStripClusterInfo::noise ( ) const
inline

Definition at line 50 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoises().

Referenced by TrackerDpgAnalysis::analyze(), and calculate_noise().

50 { return calculate_noise(stripNoises()); }
float calculate_noise(const std::vector< float > &) const
std::vector< float > stripNoises() const

◆ noiseRescaledByGain()

float SiStripClusterInfo::noiseRescaledByGain ( ) const
inline

Definition at line 51 of file SiStripClusterInfo.h.

References calculate_noise(), and stripNoisesRescaledByGain().

Referenced by TrackerDpgAnalysis::analyze(), SiStripMonitorTrack::clusterInfos(), and signalOverNoise().

float calculate_noise(const std::vector< float > &) const
std::vector< float > stripNoisesRescaledByGain() const

◆ setCluster()

void SiStripClusterInfo::setCluster ( const SiStripCluster cluster,
int  detId 
)

◆ signalOverNoise()

float SiStripClusterInfo::signalOverNoise ( ) const
inline

◆ siStripGain()

const SiStripGain* SiStripClusterInfo::siStripGain ( ) const
inline

Definition at line 61 of file SiStripClusterInfo.h.

References siStripGain_.

Referenced by SiStripMonitorTrack::AllClusters(), and SiStripMonitorTrack::RecHitInfo().

61 { return siStripGain_; }
const SiStripGain * siStripGain_

◆ siStripQuality()

const SiStripQuality* SiStripClusterInfo::siStripQuality ( ) const
inline

Definition at line 62 of file SiStripClusterInfo.h.

References siStripQuality_.

Referenced by SiStripMonitorTrack::AllClusters(), and SiStripMonitorTrack::RecHitInfo().

62 { return siStripQuality_; }
const SiStripQuality * siStripQuality_

◆ stripCharges()

auto SiStripClusterInfo::stripCharges ( ) const -> decltype(cluster()->amplitudes())
inline

Definition at line 37 of file SiStripClusterInfo.h.

References SiStripCluster::amplitudes(), and cluster().

Referenced by calculate_noise(), charge(), chargeLR(), SiStripMonitorTrack::clusterInfos(), ApeEstimator::fillHitVariables(), maxCharge(), maxIndex(), and variance().

37 { return cluster()->amplitudes(); }
SiStripCluster const & amplitudes() const
const SiStripCluster * cluster() const

◆ stripGains()

std::vector< float > SiStripClusterInfo::stripGains ( ) const

Definition at line 62 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), ecalph2::gains, SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, siStripGain_, and width().

62  {
64 
65  std::vector<float> gains;
66  gains.reserve(width());
67  for (size_t i = 0; i < width(); i++) {
68  gains.push_back(siStripGain_->getStripGain(firstStrip() + i, detGainRange));
69  }
70  return gains;
71 }
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
std::pair< ContainerIterator, ContainerIterator > Range
uint16_t firstStrip() const
constexpr float gains[NGAINS]
Definition: EcalConstants.h:20
const SiStripGain * siStripGain_
uint16_t width() const

◆ stripNoises()

std::vector< float > SiStripClusterInfo::stripNoises ( ) const

Definition at line 51 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), SiStripNoises::getNoise(), SiStripNoises::getRange(), mps_fire::i, hltHgcalLayerClustersEE_cfi::noises, siStripNoises_, and width().

Referenced by noise().

51  {
53 
54  std::vector<float> noises;
55  noises.reserve(width());
56  for (size_t i = 0; i < width(); i++) {
57  noises.push_back(siStripNoises_->getNoise(firstStrip() + i, detNoiseRange));
58  }
59  return noises;
60 }
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:72
const SiStripNoises * siStripNoises_
uint16_t firstStrip() const
uint16_t width() const
const Range getRange(const uint32_t detID) const
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47

◆ stripNoisesRescaledByGain()

std::vector< float > SiStripClusterInfo::stripNoisesRescaledByGain ( ) const

Definition at line 38 of file SiStripClusterInfo.cc.

References detId_, MillePedeFileConverter_cfg::e, firstStrip(), SiStripNoises::getNoise(), SiStripNoises::getRange(), SiStripGain::getRange(), SiStripGain::getStripGain(), mps_fire::i, mysort::results, siStripGain_, siStripNoises_, and width().

Referenced by noiseRescaledByGain().

38  {
41 
42  std::vector<float> results;
43  results.reserve(width());
44  for (size_t i = 0, e = width(); i < e; i++) {
45  results.push_back(siStripNoises_->getNoise(firstStrip() + i, detNoiseRange) /
46  siStripGain_->getStripGain(firstStrip() + i, detGainRange));
47  }
48  return results;
49 }
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:72
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
std::pair< ContainerIterator, ContainerIterator > Range
const SiStripNoises * siStripNoises_
uint16_t firstStrip() const
const SiStripGain * siStripGain_
uint16_t width() const
const Range getRange(const uint32_t detID) const
results
Definition: mysort.py:8
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47

◆ stripQualitiesBad()

std::vector< bool > SiStripClusterInfo::stripQualitiesBad ( ) const

Definition at line 73 of file SiStripClusterInfo.cc.

References detId_, firstStrip(), mps_fire::i, SiStripQuality::IsStripBad(), siStripQuality_, and width().

Referenced by IsAnythingBad().

73  {
74  std::vector<bool> isBad;
75  isBad.reserve(width());
76  for (int i = 0; i < width(); i++) {
77  isBad.push_back(siStripQuality_->IsStripBad(detId_, firstStrip() + i));
78  }
79  return isBad;
80 }
uint16_t firstStrip() const
bool IsStripBad(uint32_t detid, short strip) const
const SiStripQuality * siStripQuality_
uint16_t width() const

◆ variance()

float SiStripClusterInfo::variance ( ) const

◆ width()

uint16_t SiStripClusterInfo::width ( ) const
inline

Member Data Documentation

◆ cluster_ptr

const SiStripCluster* SiStripClusterInfo::cluster_ptr = nullptr
private

Definition at line 67 of file SiStripClusterInfo.h.

Referenced by cluster(), and setCluster().

◆ detId_

uint32_t SiStripClusterInfo::detId_ = 0
private

◆ siStripGain_

const SiStripGain* SiStripClusterInfo::siStripGain_ = nullptr
private

Definition at line 74 of file SiStripClusterInfo.h.

Referenced by initEvent(), siStripGain(), stripGains(), and stripNoisesRescaledByGain().

◆ siStripGainToken_

edm::ESGetToken<SiStripGain, SiStripGainRcd> SiStripClusterInfo::siStripGainToken_
private

Definition at line 70 of file SiStripClusterInfo.h.

Referenced by initEvent().

◆ siStripNoises_

const SiStripNoises* SiStripClusterInfo::siStripNoises_ = nullptr
private

Definition at line 73 of file SiStripClusterInfo.h.

Referenced by initEvent(), stripNoises(), and stripNoisesRescaledByGain().

◆ siStripNoisesToken_

edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> SiStripClusterInfo::siStripNoisesToken_
private

Definition at line 69 of file SiStripClusterInfo.h.

Referenced by initEvent().

◆ siStripQuality_

const SiStripQuality* SiStripClusterInfo::siStripQuality_ = nullptr
private

◆ siStripQualityToken_

edm::ESGetToken<SiStripQuality, SiStripQualityRcd> SiStripClusterInfo::siStripQualityToken_
private

Definition at line 71 of file SiStripClusterInfo.h.

Referenced by initEvent().