#include <SiStripThreshold.h>
Classes | |
struct | Data |
class | dataStrictWeakOrdering |
struct | DetRegistry |
class | StrictWeakOrdering |
Public Types | |
typedef std::vector< Data > | Container |
typedef Container::const_iterator | ContainerIterator |
typedef Container | InputVector |
typedef std::pair < ContainerIterator, ContainerIterator > | Range |
typedef std::vector< DetRegistry > | Registry |
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 |
Prints all the thresholds for all DetIds. | |
void | printSummary (std::stringstream &ss) const |
Prints mean, rms, min and max threshold values for each DetId. | |
bool | put (const uint32_t &detID, 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) |
Private Attributes | |
Registry | indexes |
Container | v_threshold |
Holds the thresholds:
Definition at line 38 of file SiStripThreshold.h.
typedef std::vector<Data> SiStripThreshold::Container |
Definition at line 95 of file SiStripThreshold.h.
typedef Container::const_iterator SiStripThreshold::ContainerIterator |
Definition at line 96 of file SiStripThreshold.h.
Definition at line 100 of file SiStripThreshold.h.
typedef std::pair<ContainerIterator, ContainerIterator> SiStripThreshold::Range |
Definition at line 97 of file SiStripThreshold.h.
typedef std::vector<DetRegistry> SiStripThreshold::Registry |
Definition at line 98 of file SiStripThreshold.h.
typedef Registry::const_iterator SiStripThreshold::RegistryIterator |
Definition at line 99 of file SiStripThreshold.h.
SiStripThreshold::SiStripThreshold | ( | ) | [inline] |
Definition at line 102 of file SiStripThreshold.h.
{};
SiStripThreshold::SiStripThreshold | ( | const SiStripThreshold & | orig | ) | [inline] |
Definition at line 103 of file SiStripThreshold.h.
References indexes, and v_threshold.
{ v_threshold=orig.v_threshold; indexes=orig.indexes; }
virtual SiStripThreshold::~SiStripThreshold | ( | ) | [inline, virtual] |
Definition at line 107 of file SiStripThreshold.h.
{};
void SiStripThreshold::addToStat | ( | float | value, |
uint16_t & | range, | ||
float & | sum, | ||
float & | sum2, | ||
float & | min, | ||
float & | max | ||
) | const [private] |
Definition at line 159 of file SiStripThreshold.cc.
References relativeConstraints::value.
Referenced by printSummary().
void SiStripThreshold::allThresholds | ( | std::vector< float > & | lowThs, |
std::vector< float > & | highThs, | ||
const Range & | range | ||
) | const |
Definition at line 79 of file SiStripThreshold.cc.
References RecoTauPiZeroBuilderPlugins_cfi::strips.
{ ContainerIterator it = range.first; size_t strips = lowThs.size(); assert(strips == highThs.size()); while (it != range.second) { size_t firstStrip = it->getFirstStrip(); //std::cout << "First strip is " << firstStrip << std::endl; float high = it->getHth(), low = it->getLth(); //std::cout << "High is " << high << ", low is " << low << std::endl; ++it; // increment the pointer size_t lastStrip = (it == range.second ? strips : it->getFirstStrip()); //std::cout << "Last strip is " << lastStrip << std::endl; if (lastStrip > strips) { it = range.second; // I should stop here, lastStrip = strips; // and fill only 'strips' strips } std::fill( & lowThs[firstStrip] , & lowThs[lastStrip] , low ); std::fill( & highThs[firstStrip], & highThs[lastStrip], high ); } }
SiStripThreshold::Container::iterator SiStripThreshold::compact | ( | Container & | input | ) | [private] |
SiStripThreshold::Data SiStripThreshold::getData | ( | const uint16_t & | strip, |
const Range & | range | ||
) | const |
Definition at line 67 of file SiStripThreshold.cc.
References Exception, sistrip::FirstThStripMask_, sistrip::FirstThStripShift_, sistrip::HighThStripMask_, and L1TEmulatorMonitor_cff::p.
{ uint16_t estrip=(strip & sistrip::FirstThStripMask_)<<sistrip::FirstThStripShift_ | (63 & sistrip::HighThStripMask_); ContainerIterator p = std::upper_bound(range.first,range.second,estrip,SiStripThreshold::dataStrictWeakOrdering()); if (p!=range.first){ return *(--p); } else{ throw cms::Exception("CorruptedData") << "[SiStripThreshold::getData] asking for data for a strip " << strip << " lower then the first stored strip " << p->getFirstStrip(); } }
ContainerIterator SiStripThreshold::getDataVectorBegin | ( | ) | const [inline] |
Definition at line 114 of file SiStripThreshold.h.
References v_threshold.
Referenced by printDebug(), and printSummary().
{return v_threshold.begin();}
ContainerIterator SiStripThreshold::getDataVectorEnd | ( | ) | const [inline] |
Definition at line 115 of file SiStripThreshold.h.
References v_threshold.
{return v_threshold.end();}
void SiStripThreshold::getDetIds | ( | std::vector< uint32_t > & | DetIds_ | ) | const |
Definition at line 46 of file SiStripThreshold.cc.
References begin, end, indexes, and L1TEmulatorMonitor_cff::p.
{ // returns vector of DetIds in map SiStripThreshold::RegistryIterator begin = indexes.begin(); SiStripThreshold::RegistryIterator end = indexes.end(); for (SiStripThreshold::RegistryIterator p=begin; p != end; ++p) { DetIds_.push_back(p->detid); } }
const SiStripThreshold::Range SiStripThreshold::getRange | ( | const uint32_t & | detID | ) | const |
Definition at line 35 of file SiStripThreshold.cc.
References indexes, L1TEmulatorMonitor_cff::p, and v_threshold.
{ // get SiStripThreshold Range of DetId RegistryIterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripThreshold::StrictWeakOrdering()); if (p==indexes.end()|| p->detid!=DetId) return SiStripThreshold::Range(v_threshold.end(),v_threshold.end()); else return SiStripThreshold::Range(v_threshold.begin()+p->ibegin,v_threshold.begin()+p->iend); }
RegistryIterator SiStripThreshold::getRegistryVectorBegin | ( | ) | const [inline] |
Definition at line 116 of file SiStripThreshold.h.
References indexes.
Referenced by printDebug(), and printSummary().
{return indexes.begin();}
RegistryIterator SiStripThreshold::getRegistryVectorEnd | ( | ) | const [inline] |
Definition at line 117 of file SiStripThreshold.h.
References indexes.
Referenced by printDebug(), and printSummary().
{return indexes.end();}
void SiStripThreshold::printDebug | ( | std::stringstream & | ss | ) | const |
Prints all the thresholds for all DetIds.
Definition at line 100 of file SiStripThreshold.cc.
References getDataVectorBegin(), getRegistryVectorBegin(), and getRegistryVectorEnd().
Referenced by SiStripThresholdGenerator::createObject().
{ RegistryIterator rit=getRegistryVectorBegin(), erit=getRegistryVectorEnd(); ContainerIterator it,eit; for(;rit!=erit;++rit){ it=getDataVectorBegin()+rit->ibegin; eit=getDataVectorBegin()+rit->iend; ss << "\ndetid: " << rit->detid << " \t "; for(;it!=eit;++it){ ss << "\n \t "; it->print(ss); } } }
void SiStripThreshold::printSummary | ( | std::stringstream & | ss | ) | const |
Prints mean, rms, min and max threshold values for each DetId.
Definition at line 114 of file SiStripThreshold.cc.
References addToStat(), getDataVectorBegin(), getRegistryVectorBegin(), getRegistryVectorEnd(), n, and mathSSE::sqrt().
{ RegistryIterator rit=getRegistryVectorBegin(), erit=getRegistryVectorEnd(); ContainerIterator it,eit,itp; float meanLth, meanHth, meanCth; //mean value float rmsLth, rmsHth, rmsCth; //rms value float maxLth, maxHth, maxCth; //max value float minLth, minHth, minCth; //min value uint16_t n; uint16_t firstStrip,stripRange; for(;rit!=erit;++rit){ it=getDataVectorBegin()+rit->ibegin; eit=getDataVectorBegin()+rit->iend; ss << "\ndetid: " << rit->detid << " \t "; meanLth=0; meanHth=0; meanCth=0; //mean value rmsLth=0; rmsHth=0; rmsCth=0; //rms value maxLth=0; maxHth=0; maxCth=0; //max value minLth=10000; minHth=10000; minCth=10000; //min value n=0; firstStrip=0; for(;it!=eit;++it){ itp=it+1; firstStrip=it->getFirstStrip(); if(itp!=eit) stripRange=(itp->getFirstStrip()-firstStrip); else stripRange=firstStrip>511?768-firstStrip:512-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 addToStat(it->getLth() ,stripRange,meanLth,rmsLth,minLth,maxLth); addToStat(it->getHth() ,stripRange,meanHth,rmsHth,minHth,maxHth); addToStat(it->getClusth(),stripRange,meanCth,rmsCth,minCth,maxCth); n+=stripRange; } meanLth/=n; meanHth/=n; meanCth/=n; rmsLth= sqrt(rmsLth/n-meanLth*meanLth); rmsHth= sqrt(rmsHth/n-meanHth*meanHth); rmsCth= sqrt(rmsCth/n-meanCth*meanCth); ss<< "\nn " << n << " \tmeanLth " << meanLth << " \t rmsLth " << rmsLth << " \t minLth " << minLth << " \t maxLth " << maxLth; ss<< "\n\tmeanHth " << meanHth << " \t rmsHth " << rmsHth << " \t minHth " << minHth << " \t maxHth " << maxHth; ss<< "\n\tmeanCth " << meanCth << " \t rmsCth " << rmsCth << " \t minCth " << minCth << " \t maxCth " << maxCth; } }
bool SiStripThreshold::put | ( | const uint32_t & | detID, |
InputVector | vect | ||
) |
Definition at line 8 of file SiStripThreshold.cc.
References compact(), SiStripThreshold::DetRegistry::detid, SiStripThreshold::DetRegistry::ibegin, SiStripThreshold::DetRegistry::iend, indexes, L1TEmulatorMonitor_cff::p, and v_threshold.
Referenced by SiStripThresholdBuilder::analyze(), SiStripThresholdGenerator::createObject(), and SiStripCondObjBuilderFromDb::storeThreshold().
{ // put in SiStripThreshold::v_threshold of DetId Registry::iterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripThreshold::StrictWeakOrdering()); if (p!=indexes.end() && p->detid==DetId){ edm::LogError("SiStripThreshold") << "[" << __PRETTY_FUNCTION__ << "] SiStripThreshold for DetID " << DetId << " is already stored. Skippig this put" << std::endl; return false; } SiStripThreshold::Container::iterator new_end=compact(vect); size_t sd= new_end-vect.begin(); DetRegistry detregistry; detregistry.detid=DetId; detregistry.ibegin=v_threshold.size(); detregistry.iend=v_threshold.size()+sd; indexes.insert(p,detregistry); v_threshold.insert(v_threshold.end(),vect.begin(),new_end); return true; }
void SiStripThreshold::setData | ( | const uint16_t & | strip, |
const float & | lTh, | ||
const float & | hTh, | ||
Container & | vthr | ||
) |
Definition at line 55 of file SiStripThreshold.cc.
References a, and SiStripThreshold::Data::encode().
Referenced by SiStripThresholdBuilder::analyze(), SiStripThresholdGenerator::createObject(), SiStripCondObjBuilderFromDb::setDefaultValuesCabling(), and SiStripCondObjBuilderFromDb::setValuesCabling().
void SiStripThreshold::setData | ( | const uint16_t & | strip, |
const float & | lTh, | ||
const float & | hTh, | ||
const float & | cTh, | ||
Container & | vthr | ||
) |
Definition at line 61 of file SiStripThreshold.cc.
References a, and SiStripThreshold::Data::encode().
Registry SiStripThreshold::indexes [private] |
Definition at line 137 of file SiStripThreshold.h.
Referenced by getDetIds(), getRange(), getRegistryVectorBegin(), getRegistryVectorEnd(), put(), and SiStripThreshold().
Container SiStripThreshold::v_threshold [private] |
Definition at line 136 of file SiStripThreshold.h.
Referenced by getDataVectorBegin(), getDataVectorEnd(), getRange(), put(), and SiStripThreshold().