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, Container &vthr)
 
void setData (const uint16_t &strip, const float &lTh, const float &hTh, const float &cTh, 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.

References indexes, and v_threshold.

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

◆ ~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

◆ allThresholds()

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

Definition at line 82 of file SiStripThreshold.cc.

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

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 }
assert(be >=bs)
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
Definition: DigiDM_cff.py:32
Container::const_iterator ContainerIterator

◆ compact()

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

Definition at line 33 of file SiStripThreshold.cc.

References input, and tier0::unique().

Referenced by put().

33  {
34  std::stable_sort(input.begin(), input.end());
35  return std::unique(input.begin(), input.end());
36 }
static std::string const input
Definition: EdmProvDump.cc:50
def unique(seq, keepstr=True)
Definition: tier0.py:24

◆ getData()

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

Definition at line 70 of file SiStripThreshold.cc.

References Exception, sistrip::FirstThStripMask_, sistrip::FirstThStripShift_, sistrip::HighThStripMask_, AlCaHLTBitMon_ParallelJobs::p, FastTimerService_cff::range, nano_mu_digi_cff::strip, and pfDeepBoostedJetPreprocessParams_cfi::upper_bound.

Referenced by SiStripThresholdDQM::fillMEsForDet(), and SiStripThresholdDQM::fillMEsForLayer().

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 }
static const uint32_t FirstThStripShift_
static const uint32_t HighThStripMask_
static const uint32_t FirstThStripMask_
Container::const_iterator ContainerIterator

◆ getDataVectorBegin()

ContainerIterator SiStripThreshold::getDataVectorBegin ( ) const
inline

Definition at line 122 of file SiStripThreshold.h.

References v_threshold.

Referenced by printDebug(), and printSummary().

122 { return v_threshold.begin(); }

◆ getDataVectorEnd()

ContainerIterator SiStripThreshold::getDataVectorEnd ( ) const
inline

Definition at line 123 of file SiStripThreshold.h.

References v_threshold.

123 { return v_threshold.end(); }

◆ getDetIds()

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

Definition at line 48 of file SiStripThreshold.cc.

References indexes, and AlCaHLTBitMon_ParallelJobs::p.

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

48  {
49  // returns vector of DetIds in map
52  for (SiStripThreshold::RegistryIterator p = begin; p != end; ++p) {
53  DetIds_.push_back(p->detid);
54  }
55 }
Registry::const_iterator RegistryIterator

◆ getRange()

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

Definition at line 38 of file SiStripThreshold.cc.

References indexes, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_ParallelJobs::p, and v_threshold.

Referenced by SiStripThresholdDQM::fillMEsForDet(), and SiStripThresholdDQM::fillMEsForLayer().

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 }
Definition: DetId.h:17
std::pair< ContainerIterator, ContainerIterator > Range
Registry::const_iterator RegistryIterator

◆ getRegistryVectorBegin()

RegistryIterator SiStripThreshold::getRegistryVectorBegin ( ) const
inline

Definition at line 124 of file SiStripThreshold.h.

References indexes.

Referenced by printDebug(), and printSummary().

124 { return indexes.begin(); }

◆ getRegistryVectorEnd()

RegistryIterator SiStripThreshold::getRegistryVectorEnd ( ) const
inline

Definition at line 125 of file SiStripThreshold.h.

References indexes.

Referenced by printDebug(), and printSummary().

125 { return indexes.end(); }

◆ 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.

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

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 }
RegistryIterator getRegistryVectorEnd() const
Registry::const_iterator RegistryIterator
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
Container::const_iterator ContainerIterator

◆ 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.

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

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 }
T sqrt(T t)
Definition: SSEVec.h:19
void addToStat(float value, uint16_t &range, float &sum, float &sum2, float &min, float &max) const
RegistryIterator getRegistryVectorEnd() const
Registry::const_iterator RegistryIterator
ContainerIterator getDataVectorBegin() const
RegistryIterator getRegistryVectorBegin() const
Container::const_iterator ContainerIterator

◆ put()

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

Definition at line 8 of file SiStripThreshold.cc.

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

Referenced by SiStripCondObjBuilderFromDb::storeThreshold().

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. Skipping 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 }
Container::iterator compact(Container &input)
Log< level::Error, false > LogError
Definition: DetId.h:17

◆ 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,
Container vthr 
)

Definition at line 57 of file SiStripThreshold.cc.

References a, and nano_mu_digi_cff::strip.

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

57  {
58  Data a;
59  a.encode(strip, lTh, hTh);
60  vthr.push_back(a);
61 }
double a
Definition: hdecay.h:121

◆ setData() [2/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.

References a, and nano_mu_digi_cff::strip.

64  {
65  Data a;
66  a.encode(strip, lTh, hTh, cTh);
67  vthr.push_back(a);
68 }
double a
Definition: hdecay.h:121

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