#include <StorageAccount.h>
Classes | |
struct | Counter |
class | Stamp |
Public Types | |
typedef std::map< std::string, Counter > | OperationStats |
typedef std::map< std::string, boost::shared_ptr < OperationStats > > | StorageStats |
Static Public Member Functions | |
static Counter & | counter (const std::string &storageClass, const std::string &operation) |
static void | fillSummary (std::map< std::string, std::string > &summary) |
static const StorageStats & | summary (void) |
static std::string | summaryText (bool banner=false) |
static std::string | summaryXML (void) |
Definition at line 9 of file StorageAccount.h.
typedef std::map<std::string, Counter> StorageAccount::OperationStats |
Definition at line 33 of file StorageAccount.h.
typedef std::map<std::string, boost::shared_ptr<OperationStats> > StorageAccount::StorageStats |
Definition at line 34 of file StorageAccount.h.
StorageAccount::Counter & StorageAccount::counter | ( | const std::string & | storageClass, |
const std::string & | operation | ||
) | [static] |
Definition at line 96 of file StorageAccount.cc.
References CommonMethods::lock(), pos, s_mutex, s_stats, and x.
Referenced by StorageFactory::check(), StorageAccountProxy::close(), StorageAccountProxy::flush(), StorageFactory::open(), StorageAccountProxy::resize(), StorageFactory::stagein(), StorageAccountProxy::StorageAccountProxy(), storageCounter(), and StorageAccountProxy::~StorageAccountProxy().
{ boost::mutex::scoped_lock lock (s_mutex); boost::shared_ptr<OperationStats> &opstats = s_stats [storageClass]; if (!opstats) opstats.reset(new OperationStats); OperationStats::iterator pos = opstats->find (operation); if (pos == opstats->end ()) { Counter x = { 0, 0, 0, 0, 0, 0, 0 }; pos = opstats->insert (OperationStats::value_type (operation, x)).first; } return pos->second; }
void StorageAccount::fillSummary | ( | std::map< std::string, std::string > & | summary | ) | [static] |
Definition at line 398 of file SiPixelActionExecutor.cc.
References DQMStore::book1D(), DQMStore::cd(), SiPixelActionExecutor::configParser_, cmsMakeMELists::contents, gather_cfg::cout, MonitorElement::Fill(), SiPixelActionExecutor::fillGrandBarrelSummaryHistos(), SiPixelActionExecutor::fillGrandEndcapSummaryHistos(), SiPixelActionExecutor::fillSummary(), spr::find(), DQMStore::get(), MonitorElement::getBinContent(), SiPixelActionExecutor::GetBladeSubdirs(), MonitorElement::getEntries(), MonitorElement::getMean(), SiPixelConfigParser::getMENamesForGrandBarrelSummary(), SiPixelConfigParser::getMENamesForGrandEndcapSummary(), DQMStore::getMEs(), MonitorElement::getName(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), MonitorElement::getRMS(), DQMStore::getSubdirs(), SiPixelActionExecutor::getSummaryME(), MonitorElement::getTH1F(), DQMStore::goUp(), isum, findQualityFiles::jj, nlast, prof2calltree::prefix, DQMStore::pwd(), UserOptions_cff::rows, lumiContext::sname, SiPixelActionExecutor::source_type_, mathSSE::sqrt(), GlobalPosition_Frontier_DevDB_cff::tag, groupFilesInBlocks::temp, and indexGen::title.
Referenced by TFileAdaptor::statsXML().
{ //cout<<"entering SiPixelActionExecutor::fillSummary..."<<endl; string currDir = bei->pwd(); //cout<<"currDir= "<<currDir<<endl; string prefix; if(source_type_==0) prefix="SUMRAW"; else if (source_type_==1) prefix="SUMDIG"; else if (source_type_==2) prefix="SUMCLU"; else if (source_type_==3) prefix="SUMTRK"; else if (source_type_==4) prefix="SUMHIT"; else if (source_type_>=7 && source_type_<20) prefix="SUMCAL"; else if (source_type_==20) prefix="SUMOFF"; if (currDir.find(dir_name) != string::npos) { vector<MonitorElement*> sum_mes; for (vector<string>::const_iterator iv = me_names.begin(); iv != me_names.end(); iv++) { if(source_type_==5||source_type_==6){ if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"|| (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"|| (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"|| (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap") prefix="SUMRAW"; else if((*iv)=="ndigis"||(*iv)=="adc") prefix="SUMDIG"; else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"|| (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"|| (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol") prefix="SUMCLU"; if(currDir.find("Track")!=string::npos) prefix="SUMTRK"; else if((*iv)=="residualX"||(*iv)=="residualY") prefix="SUMTRK"; else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY") prefix="SUMHIT"; else if((*iv)=="Gain1d"||(*iv)=="GainChi2NDF1d"|| (*iv)=="GainChi2Prob1d"||(*iv)=="Pedestal1d"|| (*iv)=="GainNPoints1d"||(*iv)=="GainHighPoint1d"|| (*iv)=="GainLowPoint1d"||(*iv)=="GainEndPoint1d"|| (*iv)=="GainFitResult2d"||(*iv)=="GainDynamicRange2d"|| (*iv)=="GainSaturate2d"|| (*iv)=="ScurveChi2ProbSummary"||(*iv)=="ScurveFitResultSummary"|| (*iv)=="ScurveSigmasSummary"||(*iv)=="ScurveThresholdSummary"|| (*iv)=="pixelAliveSummary" || (*iv) == "SiPixelErrorsCalibDigis") prefix="SUMCAL"; } MonitorElement* temp; string tag; if((*iv).find("residual")!=string::npos){ // track residuals tag = prefix + "_" + (*iv) + "_mean_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); tag = prefix + "_" + (*iv) + "_RMS_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); }else if(prefix == "SUMCAL"){ // calibrations if((*iv)=="Gain1d" || (*iv)=="GainChi2NDF1d" || (*iv)=="GainChi2Prob1d" || (*iv)=="GainNPoints1d" || (*iv)=="GainHighPoint1d" || (*iv)=="GainLowPoint1d" || (*iv)=="GainEndPoint1d" || (*iv)=="GainDynamicRange2d" || (*iv)=="GainSaturate2d" || (*iv)=="Pedestal1d" || (*iv)=="ScurveChi2ProbSummary" || (*iv)=="ScurveFitResultSummary" || (*iv)=="ScurveSigmasSummary" || (*iv)=="ScurveThresholdSummary"){ tag = prefix + "_" + (*iv) + "_mean_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); tag = prefix + "_" + (*iv) + "_RMS_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); }else if((*iv) == "SiPixelErrorsCalibDigis"){ tag = prefix + "_" + (*iv) + "_NCalibErrors_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); }else if((*iv)=="GainFitResult2d"){ tag = prefix + "_" + (*iv) + "_NNegativeFits_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); }else if((*iv)=="pixelAliveSummary"){ tag = prefix + "_" + (*iv) + "_FracOfPerfectPix_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); tag = prefix + "_" + (*iv) + "_mean_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); } }else{ tag = prefix + "_" + (*iv) + "_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); if((*iv)=="ndigis"){ tag = prefix + "_" + (*iv) + "FREQ_" + currDir.substr(currDir.find(dir_name)); temp = getSummaryME(bei, tag, isUpgrade); sum_mes.push_back(temp); } if(prefix=="SUMDIG" && (*iv)=="adc"){ tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name)); temp = bei->book1D(tag.c_str(), tag.c_str(),128, 0., 256.); sum_mes.push_back(temp); } if(prefix=="SUMCLU" && (*iv)=="charge"){ tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name)); temp = bei->book1D(tag.c_str(), tag.c_str(),100, 0., 200.); // To look to get the size automatically sum_mes.push_back(temp); } } } if (sum_mes.size() == 0) { edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ; return; } vector<string> subdirs = bei->getSubdirs(); //Blade if(dir_name.find("Blade_") == 0) GetBladeSubdirs(bei, subdirs); int ndet = 0; for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) { if (prefix!="SUMOFF" && (*it).find("Module_") == string::npos) continue; if (prefix=="SUMOFF" && (*it).find(isbarrel?"Layer_":"Disk_") == string::npos) continue; bei->cd(*it); ndet++; vector<string> contents = bei->getMEs(); for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin(); isum != sum_mes.end(); isum++) { for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++) { string sname = ((*isum)->getName()); string tname = " "; tname = sname.substr(7,(sname.find("_",7)-6)); if(sname.find("ALLMODS_adcCOMB_")!=string::npos) tname = "adc_"; if(sname.find("ALLMODS_chargeCOMB_")!=string::npos) tname = "charge_"; if(sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos) tname = "charge_"; if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos) tname = "nclusters_"; if(sname.find("_size_")!=string::npos && sname.find("Track_")==string::npos) tname = "size_"; if(sname.find("_charge_OffTrack_")!=string::npos) tname = "charge_OffTrack_"; if(sname.find("_nclusters_OffTrack_")!=string::npos) tname = "nclusters_OffTrack_"; if(sname.find("_size_OffTrack_")!=string::npos) tname = "size_OffTrack_"; if(sname.find("_sizeX_OffTrack_")!=string::npos) tname = "sizeX_OffTrack_"; if(sname.find("_sizeY_OffTrack_")!=string::npos) tname = "sizeY_OffTrack_"; if(sname.find("_charge_OnTrack_")!=string::npos) tname = "charge_OnTrack_"; if(sname.find("_nclusters_OnTrack_")!=string::npos) tname = "nclusters_OnTrack_"; if(sname.find("_size_OnTrack_")!=string::npos) tname = "size_OnTrack_"; if(sname.find("_sizeX_OnTrack_")!=string::npos) tname = "sizeX_OnTrack_"; if(sname.find("_sizeY_OnTrack_")!=string::npos) tname = "sizeY_OnTrack_"; //if(sname.find("ALLMODS")!=string::npos) cout<<"sname and tname= "<<sname<<","<<tname<<endl; if(tname.find("FREQ")!=string::npos) tname = "ndigis_"; if (((*im)).find(tname) == 0) { string fullpathname = bei->pwd() + "/" + (*im); //cout<<"!!!!!!!!!!!!!!!!!!!!!!SNAME= "<<sname<<endl; MonitorElement * me = bei->get(fullpathname); if (me){ if(sname.find("_charge")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue; if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue; if(sname.find("_size")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue; //cout<<"tell me the sname and me name: "<<sname<<" , "<<me->getName()<<endl; // fill summary histos: if (sname.find("_RMS_")!=string::npos && sname.find("GainDynamicRange2d")==string::npos && sname.find("GainSaturate2d")==string::npos){ (*isum)->Fill(ndet, me->getRMS()); }else if (sname.find("GainDynamicRange2d")!=string::npos || sname.find("GainSaturate2d")!=string::npos){ float SumOfEntries=0.; float SumOfSquaredEntries=0.; int SumOfPixels=0; for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){ SumOfEntries+=me->getBinContent(cols,rows); SumOfSquaredEntries+=(me->getBinContent(cols,rows))*(me->getBinContent(cols,rows)); SumOfPixels++; } float MeanInZ = SumOfEntries / float(SumOfPixels); float RMSInZ = sqrt(SumOfSquaredEntries/float(SumOfPixels)); if(sname.find("_mean_")!=string::npos) (*isum)->Fill(ndet, MeanInZ); if(sname.find("_RMS_")!=string::npos) (*isum)->Fill(ndet, RMSInZ); }else if (sname.find("_FracOfPerfectPix_")!=string::npos){ //printing cout<<"nbins = "<<me->getNbinsX()<<" , "<<me->getBinContent(me->getNbinsX()-1)<<" , "<<me->getBinContent(me->getNbinsX())<<endl; float nlast = me->getBinContent(me->getNbinsX()); float nall = (me->getTH1F())->Integral(1,11); //printing cout << nall << endl; (*isum)->Fill(ndet, nlast/nall); }else if (sname.find("_NCalibErrors_")!=string::npos || sname.find("FREQ_")!=string::npos){ float nall = me->getEntries(); (*isum)->Fill(ndet, nall); }else if (sname.find("GainFitResult2d")!=string::npos){ int NegFitPixels=0; for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){ if(me->getBinContent(cols,rows)<0.) NegFitPixels++; } (*isum)->Fill(ndet, float(NegFitPixels)); }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos || (sname.find("ALLMODS_chargeCOMB_")!=string::npos && me->getName().find("Track_")==string::npos)){ (*isum)->getTH1F()->Add(me->getTH1F()); }else if (sname.find("_NErrors_")!=string::npos){ string path1 = fullpathname; path1 = path1.replace(path1.find("NErrors"),7,"errorType"); MonitorElement * me1 = bei->get(path1); bool notReset=true; if(me1){ for(int jj=1; jj<16; jj++){ if(me1->getBinContent(jj)>0.){ if(jj==6){ //errorType=30 (reset) string path2 = path1; path2 = path2.replace(path2.find("errorType"),9,"TBMMessage"); MonitorElement * me2 = bei->get(path2); if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false; } } } } if(notReset) (*isum)->Fill(ndet, me1->getEntries()); }else if ((sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")==string::npos) || (sname.find("_charge_")!=string::npos && sname.find("_OnTrack_")!=string::npos && me->getName().find("_OnTrack_")!=string::npos) || (sname.find("_charge_")!=string::npos && sname.find("_OffTrack_")!=string::npos && me->getName().find("_OffTrack_")!=string::npos) || (sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")==string::npos) || (sname.find("_nclusters_")!=string::npos && sname.find("_OnTrack_")!=string::npos && me->getName().find("_OnTrack_")!=string::npos) || (sname.find("_nclusters_")!=string::npos && sname.find("_OffTrack_")!=string::npos && me->getName().find("_OffTrack_")!=string::npos) || (sname.find("_size")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")==string::npos) || (sname.find("_size")!=string::npos && sname.find("_OnTrack_")!=string::npos && me->getName().find("_OnTrack_")!=string::npos) || (sname.find("_size")!=string::npos && sname.find("_OffTrack_")!=string::npos && me->getName().find("_OffTrack_")!=string::npos)){ (*isum)->Fill(ndet, me->getMean()); }else if(sname.find("_charge_")==string::npos && sname.find("_nclusters_")==string::npos && sname.find("_size")==string::npos){ (*isum)->Fill(ndet, me->getMean()); //std::cout<<bei->pwd()<<"/"<<(*isum)->getName()<<" , "<<ndet<<" , "<<me->getMean()<<" , "<<(*isum)->getBinContent(ndet)<<std::endl; } // set titles: if(prefix=="SUMOFF"){ (*isum)->setAxisTitle(isbarrel?"Ladders":"Blades",1); }else if(sname.find("ALLMODS_adcCOMB_")!=string::npos){ (*isum)->setAxisTitle("Digi charge [ADC]",1); }else if(sname.find("ALLMODS_chargeCOMB_")!=string::npos){ (*isum)->setAxisTitle("Cluster charge [kilo electrons]",1); }else{ (*isum)->setAxisTitle("Modules",1); } string title = " "; if (sname.find("_RMS_")!=string::npos){ title = "RMS of " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; }else if (sname.find("_FracOfPerfectPix_")!=string::npos){ title = "FracOfPerfectPix " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; }else if(sname.find("_NCalibErrors_")!=string::npos){ title = "Number of CalibErrors " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; }else if(sname.find("_NNegativeFits_")!=string::npos){ title = "Number of pixels with neg. fit result " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; }else if (sname.find("FREQ_")!=string::npos){ title = "NEvents with digis per module"; }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){ title = "NDigis"; }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){ title = "NClusters"; }else if (sname.find("_NErrors_")!=string::npos){ if(prefix=="SUMOFF" && isbarrel) title = "Total number of errors per Ladder"; else if(prefix=="SUMOFF" && !isbarrel) title = "Total number of errors per Blade"; else title = "Total number of errors per Module"; }else{ if(prefix=="SUMOFF") title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + (isbarrel?" per Ladder":" per Blade"); else title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per Module"; } (*isum)->setAxisTitle(title,2); } break; } } } bei->goUp(); if(dir_name.find("Blade") == 0) bei->goUp(); // Going up a second time if we are processing the Blade } // end for it (subdirs) } else { vector<string> subdirs = bei->getSubdirs(); // printing cout << "#\t" << bei->pwd() << endl; if(isbarrel) { for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) { // cout << "##\t" << bei->pwd() << "\t" << (*it) << endl; if((bei->pwd()).find("Endcap")!=string::npos || (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp(); bei->cd(*it); if((*it).find("Endcap")!=string::npos || (*it).find("AdditionalPixelErrors")!=string::npos) continue; fillSummary(bei, dir_name, me_names, true, isUpgrade); // Barrel bei->goUp(); } string grandbarrel_structure_name; vector<string> grandbarrel_me_names; if (!configParser_->getMENamesForGrandBarrelSummary(grandbarrel_structure_name, grandbarrel_me_names)){ cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Barrel Summary configuration parameters!! "; return; } fillGrandBarrelSummaryHistos(bei, grandbarrel_me_names, isUpgrade); } else // Endcap { for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) { // cout << "##\t" << bei->pwd() << "\t" << (*it) << endl; if((bei->pwd()).find("Barrel")!=string::npos || (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp(); bei->cd((*it)); if ((*it).find("Barrel")!=string::npos || (*it).find("AdditionalPixelErrors")!=string::npos) continue; fillSummary(bei, dir_name, me_names, false, isUpgrade); // Endcap bei->goUp(); } string grandendcap_structure_name; vector<string> grandendcap_me_names; if (!configParser_->getMENamesForGrandEndcapSummary(grandendcap_structure_name, grandendcap_me_names)){ cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Endcap Summary configuration parameters!! "; return; } fillGrandEndcapSummaryHistos(bei, grandendcap_me_names, isUpgrade); } } // cout<<"...leaving SiPixelActionExecutor::fillSummary!"<<endl; // End of cleanup }
const StorageAccount::StorageStats & StorageAccount::summary | ( | void | ) | [static] |
std::string StorageAccount::summaryText | ( | bool | banner = false | ) | [static] |
Definition at line 35 of file StorageAccount.cc.
References first, i, j, and s_stats.
Referenced by TFileAdaptor::stats().
{ bool first = true; std::ostringstream os; if (banner) os << "stats: class/operation/attempts/successes/amount/time-total/time-min/time-max\n"; for (StorageStats::iterator i = s_stats.begin (); i != s_stats.end(); ++i) for (OperationStats::iterator j = i->second->begin (); j != i->second->end (); ++j, first = false) os << (first ? "" : "; ") << i->first << '/' << j->first << '=' << j->second.attempts << '/' << j->second.successes << '/' << (j->second.amount / 1024 / 1024) << "MB/" << (j->second.timeTotal / 1000 / 1000) << "ms/" << (j->second.timeMin / 1000 / 1000) << "ms/" << (j->second.timeMax / 1000 / 1000) << "ms"; return os.str (); }
std::string StorageAccount::summaryXML | ( | void | ) | [static] |
Definition at line 56 of file StorageAccount.cc.
{ std::ostringstream os; os << "<storage-timing-summary>\n"; for (StorageStats::iterator i = s_stats.begin (); i != s_stats.end(); ++i) for (OperationStats::iterator j = i->second->begin (); j != i->second->end (); ++j) os << " <counter-value subsystem='" << i->first << "' counter-name='" << j->first << "' num-operations='" << j->second.attempts << "' num-successful-operations='" << j->second.successes << "' total-megabytes='" << (j->second.amount / 1024 / 1024) << "' total-msecs='" << (j->second.timeTotal / 1000 / 1000) << "' min-msecs='" << (j->second.timeMin / 1000 / 1000) << "' max-msecs='" << (j->second.timeMax / 1000 / 1000) << "'/>\n"; os << "</storage-timing-summary>"; return os.str (); }