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

◆ calculate_noise()

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

Definition at line 82 of file SiStripClusterInfo.cc.

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 }

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

Referenced by noise(), and noiseRescaledByGain().

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

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 }

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

Referenced by ApeEstimator::fillHitVariables().

◆ cluster()

const SiStripCluster* SiStripClusterInfo::cluster ( ) const
inline

Definition at line 28 of file SiStripClusterInfo.h.

28 { return cluster_ptr; }

References cluster_ptr.

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

◆ detId()

uint32_t SiStripClusterInfo::detId ( ) const
inline

Definition at line 30 of file SiStripClusterInfo.h.

30 { return detId_; }

References detId_.

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

◆ firstStrip()

uint16_t SiStripClusterInfo::firstStrip ( ) const
inline

◆ initEvent()

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

◆ IsAnythingBad()

bool SiStripClusterInfo::IsAnythingBad ( ) const

Definition at line 94 of file SiStripClusterInfo.cc.

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

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

◆ IsApvBad()

bool SiStripClusterInfo::IsApvBad ( ) const

Definition at line 100 of file SiStripClusterInfo.cc.

100  {
101  return siStripQuality_->IsApvBad(detId_, firstStrip() / 128) ||
103 }

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

Referenced by IsAnythingBad().

◆ IsFiberBad()

bool SiStripClusterInfo::IsFiberBad ( ) const

Definition at line 105 of file SiStripClusterInfo.cc.

105  {
106  return siStripQuality_->IsFiberBad(detId_, firstStrip() / 256) ||
108 }

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

Referenced by IsAnythingBad().

◆ IsModuleBad()

bool SiStripClusterInfo::IsModuleBad ( ) const

Definition at line 110 of file SiStripClusterInfo.cc.

110 { return siStripQuality_->IsModuleBad(detId_); }

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

Referenced by IsAnythingBad().

◆ IsModuleUsable()

bool SiStripClusterInfo::IsModuleUsable ( ) const

◆ maxCharge()

uint8_t SiStripClusterInfo::maxCharge ( ) const
inline

Definition at line 44 of file SiStripClusterInfo.h.

44 { return *std::max_element(stripCharges().begin(), stripCharges().end()); }

References begin, end, and stripCharges().

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

◆ maxIndex()

uint16_t SiStripClusterInfo::maxIndex ( ) const
inline

Definition at line 45 of file SiStripClusterInfo.h.

45  {
46  return std::max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();
47  }

References begin, end, and stripCharges().

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

◆ maxStrip()

uint16_t SiStripClusterInfo::maxStrip ( ) const
inline

Definition at line 34 of file SiStripClusterInfo.h.

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

References firstStrip(), and maxIndex().

Referenced by ApeEstimator::fillHitVariables().

◆ noise()

float SiStripClusterInfo::noise ( ) const
inline

Definition at line 50 of file SiStripClusterInfo.h.

50 { return calculate_noise(stripNoises()); }

References calculate_noise(), and stripNoises().

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

◆ noiseRescaledByGain()

float SiStripClusterInfo::noiseRescaledByGain ( ) const
inline

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

61 { return siStripGain_; }

References siStripGain_.

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

◆ siStripQuality()

const SiStripQuality* SiStripClusterInfo::siStripQuality ( ) const
inline

Definition at line 62 of file SiStripClusterInfo.h.

62 { return siStripQuality_; }

References siStripQuality_.

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

◆ stripCharges()

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

◆ stripGains()

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

Definition at line 62 of file SiStripClusterInfo.cc.

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 }

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

◆ stripNoises()

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

Definition at line 51 of file SiStripClusterInfo.cc.

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 }

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

Referenced by noise().

◆ stripNoisesRescaledByGain()

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

Definition at line 38 of file SiStripClusterInfo.cc.

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 }

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

Referenced by noiseRescaledByGain().

◆ stripQualitiesBad()

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

Definition at line 73 of file SiStripClusterInfo.cc.

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 }

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

Referenced by IsAnythingBad().

◆ variance()

float SiStripClusterInfo::variance ( ) const

Definition at line 27 of file SiStripClusterInfo.cc.

27  {
28  float q(0), x1(0), x2(0);
29  for (auto begin(stripCharges().begin()), end(stripCharges().end()), it(begin); it != end; ++it) {
30  unsigned i = it - begin;
31  q += (*it);
32  x1 += (*it) * (i + 0.5);
33  x2 += (*it) * (i * i + i + 1. / 3);
34  }
35  return (x2 - x1 * x1 / q) / q;
36 }

References begin, end, mps_fire::i, data-class-funcs::q, stripCharges(), testProducerWithPsetDescEmpty_cfi::x1, and testProducerWithPsetDescEmpty_cfi::x2.

◆ 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().

