CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
SiStripThreshold Class Reference

#include <SiStripThreshold.h>

Classes

struct  Data
 
class  dataStrictWeakOrdering
 
struct  DetRegistry
 
class  StrictWeakOrdering
 

Public Types

typedef std::vector< DataContainer
 
typedef Container::const_iterator ContainerIterator
 
typedef Container InputVector
 
typedef std::pair< ContainerIterator, ContainerIteratorRange
 
typedef std::vector< DetRegistryRegistry
 
typedef Registry::const_iterator RegistryIterator
 

Public Member Functions

void allThresholds (std::vector< float > &lowThs, std::vector< float > &highThs, const Range &range) const
 
SiStripThreshold::Data getData (const uint16_t &strip, const Range &range) const
 
ContainerIterator getDataVectorBegin () const
 
ContainerIterator getDataVectorEnd () const
 
void getDetIds (std::vector< uint32_t > &DetIds_) const
 
const Range getRange (const uint32_t &detID) const
 
RegistryIterator getRegistryVectorBegin () const
 
RegistryIterator getRegistryVectorEnd () const
 
void printDebug (std::stringstream &ss, const TrackerTopology *trackerTopo) const
 Prints all the thresholds for all DetIds. More...
 
void printSummary (std::stringstream &ss, const TrackerTopology *trackerTopo) const
 Prints mean, rms, min and max threshold values for each DetId. More...
 
bool put (const uint32_t &detID, const InputVector &vect)
 
void setData (const uint16_t &strip, const float &lTh, const float &hTh, const float &cTh, Container &vthr)
 
void setData (const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
 
 SiStripThreshold ()
 
 SiStripThreshold (const SiStripThreshold &orig)
 
virtual ~SiStripThreshold ()
 

Private Member Functions

void addToStat (float value, uint16_t &range, float &sum, float &sum2, float &min, float &max) const
 
Container::iterator compact (Container &input)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

Registry indexes
 
Container v_threshold
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Holds the thresholds:

Definition at line 42 of file SiStripThreshold.h.

Member Typedef Documentation

◆ Container

typedef std::vector<Data> SiStripThreshold::Container

Definition at line 104 of file SiStripThreshold.h.

◆ ContainerIterator

typedef Container::const_iterator SiStripThreshold::ContainerIterator

Definition at line 105 of file SiStripThreshold.h.

◆ InputVector

Definition at line 109 of file SiStripThreshold.h.

◆ Range

Definition at line 106 of file SiStripThreshold.h.

◆ Registry

Definition at line 107 of file SiStripThreshold.h.

◆ RegistryIterator

typedef Registry::const_iterator SiStripThreshold::RegistryIterator

Definition at line 108 of file SiStripThreshold.h.

Constructor & Destructor Documentation

◆ SiStripThreshold() [1/2]

SiStripThreshold::SiStripThreshold ( )
inline

Definition at line 111 of file SiStripThreshold.h.

111 {};

◆ SiStripThreshold() [2/2]

SiStripThreshold::SiStripThreshold ( const SiStripThreshold orig)
inline

Definition at line 112 of file SiStripThreshold.h.

112  {
113  v_threshold = orig.v_threshold;
114  indexes = orig.indexes;
115  }

References indexes, and v_threshold.

◆ ~SiStripThreshold()

virtual SiStripThreshold::~SiStripThreshold ( )
inlinevirtual

Definition at line 116 of file SiStripThreshold.h.

116 {};

Member Function Documentation

◆ addToStat()

void SiStripThreshold::addToStat ( float  value,
uint16_t &  range,
float &  sum,
float &  sum2,
float &  min,
float &  max 
) const
private

Definition at line 177 of file SiStripThreshold.cc.

177  {
178  sum += value * range;
179  sum2 += value * value * range;
180  if (value < min)
181  min = value;
182  if (value > max)
183  max = value;
184 }

References SiStripPI::max, min(), FastTimerService_cff::range, combinedConstraintHelpers::sum2(), and relativeConstraints::value.

Referenced by printSummary().

◆ allThresholds()

void SiStripThreshold::allThresholds ( std::vector< float > &  lowThs,
std::vector< float > &  highThs,
const Range range 
) const

Definition at line 82 of file SiStripThreshold.cc.

84  {
85  ContainerIterator it = range.first;
86  size_t strips = lowThs.size();
87  assert(strips == highThs.size());
88  while (it != range.second) {
89  size_t firstStrip = it->getFirstStrip();
90  //std::cout << "First strip is " << firstStrip << std::endl;
91  float high = it->getHth(), low = it->getLth();
92  //std::cout << "High is " << high << ", low is " << low << std::endl;
93  ++it; // increment the pointer
94  size_t lastStrip = (it == range.second ? strips : it->getFirstStrip());
95  //std::cout << "Last strip is " << lastStrip << std::endl;
96  if (lastStrip > strips) {
97  it = range.second; // I should stop here,
98  lastStrip = strips; // and fill only 'strips' strips
99  }
100  std::fill(&lowThs[firstStrip], &lowThs[lastStrip], low);
101  std::fill(&highThs[firstStrip], &highThs[lastStrip], high);
102  }
103 }

References cms::cuda::assert(), ntuplemaker::fill, LaserClient_cfi::high, LaserClient_cfi::low, FastTimerService_cff::range, and DigiDM_cff::strips.

◆ compact()

SiStripThreshold::Container::iterator SiStripThreshold::compact ( Container input)
private

Definition at line 33 of file SiStripThreshold.cc.

33  {
34  std::stable_sort(input.begin(), input.end());
35  return std::unique(input.begin(), input.end());
36 }

References input, and tier0::unique().

Referenced by put().

◆ getData()

SiStripThreshold::Data SiStripThreshold::getData ( const uint16_t &  strip,
const Range range 
) const

Definition at line 70 of file SiStripThreshold.cc.

70  {
71  uint16_t estrip =
74  if (p != range.first) {
75  return *(--p);
76  } else {
77  throw cms::Exception("CorruptedData") << "[SiStripThreshold::getData] asking for data for a strip " << strip
78  << " lower then the first stored strip " << p->getFirstStrip();
79  }
80 }

References Exception, sistrip::FirstThStripMask_, sistrip::FirstThStripShift_, sistrip::HighThStripMask_, AlCaHLTBitMon_ParallelJobs::p, FastTimerService_cff::range, digitizers_cfi::strip, and cuda_std::upper_bound().

Referenced by SiStripThresholdReader::analyze(), SiStripThresholdDQM::fillMEsForDet(), SiStripThresholdDQM::fillMEsForLayer(), and SiStripFedZeroSuppression::suppress().

◆ getDataVectorBegin()

ContainerIterator SiStripThreshold::getDataVectorBegin ( ) const
inline

Definition at line 122 of file SiStripThreshold.h.

122 { return v_threshold.begin(); }

References v_threshold.

Referenced by printDebug(), and printSummary().

◆ getDataVectorEnd()

ContainerIterator SiStripThreshold::getDataVectorEnd ( ) const
inline

Definition at line 123 of file SiStripThreshold.h.

123 { return v_threshold.end(); }

References v_threshold.

◆ getDetIds()

void SiStripThreshold::getDetIds ( std::vector< uint32_t > &  DetIds_) const

Definition at line 48 of file SiStripThreshold.cc.

48  {
49  // returns vector of DetIds in map
53  DetIds_.push_back(p->detid);
54  }
55 }

