#include <SiStripDetSummary.h>
Classes | |
struct | Values |
Public Member Functions | |
void | add (const DetId &detid, const float &value) |
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo. | |
void | add (const DetId &detid) |
Used to compute the number of entries divided by subdetector, layer and mono/stereo. | |
std::map< unsigned int, Values > | getCounts () |
void | print (std::stringstream &ss, const bool mean=true) const |
SiStripDetSummary () | |
Protected Attributes | |
bool | computeMean_ |
std::map< unsigned int, Values > | valueMap_ |
If values are passed together with DetIds (method add( detId, value)), it computes the mean value and rms of a given quantity and is able to print a summary divided by layer/disk for each subdetector.
If instead only DetIds are passed (method add( detId )), it prints the count divided by layer/disk for each subdetector.
Note: consider the possibility to move this class inside SiStripBaseObject as a protected member class.
Definition at line 31 of file SiStripDetSummary.h.
SiStripDetSummary::SiStripDetSummary | ( | ) | [inline] |
Definition at line 34 of file SiStripDetSummary.h.
References valueMap_.
: computeMean_(true) { // Initialize valueMap_ with zeros // WARNING: this initialization is strongly connected with how the map is filled in the add method // TIB: layers = 4, stereo = the first 2 // TOB: layers = 6, stereo = the first 2 // TEC: wheels = 9, stereo = 9 // TID: wheels = 3, stereo = 3 unsigned int layers[] = {4, 6, 9, 3}; unsigned int stereo[] = {2, 2, 9, 3}; Values initValues; for( unsigned int subDet = 0; subDet < 4; ++subDet ) { // Layers start from 1 for( unsigned int layer = 1; layer <= layers[subDet]; ++layer ) { valueMap_[1000*(subDet+1)+layer*10] = initValues; if( layer <= stereo[subDet] ) valueMap_[1000*(subDet+1)+layer*10+1] = initValues; } } }
void SiStripDetSummary::add | ( | const DetId & | detid, |
const float & | value | ||
) |
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo.
Definition at line 3 of file SiStripDetSummary.cc.
References TIBDetId::layer(), TOBDetId::layer(), DetId::rawId(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, relativeConstraints::value, valueMap_, TIDDetId::wheel(), and TECDetId::wheel().
Referenced by add(), SiStripDetVOff::getHVoffCounts(), SiStripDetVOff::getLVoffCounts(), SiStripLorentzAngle::printSummary(), SiStripApvGain::printSummary(), SiStripDetVOff::printSummary(), SiStripGain::printSummary(), SiStripNoises::printSummary(), SiStripBadStrip::printSummary(), SiStripPedestals::printSummary(), and SiStripBaseDelay::printSummary().
{ int layer = 0; int stereo = 0; int detNum = 0; // Using the operator[] if the element does not exist it is created with the default value. That is 0 for integral types. switch (detid.subdetId()) { case StripSubdetector::TIB: { TIBDetId theTIBDetId(detid.rawId()); layer = theTIBDetId.layer(); stereo = theTIBDetId.stereo(); detNum = 1000; break; } case StripSubdetector::TOB: { TOBDetId theTOBDetId(detid.rawId()); layer = theTOBDetId.layer(); stereo = theTOBDetId.stereo(); detNum = 2000; break; } case StripSubdetector::TEC: { TECDetId theTECDetId(detid.rawId()); // is this module in TEC+ or TEC-? layer = theTECDetId.wheel(); stereo = theTECDetId.stereo(); detNum = 3000; break; } case StripSubdetector::TID: { TIDDetId theTIDDetId(detid.rawId()); // is this module in TID+ or TID-? layer = theTIDDetId.wheel(); stereo = theTIDDetId.stereo(); detNum = 4000; break; } } detNum += layer*10 + stereo; // string name( detector + boost::lexical_cast<string>(layer) + boost::lexical_cast<string>(stereo) ); valueMap_[detNum].mean += value; valueMap_[detNum].rms += value*value; valueMap_[detNum].count += 1; }
void SiStripDetSummary::add | ( | const DetId & | detid | ) | [inline] |
Used to compute the number of entries divided by subdetector, layer and mono/stereo.
Definition at line 57 of file SiStripDetSummary.h.
References add(), and computeMean_.
{ computeMean_ = false; add( detid, 0 ); }
std::map<unsigned int, Values> SiStripDetSummary::getCounts | ( | ) | [inline] |
Definition at line 76 of file SiStripDetSummary.h.
References valueMap_.
Referenced by SiStripDetVOff::getHVoffCounts(), and SiStripDetVOff::getLVoffCounts().
{ return valueMap_; }
void SiStripDetSummary::print | ( | std::stringstream & | ss, |
const bool | mean = true |
||
) | const |
Method used to write the output. By default mean == true and it writes the mean value. If mean == false it will write the count.
Definition at line 53 of file SiStripDetSummary.cc.
References computeMean_, prof2calltree::count, ExpressReco_HICollisions_FallBack::detector, plotscripts::rms(), mathSSE::sqrt(), and valueMap_.
Referenced by SiStripLorentzAngle::printSummary(), SiStripApvGain::printSummary(), SiStripDetVOff::printSummary(), SiStripGain::printSummary(), SiStripNoises::printSummary(), SiStripBadStrip::printSummary(), SiStripPedestals::printSummary(), and SiStripBaseDelay::printSummary().
{ // Compute the mean for each detector and for each layer. std::map<unsigned int, Values>::const_iterator valueMapIt = valueMap_.begin(); ss << "subDet" << std::setw(15) << "layer" << std::setw(16) << "mono/stereo" << std::setw(20); if( mean ) ss << "mean +- rms" << std::endl; else ss << "count" << std::endl; std::string detector; std::string oldDetector; for( ; valueMapIt != valueMap_.end(); ++valueMapIt ) { int count = valueMapIt->second.count; double mean = 0.; double rms = 0.; if( computeMean_ && count != 0 ) { mean = (valueMapIt->second.mean)/count; rms = (valueMapIt->second.rms)/count - mean*mean; if (rms <= 0) rms = 0; else rms = sqrt(rms); } // Detector type switch ((valueMapIt->first)/1000) { case 1: detector = "TIB "; break; case 2: detector = "TOB "; break; case 3: detector = "TEC "; break; case 4: detector = "TID "; break; } if( detector != oldDetector ) { ss << std::endl << detector; oldDetector = detector; } else ss << " "; // Layer number int layer = (valueMapIt->first)/10 - (valueMapIt->first)/1000*100; int stereo = valueMapIt->first - layer*10 -(valueMapIt->first)/1000*1000; ss << std::setw(15) << layer << std::setw(13) << stereo << std::setw(18); if( computeMean_ ) ss << mean << " +- " << rms << std::endl; else ss << count << std::endl; } }
bool SiStripDetSummary::computeMean_ [protected] |
Definition at line 83 of file SiStripDetSummary.h.
std::map<unsigned int, Values> SiStripDetSummary::valueMap_ [protected] |
Definition at line 82 of file SiStripDetSummary.h.
Referenced by add(), getCounts(), print(), and SiStripDetSummary().