CMS 3D CMS Logo

SiStripThreshold.h
Go to the documentation of this file.
1 #ifndef SiStripThreshold_h
2 #define SiStripThreshold_h
3 
5 
6 #include <vector>
7 #include <map>
8 #include <iostream>
10 #include <sstream>
11 #include <cstdint>
12 
13 class TrackerTopology;
14 
43 public:
44  struct Data {
45  //used to create the threshold object for the ZS (that has only 2 thresholds)
46  inline void encode(const uint16_t& strip, const float& lTh, const float& hTh) {
48  ((uint32_t)(hTh * 5.0 + 0.5) & sistrip::HighThStripMask_);
49 
50  lowTh = ((uint32_t)(lTh * 5.0 + 0.5) & sistrip::LowThStripMask_);
51  clusTh = 0; //put as default;
52  }
53 
54  inline void encode(const uint16_t& strip, const float& lTh, const float& hTh, const float& cTh) {
55  encode(strip, lTh, hTh);
56  clusTh = (uint8_t)(cTh * 10 + .5);
57  }
58 
59  inline uint16_t getFirstStrip() const { return (FirstStrip_and_Hth >> sistrip::FirstThStripShift_); }
60  inline float getHth() const { return (FirstStrip_and_Hth & sistrip::HighThStripMask_) / 5.0; }
61  inline float getLth() const { return (lowTh & sistrip::LowThStripMask_) / 5.0; }
62  inline float getClusth() const { return clusTh / 10.0; }
63 
64  bool operator==(const Data& d) const {
65  return (getHth() == d.getHth()) && (lowTh == d.lowTh) && (clusTh == d.clusTh);
66  }
67  bool operator<(const Data& d) const { return (FirstStrip_and_Hth < d.FirstStrip_and_Hth); }
68 
69  void print(std::stringstream& ss) const {
70  ss << "firstStrip: " << getFirstStrip() << " \t"
71  << "lTh: "
72  << " " << getLth() << " \t"
73  << "hTh: "
74  << " " << getHth() << " \t"
75  << "cTh: "
76  << " " << getClusth() << " \t";
77  }
78 
80  uint8_t lowTh;
81  uint8_t clusTh;
82 
84  };
85 
86  struct DetRegistry {
87  uint32_t detid;
88  uint32_t ibegin;
89  uint32_t iend;
90 
92  };
93 
95  public:
96  bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
97  };
98 
100  public:
101  bool operator()(const uint16_t& i, const Data& p) const { return i < p.FirstStrip_and_Hth; }
102  };
103 
104  typedef std::vector<Data> Container;
105  typedef Container::const_iterator ContainerIterator;
106  typedef std::pair<ContainerIterator, ContainerIterator> Range;
107  typedef std::vector<DetRegistry> Registry;
108  typedef Registry::const_iterator RegistryIterator;
110 
113  v_threshold = orig.v_threshold;
114  indexes = orig.indexes;
115  }
116  virtual ~SiStripThreshold(){};
117 
118  bool put(const uint32_t& detID, const InputVector& vect);
119  const Range getRange(const uint32_t& detID) const;
120  void getDetIds(std::vector<uint32_t>& DetIds_) const;
121 
124  RegistryIterator getRegistryVectorBegin() const { return indexes.begin(); }
126 
127  void setData(const uint16_t& strip, const float& lTh, const float& hTh, Container& vthr);
128  void setData(const uint16_t& strip, const float& lTh, const float& hTh, const float& cTh, Container& vthr);
129  SiStripThreshold::Data getData(const uint16_t& strip, const Range& range) const;
130 
131  void allThresholds(std::vector<float>& lowThs, std::vector<float>& highThs, const Range& range) const;
132 
134  void printSummary(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
136  void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
137 
138 private:
139  Container::iterator compact(Container& input);
140  void addToStat(float value, uint16_t& range, float& sum, float& sum2, float& min, float& max) const;
141 
142 private:
145 
147 };
148 
149 #endif
SiStripThreshold::Registry
std::vector< DetRegistry > Registry
Definition: SiStripThreshold.h:107
SiStripThreshold::dataStrictWeakOrdering
Definition: SiStripThreshold.h:99
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripThreshold::StrictWeakOrdering
Definition: SiStripThreshold.h:94
mps_fire.i
i
Definition: mps_fire.py:428
SiStripThreshold::allThresholds
void allThresholds(std::vector< float > &lowThs, std::vector< float > &highThs, const Range &range) const
Definition: SiStripThreshold.cc:82
input
static const std::string input
Definition: EdmProvDump.cc:48
SiStripThreshold::DetRegistry::iend
uint32_t iend
Definition: SiStripThreshold.h:89
SiStripThreshold::compact
Container::iterator compact(Container &input)
Definition: SiStripThreshold.cc:33
SiStripThreshold::Data::operator<
bool operator<(const Data &d) const
Definition: SiStripThreshold.h:67
min
T min(T a, T b)
Definition: MathUtil.h:58
SiStripThreshold::printDebug
void printDebug(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints all the thresholds for all DetIds.
Definition: SiStripThreshold.cc:105
SiStripThreshold::Data::getLth
float getLth() const
Definition: SiStripThreshold.h:61
SiStripThreshold::SiStripThreshold
SiStripThreshold()
Definition: SiStripThreshold.h:111
TrackerTopology
Definition: TrackerTopology.h:16
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
SiStripThreshold::Data::FirstStrip_and_Hth
uint16_t FirstStrip_and_Hth
Definition: SiStripThreshold.h:79
SiStripThreshold::InputVector
Container InputVector
Definition: SiStripThreshold.h:109
COND_SERIALIZABLE
#define COND_SERIALIZABLE
Definition: Serializable.h:39
SiStripThreshold::getRegistryVectorEnd
RegistryIterator getRegistryVectorEnd() const
Definition: SiStripThreshold.h:125
SiStripThreshold::Data::getHth
float getHth() const
Definition: SiStripThreshold.h:60
SiStripThreshold::getDetIds
void getDetIds(std::vector< uint32_t > &DetIds_) const
Definition: SiStripThreshold.cc:48
SiStripThreshold::Container
std::vector< Data > Container
Definition: SiStripThreshold.h:104
SiStripThreshold::Data::getFirstStrip
uint16_t getFirstStrip() const
Definition: SiStripThreshold.h:59
SiStripThreshold::getDataVectorEnd
ContainerIterator getDataVectorEnd() const
Definition: SiStripThreshold.h:123
SiStripThreshold::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiStripThreshold.h:108
SiStripThreshold::SiStripThreshold
SiStripThreshold(const SiStripThreshold &orig)
Definition: SiStripThreshold.h:112
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
SiStripThreshold::StrictWeakOrdering::operator()
bool operator()(const DetRegistry &p, const uint32_t &i) const
Definition: SiStripThreshold.h:96
SiStripThreshold::printSummary
void printSummary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
Prints mean, rms, min and max threshold values for each DetId.
Definition: SiStripThreshold.cc:119
SiStripThreshold::addToStat
void addToStat(float value, uint16_t &range, float &sum, float &sum2, float &min, float &max) const
Definition: SiStripThreshold.cc:177
SiStripThreshold::getDataVectorBegin
ContainerIterator getDataVectorBegin() const
Definition: SiStripThreshold.h:122
SiStripThreshold::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiStripThreshold.cc:38
SiStripThreshold::getData
SiStripThreshold::Data getData(const uint16_t &strip, const Range &range) const
Definition: SiStripThreshold.cc:70
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripThreshold::put
bool put(const uint32_t &detID, const InputVector &vect)
Definition: SiStripThreshold.cc:8
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiStripThreshold::dataStrictWeakOrdering::operator()
bool operator()(const uint16_t &i, const Data &p) const
Definition: SiStripThreshold.h:101
ConstantsForCondObjects.h
SiStripThreshold::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripThreshold.h:106
SiStripThreshold::v_threshold
Container v_threshold
Definition: SiStripThreshold.h:143
Serializable.h
value
Definition: value.py:1
combinedConstraintHelpers::sum2
void sum2(T &x, T y)
Definition: CombinedKinematicConstraintT.h:74
SiStripThreshold::getRegistryVectorBegin
RegistryIterator getRegistryVectorBegin() const
Definition: SiStripThreshold.h:124
SiStripThreshold::DetRegistry::ibegin
uint32_t ibegin
Definition: SiStripThreshold.h:88
SiStripThreshold::Data::operator==
bool operator==(const Data &d) const
Definition: SiStripThreshold.h:64
sistrip::HighThStripMask_
static const uint32_t HighThStripMask_
Definition: ConstantsForCondObjects.h:12
SiStripThreshold
Definition: __init__.py:1
SiStripThreshold::DetRegistry::detid
uint32_t detid
Definition: SiStripThreshold.h:87
SiStripThreshold::Data::encode
void encode(const uint16_t &strip, const float &lTh, const float &hTh, const float &cTh)
Definition: SiStripThreshold.h:54
sistrip::LowThStripMask_
static const uint32_t LowThStripMask_
Definition: ConstantsForCondObjects.h:13
SiStripThreshold::Data::encode
void encode(const uint16_t &strip, const float &lTh, const float &hTh)
Definition: SiStripThreshold.h:46
SiStripThreshold::Data::getClusth
float getClusth() const
Definition: SiStripThreshold.h:62
SiStripThreshold::indexes
Registry indexes
Definition: SiStripThreshold.h:144
SiStripThreshold::Data::clusTh
uint8_t clusTh
Definition: SiStripThreshold.h:81
sistrip::FirstThStripShift_
static const uint32_t FirstThStripShift_
Definition: ConstantsForCondObjects.h:19
ztail.d
d
Definition: ztail.py:151
SiStripThreshold::Data
Definition: SiStripThreshold.h:44
SiStripThreshold::DetRegistry
Definition: SiStripThreshold.h:86
SiStripThreshold::Data::print
void print(std::stringstream &ss) const
Definition: SiStripThreshold.h:69
SiStripThreshold::~SiStripThreshold
virtual ~SiStripThreshold()
Definition: SiStripThreshold.h:116
SiStripThreshold::ContainerIterator
Container::const_iterator ContainerIterator
Definition: SiStripThreshold.h:105
SiStripThreshold::setData
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
Definition: SiStripThreshold.cc:57
sistrip::FirstThStripMask_
static const uint32_t FirstThStripMask_
Definition: ConstantsForCondObjects.h:11
SiStripThreshold::Data::lowTh
uint8_t lowTh
Definition: SiStripThreshold.h:80