Public Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | endRun (const edm::Run &, const edm::EventSetup &) |
PlotCombiner (const edm::ParameterSet &pset) | |
virtual | ~PlotCombiner () |
Private Member Functions | |
void | makePlot (const ParameterSet &pset) |
Private Attributes | |
DQMStore * | dqmStore |
string | myDQMrootFolder |
const VParameterSet | plots |
Definition at line 18 of file PlotCombiner.cc.
PlotCombiner::PlotCombiner | ( | const edm::ParameterSet & | pset | ) |
Definition at line 31 of file PlotCombiner.cc.
: myDQMrootFolder( pset.getUntrackedParameter<string>("MyDQMrootFolder") ), plots( pset.getUntrackedParameter<VParameterSet>("Plots") ) { }
PlotCombiner::~PlotCombiner | ( | ) | [virtual] |
Definition at line 102 of file PlotCombiner.cc.
{ }
virtual void PlotCombiner::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [inline, virtual] |
void PlotCombiner::endRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 37 of file PlotCombiner.cc.
References dqmStore, makePlot(), cmsCodeRules::cppFunctionSkipper::operator, and plots.
void PlotCombiner::makePlot | ( | const ParameterSet & | pset | ) | [private] |
Definition at line 48 of file PlotCombiner.cc.
References DQMStore::book2D(), dqmStore, DQMStore::get(), MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), mergeVDriftHistosByStation::histos, i, j, L1TDQM_cfg::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, indexGen::outputDir, and DQMStore::setCurrentFolder().
Referenced by endRun().
{ //get hold of MEs vector<string> inputMEnames = pset.getUntrackedParameter<vector<string> >("InputMEnames"); vector<string> inputLabels = pset.getUntrackedParameter<vector<string> >("InputLabels"); if( inputMEnames.size() != inputLabels.size() ){ LogDebug("HLTriggerOfflineHeavyFlavor") << "Number of labels must match the histos[0]ber of InputMEnames"<<endl; return; } vector<TH1*> histos; vector<TString> labels; for(size_t i=0; i<inputMEnames.size(); i++){ string MEname = myDQMrootFolder+"/"+inputMEnames[i]; MonitorElement *ME = dqmStore->get(MEname); if(ME==0){ LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not find ME: "<<MEname<<endl; continue; } histos.push_back( ME->getTH1() ); labels.push_back( inputLabels[i] ); } if(histos.size()==0){ return; } //figure out the output directory name string outputMEname = pset.getUntrackedParameter<string>("OutputMEname");; string outputDir = myDQMrootFolder; string::size_type slashPos = outputMEname.rfind('/'); if ( string::npos != slashPos ) { outputDir += "/"+outputMEname.substr(0, slashPos); outputMEname.erase(0, slashPos+1); } dqmStore->setCurrentFolder(outputDir); //create output ME TH2F * output; if(histos[0]->GetXaxis()->GetXbins()->GetSize()==0){ output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXmin(),histos[0]->GetXaxis()->GetXmax(),histos.size(),0,histos.size()); }else{ output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXbins()->GetArray(),histos.size(),0,histos.size()); } output->SetTitle(outputMEname.c_str()); output->SetXTitle( histos[0]->GetXaxis()->GetTitle() ); output->SetStats(kFALSE); output->SetOption("colztexte"); for(size_t i=0; i<histos.size(); i++){ for(int j=1; j<=histos[0]->GetNbinsX(); j++){ output->SetBinContent(j,i+1,histos[i]->GetBinContent(j)); output->SetBinError(j,i+1,histos[i]->GetBinError(j)); } output->GetYaxis()->SetBinLabel(i+1,labels[i]); } dqmStore->book2D(outputMEname,output); delete output; }
DQMStore* PlotCombiner::dqmStore [private] |
Definition at line 26 of file PlotCombiner.cc.
Referenced by endRun(), and makePlot().
string PlotCombiner::myDQMrootFolder [private] |
Definition at line 27 of file PlotCombiner.cc.
Referenced by makePlot().
const VParameterSet PlotCombiner::plots [private] |
Definition at line 28 of file PlotCombiner.cc.
Referenced by endRun().