CMS 3D CMS Logo

SiStripClusterizerConditions.h
Go to the documentation of this file.
1 #ifndef CalibFormats_SiStripObjects_StripClusterizerConditions_h
2 #define CalibFormats_SiStripObjects_StripClusterizerConditions_h
3 
7 
12 public:
14 
15  struct Det {
16  bool valid() const { return ind != invalidI; }
17  uint16_t rawNoise(const uint16_t strip) const { return SiStripNoises::getRawNoise(strip, noiseRange); }
18  float noise(const uint16_t strip) const { return SiStripNoises::getNoise(strip, noiseRange); }
19  float weight(const uint16_t strip) const { return m_weight[strip / 128]; }
20  bool bad(const uint16_t strip) const { return quality->IsStripBad(qualityRange, strip); }
21  bool allBadBetween(uint16_t L, const uint16_t& R) const {
22  while (++L < R && bad(L)) {
23  };
24  return L == R;
25  }
29  float m_weight[6];
30  uint32_t detId = 0;
31  unsigned short ind = invalidI;
32  };
33 
35 
36  std::vector<uint32_t> const& allDetIds() const { return m_detIds; }
37  auto const& allDets() const { return m_dets; }
38 
39  std::vector<const FedChannelConnection*> const& currentConnection(const Det& det) const {
40  return m_connections[det.ind];
41  }
42 
43  Det const& findDetId(const uint32_t id) const {
44  auto b = m_detIds.begin();
45  auto e = m_detIds.end();
46  auto p = std::lower_bound(b, e, id);
47  if (p == e || id != (*p)) {
48 #ifdef NOT_ON_MONTECARLO
49  edm::LogWarning("StripClusterizerAlgorithm")
50  << "id " << id << " not connected. this is impossible on data " << std::endl;
51 #endif
52  static const Det dummy = Det();
53  return dummy;
54  }
55  return m_dets[p - m_detIds.begin()];
56  }
57  bool isModuleBad(const uint32_t id) const { return m_quality->IsModuleBad(id); }
58  bool isModuleUsable(const uint32_t id) const { return m_quality->IsModuleUsable(id); }
59 
60  void reserve(std::size_t length) {
61  m_detIds.reserve(length);
62  m_dets.reserve(length);
63  m_connections.reserve(length);
64  }
65  void emplace_back(uint32_t id,
66  SiStripQuality::Range qualityRange,
67  SiStripNoises::Range noiseRange,
68  const std::vector<float>& invGains,
69  const std::vector<const FedChannelConnection*>& connections) {
70  const unsigned short index = m_detIds.size();
71  m_detIds.push_back(id);
72  auto& det = m_dets.emplace_back();
73  det.quality = m_quality;
74  det.qualityRange = qualityRange;
75  det.noiseRange = noiseRange;
76  for (uint32_t i = 0; i != invGains.size(); ++i) {
77  det.m_weight[i] = invGains[i];
78  }
79  det.detId = id;
80  det.ind = index;
81  m_connections.push_back(connections);
82  }
83 
84 private:
86  std::vector<uint32_t> m_detIds;
87  std::vector<Det> m_dets;
88  std::vector<std::vector<const FedChannelConnection*>> m_connections;
89 };
90 
91 #endif // CalibFormats_SiStripObjects_StripClusterizerConditions_h
static float getRawNoise(const uint16_t &strip, const Range &range)
Definition: SiStripNoises.h:65
float noise(const uint16_t strip) const
bool bad(const uint16_t strip) const
std::vector< const FedChannelConnection * > const & currentConnection(const Det &det) const
bool IsModuleBad(uint32_t detid) const
GeometricSearchDet Det
Definition: DetBelowR.h:8
std::vector< uint32_t > const & allDetIds() const
string quality
static float getNoise(uint16_t strip, const Range &range)
Definition: SiStripNoises.h:72
float weight(const uint16_t strip) const
Det const & findDetId(const uint32_t id) const
bool isModuleUsable(const uint32_t id) const
static constexpr unsigned short invalidI
SiStripClusterizerConditions(const SiStripQuality *quality)
bool IsStripBad(uint32_t detid, short strip) const
bool isModuleBad(const uint32_t id) const
double b
Definition: hdecay.h:120
std::vector< std::vector< const FedChannelConnection * > > m_connections
void emplace_back(uint32_t id, SiStripQuality::Range qualityRange, SiStripNoises::Range noiseRange, const std::vector< float > &invGains, const std::vector< const FedChannelConnection *> &connections)
std::pair< ContainerIterator, ContainerIterator > Range
bool allBadBetween(uint16_t L, const uint16_t &R) const
Log< level::Warning, false > LogWarning
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47
bool IsModuleUsable(uint32_t detid) const
uint16_t rawNoise(const uint16_t strip) const