SiStripClusterInfo::siStripNoises_
const SiStripNoises * siStripNoises_
Definition: SiStripClusterInfo.h:73
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
mps_fire.i
i
Definition: mps_fire.py:355
edm::ESInputTag
Definition: ESInputTag.h:87
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:23
SiStripClusterInfo::stripNoises
std::vector< float > stripNoises() const
Definition: SiStripClusterInfo.cc:51
SiStripClusterInfo::stripQualitiesBad
std::vector< bool > stripQualitiesBad() const
Definition: SiStripClusterInfo.cc:73
bysipixelclustmulteventfilter_cfi.qualityLabel
qualityLabel
Definition: bysipixelclustmulteventfilter_cfi.py:8
SiStripNoises
Definition: SiStripNoises.h:25
AlCaHarvesting_cff.SiStripQuality
SiStripQuality
Definition: AlCaHarvesting_cff.py:223
SiStripGain
Definition: SiStripGain.h:44
SiStripClusterInfo::detId_
uint32_t detId_
Definition: SiStripClusterInfo.h:77
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
SiStripQuality::IsModuleBad
bool IsModuleBad(const uint32_t &detid) const
Definition: SiStripQuality.cc:604
SiStripClusterInfo::stripCharges
auto stripCharges() const -> decltype(cluster() ->amplitudes())
Definition: SiStripClusterInfo.h:37
data-class-funcs.q
q
Definition: data-class-funcs.py:169
SiStripClusterInfo::stripNoisesRescaledByGain
std::vector< float > stripNoisesRescaledByGain() const
Definition: SiStripClusterInfo.cc:38
bookConverter.results
results
Definition: bookConverter.py:144
SiStripQuality::IsModuleUsable
bool IsModuleUsable(const uint32_t &detid) const
Definition: SiStripQuality.cc:590
SiStripClusterInfo::maxIndex
uint16_t maxIndex() const
Definition: SiStripClusterInfo.h:45
SiStripClusterInfo::IsModuleBad
bool IsModuleBad() const
Definition: SiStripClusterInfo.cc:110
SiStripNoises::getRange
const Range getRange(const uint32_t detID) const
Definition: SiStripNoises.cc:34
SiStripClusterInfo::siStripQuality_
const SiStripQuality * siStripQuality_
Definition: SiStripClusterInfo.h:75
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:86
SiStripClusterInfo::IsFiberBad
bool IsFiberBad() const
Definition: SiStripClusterInfo.cc:105
SiStripClusterInfo::detId
uint32_t detId() const
Definition: SiStripClusterInfo.h:30
SiStripNoisesRcd
Definition: SiStripCondDataRecords.h:40
end
#define end
Definition: vmac.h:39
SiStripGain::getStripGain
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:73
SiStripClusterInfo::cluster
const SiStripCluster * cluster() const
Definition: SiStripClusterInfo.h:28
SiStripClusterInfo::width
uint16_t width() const
Definition: SiStripClusterInfo.h:31
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:38
SiStripQuality::IsFiberBad
bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const
Definition: SiStripQuality.cc:612
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
SiStripClusterInfo::siStripQualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: SiStripClusterInfo.h:71
SiStripNoises::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:71
SiStripClusterInfo::cluster_ptr
const SiStripCluster * cluster_ptr
Definition: SiStripClusterInfo.h:67
SiStripQualityRcd
Definition: SiStripDependentRecords.h:56
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiStripClusterInfo::firstStrip
uint16_t firstStrip() const
Definition: SiStripClusterInfo.h:32
SiStripClusterInfo::siStripGain_
const SiStripGain * siStripGain_
Definition: SiStripClusterInfo.h:74
SiStripClusterInfo::noise
float noise() const
Definition: SiStripClusterInfo.h:50
SiStripQuality::IsStripBad
bool IsStripBad(const uint32_t &detid, const short &strip) const
Definition: SiStripQuality.cc:628
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiStripCluster::amplitudes
const std::vector< uint8_t > & amplitudes() const
Definition: SiStripCluster.h:51
SiStripClusterInfo::charge
uint16_t charge() const
Definition: SiStripClusterInfo.h:43
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:113
SiStripQuality::IsApvBad
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
Definition: SiStripQuality.cc:620
SiStripClusterInfo::noiseRescaledByGain
float noiseRescaledByGain() const
Definition: SiStripClusterInfo.h:51
SiStripApvGain::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripApvGain.h:28
SiStripClusterInfo::siStripNoisesToken_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > siStripNoisesToken_
Definition: SiStripClusterInfo.h:69
SiStripClusterInfo::IsApvBad
bool IsApvBad() const
Definition: SiStripClusterInfo.cc:100
SiStripClusterInfo::calculate_noise
float calculate_noise(const std::vector< float > &) const
Definition: SiStripClusterInfo.cc:82
SiStripNoises::getNoise
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:71
SiStripClusterInfo::siStripGainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > siStripGainToken_
Definition: SiStripClusterInfo.h:70
begin
#define begin
Definition: vmac.h:32
HLTEgPhaseIITestSequence_cff.noises
noises
Definition: HLTEgPhaseIITestSequence_cff.py:1348
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37