11 if (p!=
indexes.end() && p->detid==DetId){
12 edm::LogError(
"SiStripThreshold") <<
"[" << __PRETTY_FUNCTION__ <<
"] SiStripThreshold for DetID " << DetId <<
" is already stored. Skippig this put" << std::endl;
16 SiStripThreshold::Container::iterator new_end=
compact(vect);
18 size_t sd= new_end-vect.begin();
20 detregistry.
detid=DetId;
31 std::stable_sort(input.begin(),input.end());
32 return std::unique(input.begin(),input.end());
39 if (p==
indexes.end()|| p->detid!=DetId)
51 DetIds_.push_back(
p->detid);
63 a.
encode(strip,lTh,hTh,cTh);
75 <<
"[SiStripThreshold::getData] asking for data for a strip " << strip <<
" lower then the first stored strip " << p->getFirstStrip();
81 size_t strips = lowThs.size();
82 assert(strips == highThs.size());
83 while (it != range.second) {
84 size_t firstStrip = it->getFirstStrip();
86 float high = it->getHth(), low = it->getLth();
89 size_t lastStrip = (it == range.second ? strips : it->getFirstStrip());
91 if (lastStrip > strips) {
95 std::fill( & lowThs[firstStrip] , & lowThs[lastStrip] , low );
96 std::fill( & highThs[firstStrip], & highThs[lastStrip], high );
103 for(;rit!=erit;++rit){
106 ss <<
"\ndetid: " << rit->detid <<
" \t ";
117 float meanLth, meanHth, meanCth;
118 float rmsLth, rmsHth, rmsCth;
119 float maxLth, maxHth, maxCth;
120 float minLth, minHth, minCth;
122 uint16_t firstStrip,stripRange;
123 for(;rit!=erit;++rit){
126 ss <<
"\ndetid: " << rit->detid <<
" \t ";
128 meanLth=0; meanHth=0; meanCth=0;
129 rmsLth=0; rmsHth=0; rmsCth=0;
130 maxLth=0; maxHth=0; maxCth=0;
131 minLth=10000; minHth=10000; minCth=10000;
136 firstStrip=it->getFirstStrip();
138 stripRange=(itp->getFirstStrip()-firstStrip);
140 stripRange=firstStrip>511?768-firstStrip:512-firstStrip;
142 addToStat(it->getLth() ,stripRange,meanLth,rmsLth,minLth,maxLth);
143 addToStat(it->getHth() ,stripRange,meanHth,rmsHth,minHth,maxHth);
144 addToStat(it->getClusth(),stripRange,meanCth,rmsCth,minCth,maxCth);
150 rmsLth=
sqrt(rmsLth/n-meanLth*meanLth);
151 rmsHth=
sqrt(rmsHth/n-meanHth*meanHth);
152 rmsCth=
sqrt(rmsCth/n-meanCth*meanCth);
153 ss<<
"\nn " << n <<
" \tmeanLth " << meanLth <<
" \t rmsLth " << rmsLth <<
" \t minLth " << minLth <<
" \t maxLth " << maxLth;
154 ss<<
"\n\tmeanHth " << meanHth <<
" \t rmsHth " << rmsHth <<
" \t minHth " << minHth <<
" \t maxHth " << maxHth;
155 ss<<
"\n\tmeanCth " << meanCth <<
" \t rmsCth " << rmsCth <<
" \t minCth " << minCth <<
" \t maxCth " << maxCth;
161 sum2+=value*value*range;
static const uint32_t FirstThStripShift_
Container::iterator compact(Container &input)
ContainerIterator getDataVectorBegin() const
void allThresholds(std::vector< float > &lowThs, std::vector< float > &highThs, const Range &range) const
std::vector< Data > Container
const T & max(const T &a, const T &b)
SiStripThreshold::Data getData(const uint16_t &strip, const Range &range) const
RegistryIterator getRegistryVectorBegin() const
void encode(const uint16_t &strip, const float &lTh, const float &hTh)
bool put(const uint32_t &detID, InputVector vect)
void printDebug(std::stringstream &ss) const
Prints all the thresholds for all DetIds.
std::pair< ContainerIterator, ContainerIterator > Range
static const uint32_t HighThStripMask_
void getDetIds(std::vector< uint32_t > &DetIds_) const
void setData(const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)
void printSummary(std::stringstream &ss) const
Prints mean, rms, min and max threshold values for each DetId.
static const uint32_t FirstThStripMask_
Registry::const_iterator RegistryIterator
void addToStat(float value, uint16_t &range, float &sum, float &sum2, float &min, float &max) const
const Range getRange(const uint32_t &detID) const
RegistryIterator getRegistryVectorEnd() const
Container::const_iterator ContainerIterator