12 if (p!=
indexes.end() && p->detid==DetId){
13 edm::LogError(
"SiStripThreshold") <<
"[" << __PRETTY_FUNCTION__ <<
"] SiStripThreshold for DetID " << DetId <<
" is already stored. Skippig this put" << std::endl;
17 SiStripThreshold::Container::iterator new_end=
compact(vect);
19 size_t sd= new_end-vect.begin();
21 detregistry.
detid=DetId;
32 std::stable_sort(input.begin(),input.end());
40 if (p==
indexes.end()|| p->detid!=DetId)
52 DetIds_.push_back(
p->detid);
64 a.
encode(strip,lTh,hTh,cTh);
76 <<
"[SiStripThreshold::getData] asking for data for a strip " << strip <<
" lower then the first stored strip " << p->getFirstStrip();
82 size_t strips = lowThs.size();
83 assert(strips == highThs.size());
84 while (it != range.second) {
85 size_t firstStrip = it->getFirstStrip();
87 float high = it->getHth(), low = it->getLth();
90 size_t lastStrip = (it == range.second ? strips : it->getFirstStrip());
92 if (lastStrip > strips) {
96 std::fill( & lowThs[firstStrip] , & lowThs[lastStrip] , low );
97 std::fill( & highThs[firstStrip], & highThs[lastStrip], high );
104 for(;rit!=erit;++rit){
107 ss <<
"\ndetid: " << rit->detid <<
" \t ";
118 float meanLth, meanHth, meanCth;
119 float rmsLth, rmsHth, rmsCth;
120 float maxLth, maxHth, maxCth;
121 float minLth, minHth, minCth;
123 uint16_t firstStrip,stripRange;
124 for(;rit!=erit;++rit){
127 ss <<
"\ndetid: " << rit->detid <<
" \t ";
129 meanLth=0; meanHth=0; meanCth=0;
130 rmsLth=0; rmsHth=0; rmsCth=0;
131 maxLth=0; maxHth=0; maxCth=0;
132 minLth=10000; minHth=10000; minCth=10000;
137 firstStrip=it->getFirstStrip();
139 stripRange=(itp->getFirstStrip()-firstStrip);
141 stripRange=firstStrip>511?768-firstStrip:512-firstStrip;
143 addToStat(it->getLth() ,stripRange,meanLth,rmsLth,minLth,maxLth);
144 addToStat(it->getHth() ,stripRange,meanHth,rmsHth,minHth,maxHth);
145 addToStat(it->getClusth(),stripRange,meanCth,rmsCth,minCth,maxCth);
151 rmsLth=
sqrt(rmsLth/n-meanLth*meanLth);
152 rmsHth=
sqrt(rmsHth/n-meanHth*meanHth);
153 rmsCth=
sqrt(rmsCth/n-meanCth*meanCth);
154 ss<<
"\nn " << n <<
" \tmeanLth " << meanLth <<
" \t rmsLth " << rmsLth <<
" \t minLth " << minLth <<
" \t maxLth " << maxLth;
155 ss<<
"\n\tmeanHth " << meanHth <<
" \t rmsHth " << rmsHth <<
" \t minHth " << minHth <<
" \t maxHth " << maxHth;
156 ss<<
"\n\tmeanCth " << meanCth <<
" \t rmsCth " << rmsCth <<
" \t minCth " << minCth <<
" \t maxCth " << maxCth;
162 sum2+=value*value*range;
static const uint32_t FirstThStripShift_
bool put(const uint32_t &detID, const InputVector &vect)
Container::iterator compact(Container &input)
ContainerIterator getDataVectorBegin() const
void allThresholds(std::vector< float > &lowThs, std::vector< float > &highThs, const Range &range) const
static std::string const input
std::vector< Data > Container
def unique(seq, keepstr=True)
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)
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