References begin, end, indexes, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by SiStripThresholdReader::analyze(), SiStripThresholdDQM::fillMEsForDet(), and SiStripThresholdDQM::getActiveDetIds().

◆ getRange()

const SiStripThreshold::Range SiStripThreshold::getRange ( const uint32_t &  detID) const

Definition at line 38 of file SiStripThreshold.cc.

38  {
39  // get SiStripThreshold Range of DetId
40 
42  if (p == indexes.end() || p->detid != DetId)
43  return SiStripThreshold::Range(v_threshold.end(), v_threshold.end());
44  else
45  return SiStripThreshold::Range(v_threshold.begin() + p->ibegin, v_threshold.begin() + p->iend);
46 }

References indexes, cuda_std::lower_bound(), AlCaHLTBitMon_ParallelJobs::p, and v_threshold.

Referenced by SiStripThresholdReader::analyze(), SiStripThresholdDQM::fillMEsForDet(), SiStripThresholdDQM::fillMEsForLayer(), and SiStripFedZeroSuppression::suppress().

◆ getRegistryVectorBegin()

RegistryIterator SiStripThreshold::getRegistryVectorBegin ( ) const
inline

Definition at line 124 of file SiStripThreshold.h.

124 { return indexes.begin(); }

References indexes.

Referenced by printDebug(), and printSummary().

◆ getRegistryVectorEnd()

RegistryIterator SiStripThreshold::getRegistryVectorEnd ( ) const
inline

Definition at line 125 of file SiStripThreshold.h.

125 { return indexes.end(); }

References indexes.

Referenced by printDebug(), and printSummary().

◆ printDebug()

void SiStripThreshold::printDebug ( std::stringstream &  ss,
const TrackerTopology trackerTopo 
) const

Prints all the thresholds for all DetIds.

Definition at line 105 of file SiStripThreshold.cc.

