#include <DQM/SiPixelHistoricInfoClient/interface/SiPixelHistoricInfoEDAClient.h>
Public Member Functions | |
SiPixelHistoricInfoEDAClient (const edm::ParameterSet &) | |
~SiPixelHistoricInfoEDAClient () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | beginRun (const edm::Run &, const edm::EventSetup &) |
float | calculatePercentOver (MonitorElement *) const |
virtual void | endJob () |
virtual void | endRun (const edm::Run &, const edm::EventSetup &) |
void | fillSummaryObjects (const edm::Run &) const |
void | retrievePointersToModuleMEs (const edm::EventSetup &) |
void | savetoFile (std::string) const |
void | writetoDB (const edm::Run &) const |
void | writetoDB (edm::EventID, edm::Timestamp) const |
Private Attributes | |
std::map< uint32_t, std::vector< MonitorElement * > > | ClientPointersToModuleMEs |
DQMStore * | dbe_ |
bool | firstEventInRun |
int | nEvents |
edm::ParameterSet | parameterSet_ |
SiPixelPerformanceSummary * | performanceSummary_ |
Definition at line 25 of file SiPixelHistoricInfoEDAClient.h.
SiPixelHistoricInfoEDAClient::SiPixelHistoricInfoEDAClient | ( | const edm::ParameterSet & | parameterSet | ) | [explicit] |
Definition at line 48 of file SiPixelHistoricInfoEDAClient.cc.
References dbe_, parameterSet_, and DQMStore::setVerbose().
00048 { 00049 parameterSet_ = parameterSet; 00050 dbe_ = edm::Service<DQMStore>().operator->(); 00051 dbe_->setVerbose(0); 00052 }
SiPixelHistoricInfoEDAClient::~SiPixelHistoricInfoEDAClient | ( | ) |
void SiPixelHistoricInfoEDAClient::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 96 of file SiPixelHistoricInfoEDAClient.cc.
References firstEventInRun, nEvents, performanceSummary_, SiPixelPerformanceSummary::setTimeValue(), and edm::Event::time().
00096 { 00097 if (firstEventInRun) { 00098 firstEventInRun = false; 00099 performanceSummary_->setTimeValue(event.time().value()); 00100 } 00101 nEvents++; 00102 }
void SiPixelHistoricInfoEDAClient::beginJob | ( | const edm::EventSetup & | eventSetup | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 83 of file SiPixelHistoricInfoEDAClient.cc.
References nEvents.
00083 { 00084 nEvents = 0; 00085 }
void SiPixelHistoricInfoEDAClient::beginRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | eventSetup | |||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 88 of file SiPixelHistoricInfoEDAClient.cc.
References SiPixelPerformanceSummary::clear(), firstEventInRun, performanceSummary_, edm::Run::run(), and SiPixelPerformanceSummary::setRunNumber().
00088 { 00089 performanceSummary_ = new SiPixelPerformanceSummary(); 00090 performanceSummary_->clear(); 00091 performanceSummary_->setRunNumber(run.run()); 00092 firstEventInRun = true; 00093 }
float SiPixelHistoricInfoEDAClient::calculatePercentOver | ( | MonitorElement * | me | ) | const [private] |
Definition at line 260 of file SiPixelHistoricInfoEDAClient.cc.
References MonitorElement::getTH1F().
00260 { 00261 TH1F* hist = me->getTH1F(); 00262 unsigned int nBins = hist->GetNbinsX(); 00263 unsigned int upperBin = hist->FindBin(hist->GetMean()+3*hist->GetRMS()); 00264 float percentage=0.0; 00265 if ((upperBin-nBins)<1) { 00266 percentage = hist->Integral(upperBin,nBins)/hist->Integral(); 00267 return percentage; 00268 } 00269 return -99.9; 00270 }
Reimplemented from edm::EDAnalyzer.
Definition at line 123 of file SiPixelHistoricInfoEDAClient.cc.
References dbe_, edm::ParameterSet::getUntrackedParameter(), indexGen::outputDir, parameterSet_, and DQMStore::save().
00123 { 00124 if (parameterSet_.getUntrackedParameter<bool>("writeHisto", true)) { 00125 std::string outputDir = parameterSet_.getUntrackedParameter<std::string>("outputDir","."); 00126 std::ostringstream endJobOutputFile; 00127 endJobOutputFile << outputDir << "/SiPixelHistoricInfoEDAClient_endJob.root"; 00128 dbe_->save(endJobOutputFile.str()); 00129 } 00130 }
void SiPixelHistoricInfoEDAClient::endRun | ( | const edm::Run & | run, | |
const edm::EventSetup & | eventSetup | |||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 105 of file SiPixelHistoricInfoEDAClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, dbe_, lat::endl(), fillSummaryObjects(), firstEventInRun, edm::ParameterSet::getUntrackedParameter(), nEvents, indexGen::outputDir, parameterSet_, performanceSummary_, SiPixelPerformanceSummary::print(), retrievePointersToModuleMEs(), edm::Run::run(), DQMStore::save(), and writetoDB().
00105 { 00106 firstEventInRun = false; 00107 std::cout << "SiPixelHistoricInfoEDAClient::endRun() number of events = "<< nEvents << std::endl; 00108 00109 retrievePointersToModuleMEs(eventSetup); 00110 fillSummaryObjects(run); 00111 performanceSummary_->print(); 00112 writetoDB(run); 00113 00114 if (parameterSet_.getUntrackedParameter<bool>("writeHisto", true)) { 00115 std::string outputDir = parameterSet_.getUntrackedParameter<std::string>("outputDir","."); 00116 std::ostringstream endRunOutputFile; 00117 endRunOutputFile << outputDir << "/SiPixelHistoricInfoEDAClient_" << run.run() <<".root"; 00118 dbe_->save(endRunOutputFile.str()); 00119 } 00120 }
Definition at line 178 of file SiPixelHistoricInfoEDAClient.cc.
References ClientPointersToModuleMEs, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ParameterSet::getUntrackedParameter(), python::multivaluedict::map(), parameterSet_, performanceSummary_, and SiPixelPerformanceSummary::setNumberOfDigis().
Referenced by endRun().
00178 { 00179 for (std::map< uint32_t, std::vector<MonitorElement*> >::const_iterator iMEvec=ClientPointersToModuleMEs.begin(); 00180 iMEvec!=ClientPointersToModuleMEs.end(); iMEvec++) { 00181 uint32_t localMEdetID = iMEvec->first; 00182 std::vector<MonitorElement*> theMEvector = iMEvec->second; 00183 00184 for (std::vector<MonitorElement*>::const_iterator iMEpntr = theMEvector.begin(); 00185 iMEpntr!=theMEvector.end(); iMEpntr++) { 00186 std::string theMEname = (*iMEpntr)->getName(); 00187 // if (parameterSet_.getUntrackedParameter<bool>("debug", true)) std::cout << theMEname << std::endl; 00188 00189 if (theMEname.find("ndigis_siPixelDigis")!=std::string::npos) { 00190 performanceSummary_->setNumberOfDigis(localMEdetID, (*iMEpntr)->getMean(), (*iMEpntr)->getRMS()); 00191 if (parameterSet_.getUntrackedParameter<bool>("debug", true)) { 00192 std::cout << "sipixel performance summary table set with the number of digi's "<< (*iMEpntr)->getMean() 00193 << " +- "<< (*iMEpntr)->getRMS() 00194 <<" for det ID "<< localMEdetID << std::endl; 00195 } 00196 } 00197 /* if (theMEname.find("size_siPixelClusters")!=std::string::npos) { 00198 performanceSummary_->setClusterSize(localMEdetID, (*iMEpntr)->getMean(), (*iMEpntr)->getRMS()); 00199 } */ 00200 } 00201 } 00202 }
void SiPixelHistoricInfoEDAClient::retrievePointersToModuleMEs | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 133 of file SiPixelHistoricInfoEDAClient.cc.
References ClientPointersToModuleMEs, dbe_, DQMStore::get(), DQMStore::getContents(), MonitorElement::getName(), SiPixelHistogramId::getRawId(), and edm::second().
Referenced by endRun().
00133 { 00134 std::vector<string> listOfMEsWithFullPath; 00135 dbe_->getContents(listOfMEsWithFullPath); 00136 00137 for (std::vector<string>::const_iterator ime=listOfMEsWithFullPath.begin(); 00138 ime!=listOfMEsWithFullPath.end(); ime++) { 00139 uint32_t pathLength = (*ime).find(":",0); 00140 string thePath = (*ime).substr(0, pathLength); 00141 string allHists = (*ime).substr(pathLength+1); 00142 00143 if (thePath.find("Pixel",0)!=string::npos && thePath.find("Module",0)!=string::npos) { 00144 uint histnameLength; 00145 do { 00146 histnameLength = allHists.find(",",0); 00147 string theHist; 00148 if (histnameLength!=string::npos) { 00149 theHist = allHists.substr(0, histnameLength); 00150 allHists.erase(0, histnameLength+1); 00151 } 00152 else theHist = allHists; 00153 00154 string fullPathHist = thePath + "/" + theHist; 00155 MonitorElement* theMEpointer = dbe_->get(fullPathHist); 00156 00157 SiPixelHistogramId hisIDmanager; 00158 string hisID; 00159 uint32_t localMEdetID; 00160 if (theMEpointer) { 00161 hisID = theMEpointer->getName(); 00162 localMEdetID = hisIDmanager.getRawId(hisID); 00163 00164 if (ClientPointersToModuleMEs.find(localMEdetID)==ClientPointersToModuleMEs.end()) { 00165 std::vector<MonitorElement*> newMEvector; 00166 newMEvector.push_back(theMEpointer); 00167 ClientPointersToModuleMEs.insert(std::make_pair(localMEdetID, newMEvector)); 00168 } 00169 else ((ClientPointersToModuleMEs.find(localMEdetID))->second).push_back(theMEpointer); 00170 } 00171 } 00172 while (histnameLength!=string::npos); 00173 } 00174 } 00175 }
void SiPixelHistoricInfoEDAClient::savetoFile | ( | std::string | filename | ) | const [private] |
Definition at line 255 of file SiPixelHistoricInfoEDAClient.cc.
References dbe_, and DQMStore::save().
Definition at line 205 of file SiPixelHistoricInfoEDAClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::Service< T >::isAvailable(), performanceSummary_, and edm::Run::run().
00205 { 00206 unsigned int thisRun = run.run(); 00207 std::cout << std::endl << "SiPixelHistoricInfoEDAClient::writetoDB() run = "<< thisRun << std::endl; 00208 00209 edm::Service<cond::service::PoolDBOutputService> mydbservice; 00210 if (mydbservice.isAvailable()) { 00211 if (mydbservice->isNewTagRequest("SiPixelPerformanceSummaryRcd")) { 00212 mydbservice->createNewIOV<SiPixelPerformanceSummary>(performanceSummary_, 00213 mydbservice->beginOfTime(), 00214 mydbservice->endOfTime(), 00215 "SiPixelPerformanceSummaryRcd"); 00216 } 00217 else { 00218 mydbservice->appendSinceTime<SiPixelPerformanceSummary>(performanceSummary_, 00219 mydbservice->currentTime(), 00220 "SiPixelPerformanceSummaryRcd"); 00221 } 00222 } 00223 else edm::LogError("writetoDB") << "service unavailable" << std::endl; 00224 00225 std::cout << "SiPixelHistoricInfoEDAClient::writetoDB() finished. "<< std::endl; 00226 }
void SiPixelHistoricInfoEDAClient::writetoDB | ( | edm::EventID | eventID, | |
edm::Timestamp | EventTime | |||
) | const [private] |
Definition at line 229 of file SiPixelHistoricInfoEDAClient.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventID::event(), edm::Service< T >::isAvailable(), performanceSummary_, edm::EventID::run(), and edm::Timestamp::value().
Referenced by endRun().
00229 { 00230 unsigned int thisRun = eventID.run(); 00231 unsigned int thisEvent = eventID.event(); 00232 unsigned long long thisTime = EventTime.value(); 00233 std::cout << std::endl << "SiPixelHistoricInfoEDAClient::writetoDB() run = "<< thisRun 00234 <<" event = "<< thisEvent 00235 <<" time = "<< thisTime << std::endl; 00236 00237 edm::Service<cond::service::PoolDBOutputService> mydbservice; 00238 if (mydbservice.isAvailable()) { 00239 if (mydbservice->isNewTagRequest("SiPixelPerformanceSummaryRcd")) { 00240 mydbservice->createNewIOV<SiPixelPerformanceSummary>(performanceSummary_, 00241 mydbservice->beginOfTime(), 00242 mydbservice->endOfTime(), 00243 "SiPixelPerformanceSummaryRcd"); 00244 } 00245 else { 00246 mydbservice->appendSinceTime<SiPixelPerformanceSummary>(performanceSummary_, 00247 mydbservice->currentTime(), 00248 "SiPixelPerformanceSummaryRcd"); 00249 } 00250 } 00251 else edm::LogError("writetoDB") << "service unavailable" << std::endl; 00252 }
std::map< uint32_t, std::vector<MonitorElement*> > SiPixelHistoricInfoEDAClient::ClientPointersToModuleMEs [private] |
Definition at line 51 of file SiPixelHistoricInfoEDAClient.h.
Referenced by fillSummaryObjects(), and retrievePointersToModuleMEs().
DQMStore* SiPixelHistoricInfoEDAClient::dbe_ [private] |
Definition at line 50 of file SiPixelHistoricInfoEDAClient.h.
Referenced by endJob(), endRun(), retrievePointersToModuleMEs(), savetoFile(), and SiPixelHistoricInfoEDAClient().
Definition at line 47 of file SiPixelHistoricInfoEDAClient.h.
Referenced by analyze(), beginRun(), and endRun().
int SiPixelHistoricInfoEDAClient::nEvents [private] |
Definition at line 48 of file SiPixelHistoricInfoEDAClient.h.
Referenced by analyze(), beginJob(), and endRun().
Definition at line 49 of file SiPixelHistoricInfoEDAClient.h.
Referenced by endJob(), endRun(), fillSummaryObjects(), and SiPixelHistoricInfoEDAClient().
Definition at line 52 of file SiPixelHistoricInfoEDAClient.h.
Referenced by analyze(), beginRun(), endRun(), fillSummaryObjects(), and writetoDB().