CMS 3D CMS Logo

SiStripClusterInfo.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 
6  : siStripNoisesToken_{iC.esConsumes<SiStripNoises, SiStripNoisesRcd>()},
7  siStripGainToken_{iC.esConsumes<SiStripGain, SiStripGainRcd>()},
8  siStripQualityToken_{iC.esConsumes<SiStripQuality, SiStripQualityRcd>(edm::ESInputTag("", qualityLabel))} {}
9 
14 }
15 
16 void SiStripClusterInfo::setCluster(const SiStripCluster& cluster, int detId) {
18  detId_ = detId;
19 }
20 
21 std::pair<uint16_t, uint16_t> SiStripClusterInfo::chargeLR() const {
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 }
26 
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 }
37 
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 }
50 
51 std::vector<float> SiStripClusterInfo::stripNoises() const {
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 }
61 
62 std::vector<float> SiStripClusterInfo::stripGains() const {
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 }
72 
73 std::vector<bool> SiStripClusterInfo::stripQualitiesBad() const {
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 }
81 
82 float SiStripClusterInfo::calculate_noise(const std::vector<float>& noise) const {
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 }
93 
95  std::vector<bool> stripBad = stripQualitiesBad();
96  return IsApvBad() || IsFiberBad() || IsModuleBad() ||
97  accumulate(stripBad.begin(), stripBad.end(), false, std::logical_or<bool>());
98 }
99 
101  return siStripQuality_->IsApvBad(detId_, firstStrip() / 128) ||
103 }
104 
106  return siStripQuality_->IsFiberBad(detId_, firstStrip() / 256) ||
108 }
109 
111 
SiStripClusterInfo::siStripNoises_
const SiStripNoises * siStripNoises_
Definition: SiStripClusterInfo.h:73
SiStripGainRcd
Definition: SiStripDependentRecords.h:29
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
SiStripClusterInfo::stripNoises
std::vector< float > stripNoises() const
Definition: SiStripClusterInfo.cc:51
SiStripClusterInfo.h
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:233
SiStripGain
Definition: SiStripGain.h:45
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:558
SiStripClusterInfo::stripCharges
auto stripCharges() const -> decltype(cluster() ->amplitudes())
Definition: SiStripClusterInfo.h:37
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:544
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
SiStripClusterInfo::IsFiberBad
bool IsFiberBad() const
Definition: SiStripClusterInfo.cc:105
SiStripClusterInfo::detId
uint32_t detId() const
Definition: SiStripClusterInfo.h:30
SiStripNoisesRcd
Definition: SiStripCondDataRecords.h:40
SiStripGain::getStripGain
static float getStripGain(const uint16_t &strip, const SiStripApvGain::Range &range)
Definition: SiStripGain.h:77
SiStripClusterInfo::cluster
const SiStripCluster * cluster() const
Definition: SiStripClusterInfo.h:28
SiStripClusterInfo::width
uint16_t width() const
Definition: SiStripClusterInfo.h:31
SiStripQuality::IsFiberBad
bool IsFiberBad(const uint32_t &detid, const short &fiberNb) const
Definition: SiStripQuality.cc:566
SiStripClusterInfo::stripGains
std::vector< float > stripGains() const
Definition: SiStripClusterInfo.cc:62
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
SiStripClusterInfo::siStripQualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: SiStripClusterInfo.h:71
SiStripClusterInfo::variance
float variance() const
Definition: SiStripClusterInfo.cc:27
SiStripNoises::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
SiStripGain::getRange
const SiStripApvGain::Range getRange(uint32_t detID) const
Definition: SiStripGain.h:75
SiStripClusterInfo::cluster_ptr
const SiStripCluster * cluster_ptr
Definition: SiStripClusterInfo.h:67
SiStripQualityRcd
Definition: SiStripDependentRecords.h:51
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
mps_fire.end
end
Definition: mps_fire.py:242
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
SiStripClusterInfo::chargeLR
std::pair< uint16_t, uint16_t > chargeLR() const
Definition: SiStripClusterInfo.cc:21
SiStripQuality::IsStripBad
bool IsStripBad(const uint32_t &detid, const short &strip) const
Definition: SiStripQuality.cc:582
SiStripClusterInfo::setCluster
void setCluster(const SiStripCluster &cluster, int detId)
Definition: SiStripClusterInfo.cc:16
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
edm::EventSetup
Definition: EventSetup.h:58
gpuVertexFinder::noise
__shared__ int noise
Definition: gpuFitVertices.h:50
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
SiStripQuality::IsApvBad
bool IsApvBad(const uint32_t &detid, const short &apvNb) const
Definition: SiStripQuality.cc:574
SiStripClusterInfo::initEvent
void initEvent(const edm::EventSetup &iSetup)
Definition: SiStripClusterInfo.cc:10
SiStripClusterInfo::IsModuleUsable
bool IsModuleUsable() const
Definition: SiStripClusterInfo.cc:112
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:73
SiStripCluster
Definition: SiStripCluster.h:8
SiStripClusterInfo::siStripGainToken_
edm::ESGetToken< SiStripGain, SiStripGainRcd > siStripGainToken_
Definition: SiStripClusterInfo.h:70
SiStripClusterInfo::IsAnythingBad
bool IsAnythingBad() const
Definition: SiStripClusterInfo.cc:94
SiStripClusterInfo::SiStripClusterInfo
SiStripClusterInfo(edm::ConsumesCollector &&, const std::string &qualityLabel="")
Definition: SiStripClusterInfo.cc:5
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
HLTEgPhaseIITestSequence_cff.noises
noises
Definition: HLTEgPhaseIITestSequence_cff.py:1348
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37