105  {
107  ContainerIterator it, eit;
108  for (; rit != erit; ++rit) {
109  it = getDataVectorBegin() + rit->ibegin;
110  eit = getDataVectorBegin() + rit->iend;
111  ss << "\ndetid: " << rit->detid << " \t ";
112  for (; it != eit; ++it) {
113  ss << "\n \t ";
114  it->print(ss);
115  }
116  }
117 }

References getDataVectorBegin(), getRegistryVectorBegin(), getRegistryVectorEnd(), and contentValuesCheck::ss.

◆ printSummary()

void SiStripThreshold::printSummary ( std::stringstream &  ss,
const TrackerTopology trackerTopo 
) const

Prints mean, rms, min and max threshold values for each DetId.

Definition at line 119 of file SiStripThreshold.cc.

119  {
121  ContainerIterator it, eit, itp;
122  float meanLth, meanHth, meanCth; //mean value
123  float rmsLth, rmsHth, rmsCth; //rms value
124  float maxLth, maxHth, maxCth; //max value
125  float minLth, minHth, minCth; //min value
126  uint16_t n;
127  uint16_t firstStrip, stripRange;
128  for (; rit != erit; ++rit) {
129  it = getDataVectorBegin() + rit->ibegin;
130  eit = getDataVectorBegin() + rit->iend;
131  ss << "\ndetid: " << rit->detid << " \t ";
132 
133  meanLth = 0;
134  meanHth = 0;
135  meanCth = 0; //mean value
136  rmsLth = 0;
137  rmsHth = 0;
138  rmsCth = 0; //rms value
139  maxLth = 0;
140  maxHth = 0;
141  maxCth = 0; //max value
142  minLth = 10000;
143  minHth = 10000;
144  minCth = 10000; //min value
145  n = 0;
146  firstStrip = 0;
147  for (; it != eit; ++it) {
148  itp = it + 1;
149  firstStrip = it->getFirstStrip();
150  if (itp != eit)
151  stripRange = (itp->getFirstStrip() - firstStrip);
152  else
153  stripRange =
154  firstStrip > 511
155  ? 768 - firstStrip
156  : 512 -
157  firstStrip; //*FIXME, I dont' know ithis class the strip number of a detector, so I assume wrongly that if the last firstStrip<511 the detector has only 512 strips. Clearly wrong. to be fixed
158 
159  addToStat(it->getLth(), stripRange, meanLth, rmsLth, minLth, maxLth);
160  addToStat(it->getHth(), stripRange, meanHth, rmsHth, minHth, maxHth);
161  addToStat(it->getClusth(), stripRange, meanCth, rmsCth, minCth, maxCth);
162  n += stripRange;
163  }
164  meanLth /= n;
165  meanHth /= n;
166  meanCth /= n;
167  rmsLth = sqrt(rmsLth / n - meanLth * meanLth);
168  rmsHth = sqrt(rmsHth / n - meanHth * meanHth);
169  rmsCth = sqrt(rmsCth / n - meanCth * meanCth);
170  ss << "\nn " << n << " \tmeanLth " << meanLth << " \t rmsLth " << rmsLth << " \t minLth " << minLth << " \t maxLth "
171  << maxLth;
172  ss << "\n\tmeanHth " << meanHth << " \t rmsHth " << rmsHth << " \t minHth " << minHth << " \t maxHth " << maxHth;
173  ss << "\n\tmeanCth " << meanCth << " \t rmsCth " << rmsCth << " \t minCth " << minCth << " \t maxCth " << maxCth;
174  }
175 }

References addToStat(), getDataVectorBegin(), getRegistryVectorBegin(), getRegistryVectorEnd(), dqmiodumpmetadata::n, mathSSE::sqrt(), and contentValuesCheck::ss.

◆ put()

bool SiStripThreshold::put ( const uint32_t &  detID,
const InputVector vect 
)

Definition at line 8 of file SiStripThreshold.cc.

8  {
9  InputVector vect = _vect;
10  // put in SiStripThreshold::v_threshold of DetId
11  Registry::iterator p =
13  if (p != indexes.end() && p->detid == DetId) {
14  edm::LogError("SiStripThreshold") << "[" << __PRETTY_FUNCTION__ << "] SiStripThreshold for DetID " << DetId
15  << " is already stored. Skippig this put" << std::endl;
16  return false;
17  }
18 
19  SiStripThreshold::Container::iterator new_end = compact(vect);
20 
21  size_t sd = new_end - vect.begin();
22  DetRegistry detregistry;
23  detregistry.detid = DetId;
24  detregistry.ibegin = v_threshold.size();
25  detregistry.iend = v_threshold.size() + sd;
26  indexes.insert(p, detregistry);
27 
28  v_threshold.insert(v_threshold.end(), vect.begin(), new_end);
29 
30  return true;
31 }

