CMS 3D CMS Logo

SiStripClusterInfo.h
Go to the documentation of this file.
1 #ifndef SISTRIPCLUSTERIZER_SISTRIPCLUSTERINFO_H
2 #define SISTRIPCLUSTERIZER_SISTRIPCLUSTERINFO_H
3 
14 
15 #include <algorithm>
16 #include <cstdint>
17 #include <numeric>
18 #include <utility>
19 #include <vector>
20 
22 public:
24 
25  void initEvent(const edm::EventSetup& iSetup);
26  void setCluster(const SiStripCluster& cluster, int detId);
27 
28  const SiStripCluster* cluster() const { return cluster_ptr; }
29 
30  uint32_t detId() const { return detId_; }
31  uint16_t width() const { return cluster()->amplitudes().size(); }
32  uint16_t firstStrip() const { return cluster()->firstStrip(); }
33  float baryStrip() const { return cluster()->barycenter(); }
34  uint16_t maxStrip() const { return firstStrip() + maxIndex(); }
35  float variance() const;
36 
37  auto stripCharges() const -> decltype(cluster()->amplitudes()) { return cluster()->amplitudes(); }
38  std::vector<float> stripGains() const;
39  std::vector<float> stripNoises() const;
40  std::vector<float> stripNoisesRescaledByGain() const;
41  std::vector<bool> stripQualitiesBad() const;
42 
43  uint16_t charge() const { return std::accumulate(stripCharges().begin(), stripCharges().end(), uint16_t(0)); }
44  uint8_t maxCharge() const { return *std::max_element(stripCharges().begin(), stripCharges().end()); }
45  uint16_t maxIndex() const {
46  return std::max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();
47  }
48  std::pair<uint16_t, uint16_t> chargeLR() const;
49 
50  float noise() const { return calculate_noise(stripNoises()); }
52 
53  float signalOverNoise() const { return charge() / noiseRescaledByGain(); }
54 
55  bool IsAnythingBad() const;
56  bool IsApvBad() const;
57  bool IsFiberBad() const;
58  bool IsModuleBad() const;
59  bool IsModuleUsable() const;
60 
61  const SiStripGain* siStripGain() const { return siStripGain_; }
62  const SiStripQuality* siStripQuality() const { return siStripQuality_; }
63 
64 private:
65  float calculate_noise(const std::vector<float>&) const;
66 
67  const SiStripCluster* cluster_ptr = nullptr;
68 
72 
73  const SiStripNoises* siStripNoises_ = nullptr;
74  const SiStripGain* siStripGain_ = nullptr;
75  const SiStripQuality* siStripQuality_ = nullptr;
76 
77  uint32_t detId_ = 0;
78 };
79 
80 #endif
SiStripClusterInfo::siStripNoises_
const SiStripNoises * siStripNoises_
Definition: SiStripClusterInfo.h:73
SiStripClusterInfo
Definition: SiStripClusterInfo.h:21
SiStripClusterInfo::maxStrip
uint16_t maxStrip() const
Definition: SiStripClusterInfo.h:34
SiStripCluster::barycenter
float barycenter() const
Definition: SiStripCluster.cc:25
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
SiStripGain.h
SiStripGain
Definition: SiStripGain.h:45
SiStripClusterInfo::detId_
uint32_t detId_
Definition: SiStripClusterInfo.h:77
SiStripClusterInfo::stripCharges
auto stripCharges() const -> decltype(cluster() ->amplitudes())
Definition: SiStripClusterInfo.h:37
SiStripClusterInfo::stripNoisesRescaledByGain
std::vector< float > stripNoisesRescaledByGain() const
Definition: SiStripClusterInfo.cc:38
SiStripGainRcd.h
SiStripClusterInfo::maxIndex
uint16_t maxIndex() const
Definition: SiStripClusterInfo.h:45
SiStripClusterInfo::IsModuleBad
bool IsModuleBad() const
Definition: SiStripClusterInfo.cc:110
SiStripNoises.h
SiStripClusterInfo::siStripQuality_
const SiStripQuality * siStripQuality_
Definition: SiStripClusterInfo.h:75
watchdog.const
const
Definition: watchdog.py:83
ESGetToken.h
SiStripClusterInfo::IsFiberBad
bool IsFiberBad() const
Definition: SiStripClusterInfo.cc:105
SiStripClusterInfo::detId
uint32_t detId() const
Definition: SiStripClusterInfo.h:30
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:46
SiStripClusterInfo::stripGains
std::vector< float > stripGains() const
Definition: SiStripClusterInfo.cc:62
SiStripClusterInfo::siStripQualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > siStripQualityToken_
Definition: SiStripClusterInfo.h:71
SiStripClusterInfo::variance
float variance() const
Definition: SiStripClusterInfo.cc:27
SiStripClusterInfo::baryStrip
float baryStrip() const
Definition: SiStripClusterInfo.h:33
SiStripClusterInfo::cluster_ptr
const SiStripCluster * cluster_ptr
Definition: SiStripClusterInfo.h:67
mps_fire.end
end
Definition: mps_fire.py:242
SiStripClusterInfo::firstStrip
uint16_t firstStrip() const
Definition: SiStripClusterInfo.h:32
SiStripClusterInfo::siStripGain
const SiStripGain * siStripGain() const
Definition: SiStripClusterInfo.h:61
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
SiStripClusterInfo::setCluster
void setCluster(const SiStripCluster &cluster, int detId)
Definition: SiStripClusterInfo.cc:16
SiStripCluster.h
SiStripCluster::size
uint8_t size() const
Definition: SiStripCluster.h:63
edm::EventSetup
Definition: EventSetup.h:58
SiStripClusterInfo::maxCharge
uint8_t maxCharge() const
Definition: SiStripClusterInfo.h:44
SiStripCluster::amplitudes
SiStripCluster const & amplitudes() const
Definition: SiStripCluster.h:68
SiStripClusterInfo::charge
uint16_t charge() const
Definition: SiStripClusterInfo.h:43
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripClusterInfo::initEvent
void initEvent(const edm::EventSetup &iSetup)
Definition: SiStripClusterInfo.cc:10
SiStripClusterInfo::siStripQuality
const SiStripQuality * siStripQuality() const
Definition: SiStripClusterInfo.h:62
SiStripClusterInfo::noiseRescaledByGain
float noiseRescaledByGain() const
Definition: SiStripClusterInfo.h:51
SiStripClusterInfo::IsModuleUsable
bool IsModuleUsable() const
Definition: SiStripClusterInfo.cc:112
SiStripQuality.h
SiStripClusterInfo::siStripNoisesToken_
edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > siStripNoisesToken_
Definition: SiStripClusterInfo.h:69
SiStripClusterInfo::IsApvBad
bool IsApvBad() const
Definition: SiStripClusterInfo.cc:100
SiStripQualityRcd.h
EventSetup.h
SiStripNoisesRcd.h
ConsumesCollector.h
SiStripClusterInfo::calculate_noise
float calculate_noise(const std::vector< float > &) const
Definition: SiStripClusterInfo.cc:82
SiStripClusterInfo::signalOverNoise
float signalOverNoise() const
Definition: SiStripClusterInfo.h:53
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
SiStripQuality
Definition: SiStripQuality.h:32