CMS 3D CMS Logo

SiStripClusterInfo.h
Go to the documentation of this file.
1 #ifndef SISTRIPCLUSTERIZER_SISTRIPCLUSTERINFO_H
2 #define SISTRIPCLUSTERIZER_SISTRIPCLUSTERINFO_H
3 
7 #include <algorithm>
8 #include <numeric>
9 
10 class SiStripNoises;
11 class SiStripGain;
12 class SiStripQuality;
13 
14 
16 
17  public:
18 
20  const edm::EventSetup& es,
21  const int detid,
22  const std::string & qualityLabel="");
23 
24  const SiStripCluster * cluster() const {return cluster_ptr;}
25 
26  uint32_t detId() const {return detId_;}
27  uint16_t width() const {return cluster()->amplitudes().size();}
28  uint16_t firstStrip() const {return cluster()->firstStrip();}
29  float baryStrip() const {return cluster()->barycenter();}
30  uint16_t maxStrip() const {return firstStrip() + maxIndex();}
31  float variance() const;
32 
33  auto stripCharges() const ->decltype(cluster()->amplitudes()) {return cluster()->amplitudes();}
34  std::vector<float> stripGains() const;
35  std::vector<float> stripNoises() const;
36  std::vector<float> stripNoisesRescaledByGain() const;
37  std::vector<bool> stripQualitiesBad() const;
38 
39  uint16_t charge() const {return std::accumulate( stripCharges().begin(), stripCharges().end(), uint16_t(0));}
40  uint8_t maxCharge() const {return * std::max_element(stripCharges().begin(), stripCharges().end());}
41  uint16_t maxIndex() const {return std::max_element(stripCharges().begin(), stripCharges().end()) - stripCharges().begin();}
42  std::pair<uint16_t,uint16_t> chargeLR() const;
43 
44  float noise() const { return calculate_noise(stripNoises());}
46 
47  float signalOverNoise() const { return charge()/noiseRescaledByGain(); }
48 
49  bool IsAnythingBad() const;
50  bool IsApvBad() const;
51  bool IsFiberBad() const;
52  bool IsModuleBad() const;
53  bool IsModuleUsable() const;
54 
55  std::vector<SiStripCluster> reclusterize(const edm::ParameterSet&) const;
56 
57  private:
58 
59  float calculate_noise(const std::vector<float>&) const;
60 
67  uint32_t detId_;
68 };
69 
70 #endif
uint8_t maxCharge() const
edm::ESHandle< SiStripGain > gainHandle
uint16_t firstStrip() const
edm::ESHandle< SiStripQuality > qualityHandle
SiStripClusterInfo(const SiStripCluster &cluster, const edm::EventSetup &es, const int detid, const std::string &qualityLabel="")
std::vector< float > stripGains() const
bool IsAnythingBad() const
float noise() const
float noiseRescaledByGain() const
std::pair< uint16_t, uint16_t > chargeLR() const
std::vector< bool > stripQualitiesBad() const
float baryStrip() const
uint16_t firstStrip() const
float variance() const
float calculate_noise(const std::vector< float > &) const
uint16_t maxIndex() const
auto stripCharges() const -> decltype(cluster() ->amplitudes())
const SiStripCluster * cluster() const
float signalOverNoise() const
uint16_t charge() const
uint16_t width() const
float barycenter() const
#define end
Definition: vmac.h:39
const SiStripCluster * cluster_ptr
uint16_t maxStrip() const
const edm::EventSetup & es
uint32_t detId() const
bool IsModuleUsable() const
edm::ESHandle< SiStripNoises > noiseHandle
#define begin
Definition: vmac.h:32
std::vector< float > stripNoises() const
std::vector< SiStripCluster > reclusterize(const edm::ParameterSet &) const
const std::vector< uint8_t > & amplitudes() const
std::vector< float > stripNoisesRescaledByGain() const