References compact(), SiStripThreshold::DetRegistry::detid, SiStripThreshold::DetRegistry::ibegin, SiStripThreshold::DetRegistry::iend, indexes, cuda_std::lower_bound(), AlCaHLTBitMon_ParallelJobs::p, sd, and v_threshold.

Referenced by SiStripCondObjBuilderFromDb::storeThreshold().

◆ serialize()

template<class Archive >
void SiStripThreshold::serialize ( Archive &  ar,
const unsigned int  version 
)
private

◆ setData() [1/2]

void SiStripThreshold::setData ( const uint16_t &  strip,
const float &  lTh,
const float &  hTh,
const float &  cTh,
Container vthr 
)

Definition at line 63 of file SiStripThreshold.cc.

64  {
65  Data a;
66  a.encode(strip, lTh, hTh, cTh);
67  vthr.push_back(a);
68 }

References a, and digitizers_cfi::strip.

◆ setData() [2/2]

void SiStripThreshold::setData ( const uint16_t &  strip,
const float &  lTh,
const float &  hTh,
Container vthr 
)

Definition at line 57 of file SiStripThreshold.cc.

57  {
58  Data a;
59  a.encode(strip, lTh, hTh);
60  vthr.push_back(a);
61 }

References a, and digitizers_cfi::strip.

Referenced by SiStripCondObjBuilderFromDb::setDefaultValuesCabling(), and SiStripCondObjBuilderFromDb::setValuesCabling().

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 146 of file SiStripThreshold.h.

◆ cond::serialization::access

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 146 of file SiStripThreshold.h.

Member Data Documentation

◆ indexes

Registry SiStripThreshold::indexes
private

◆ v_threshold

Container SiStripThreshold::v_threshold
private
SiStripThreshold::dataStrictWeakOrdering
Definition: SiStripThreshold.h:99
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
SiStripThreshold::StrictWeakOrdering
Definition: SiStripThreshold.h:94
input
static const std::string input
Definition: EdmProvDump.cc:48
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
SiStripThreshold::compact
Container::iterator compact(Container &input)
Definition: SiStripThreshold.cc:33
min
T min(T a, T b)
Definition: MathUtil.h:58
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiStripThreshold::InputVector
Container InputVector
Definition: SiStripThreshold.h:109
SiStripThreshold::getRegistryVectorEnd
RegistryIterator getRegistryVectorEnd() const
Definition: SiStripThreshold.h:125
cms::cuda::assert
assert(be >=bs)
SiStripThreshold::RegistryIterator
Registry::const_iterator RegistryIterator
Definition: SiStripThreshold.h:108
end
#define end
Definition: vmac.h:39
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripThreshold::addToStat
void addToStat(float value, uint16_t &range, float &sum, float &sum2, float &min, float &max) const
Definition: SiStripThreshold.cc:177
cuda_std::upper_bound
__host__ constexpr __device__ RandomIt upper_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:45
SiStripThreshold::getDataVectorBegin
ContainerIterator getDataVectorBegin() const
Definition: SiStripThreshold.h:122
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
cuda_std::lower_bound
__host__ constexpr __device__ RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
Definition: cudastdAlgorithm.h:27
ntuplemaker.fill
fill
Definition: ntuplemaker.py:304
edm::LogError
Definition: MessageLogger.h:183
a
double a
Definition: hdecay.h:119
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
SiStripThreshold::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripThreshold.h:106
SiStripThreshold::v_threshold
Container v_threshold
Definition: SiStripThreshold.h:143
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
sistrip::HighThStripMask_
static const uint32_t HighThStripMask_
Definition: ConstantsForCondObjects.h:12
LaserClient_cfi.high
high
Definition: LaserClient_cfi.py:50
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:246
SiStripThreshold::indexes
Registry indexes
Definition: SiStripThreshold.h:144
sd
double sd
Definition: CascadeWrapper.h:113
sistrip::FirstThStripShift_
static const uint32_t FirstThStripShift_
Definition: ConstantsForCondObjects.h:19
SiStripThreshold::ContainerIterator
Container::const_iterator ContainerIterator
Definition: SiStripThreshold.h:105
LaserClient_cfi.low
low
Definition: LaserClient_cfi.py:52
begin
#define begin
Definition: vmac.h:32
DigiDM_cff.strips
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers....
Definition: DigiDM_cff.py:32
sistrip::FirstThStripMask_
static const uint32_t FirstThStripMask_
Definition: ConstantsForCondObjects.h:11