CMS 3D CMS Logo

SiStripApvGain.h
Go to the documentation of this file.
1 #ifndef SiStripApvGain_h
2 #define SiStripApvGain_h
3 
5 
6 #include <vector>
7 #include <map>
8 #include <iostream>
10 #include <cstdint>
11 
12 class TrackerTopology;
13 
26 public:
27  typedef std::vector<float>::const_iterator ContainerIterator;
28  typedef std::pair<ContainerIterator, ContainerIterator> Range;
29  typedef std::vector<unsigned int> Registry;
30  typedef Registry::iterator RegistryIterator;
31  typedef Registry::const_iterator RegistryConstIterator;
32  typedef std::vector<float> InputVector;
33 
43 
45  return v_begin + *(ibegin_begin + (idet - detid_begin));
46  }
48  return v_begin + *(iend_begin + (idet - detid_begin));
49  }
50  };
51 
54 
57  p.detid_begin = v_detids.begin();
58  p.detid_end = v_detids.end();
59  p.ibegin_begin = v_ibegin.begin();
60  p.ibegin_end = v_ibegin.end();
61  p.iend_begin = v_iend.begin();
62  p.iend_end = v_iend.end();
63  p.v_begin = v_gains.begin();
64  p.v_end = v_gains.end();
65 
66  return p;
67  }
68 
69  bool put(const uint32_t& detID, Range input);
70  const Range getRange(const uint32_t detID) const;
71  Range getRangeByPos(unsigned short pos) const;
72  void getDetIds(std::vector<uint32_t>& DetIds_) const;
73 
74 #ifdef EDM_ML_DEBUG
75  static float getStripGain(const uint16_t& strip, const Range& range);
76  static float getApvGain(const uint16_t& apv, const Range& range);
77 #else
78  static float getStripGain(uint16_t strip, const Range& range) {
79  uint16_t apv = strip / 128;
80  return *(range.first + apv);
81  }
82  static float getApvGain(uint16_t apv, const Range& range) { return *(range.first + apv); }
83 #endif
84 
85  void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
86  void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
87 
88 private:
89  std::vector<float> v_gains;
90  std::vector<unsigned int> v_detids;
91  std::vector<unsigned int> v_ibegin;
92  std::vector<unsigned int> v_iend;
93 
95 };
96 
97 #endif
ContainerIterator getFirstElement(RegistryConstIterator &idet)
RegistryConstIterator iend_end
RegistryConstIterator iend_begin
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Registry::const_iterator RegistryConstIterator
static float getApvGain(uint16_t apv, const Range &range)
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Registry::iterator RegistryIterator
RegistryConstIterator detid_end
RegistryConstIterator detid_begin
std::vector< unsigned int > Registry
Range getRangeByPos(unsigned short pos) const
static std::string const input
Definition: EdmProvDump.cc:47
bool put(const uint32_t &detID, Range input)
RegistryConstIterator ibegin_begin
void getDetIds(std::vector< uint32_t > &DetIds_) const
std::vector< float > v_gains
RegistryPointers getRegistryPointers() const
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< unsigned int > v_iend
std::vector< float >::const_iterator ContainerIterator
std::vector< unsigned int > v_detids
ContainerIterator getLastElement(RegistryConstIterator &idet)
#define COND_SERIALIZABLE
Definition: Serializable.h:39
const Range getRange(const uint32_t detID) const
std::vector< float > InputVector
static float getStripGain(uint16_t strip, const Range &range)
std::vector< unsigned int > v_ibegin
RegistryConstIterator ibegin_end