CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PlotCombiner Class Reference
Inheritance diagram for PlotCombiner:

Public Member Functions

 PlotCombiner (const edm::ParameterSet &pset)
 
 ~PlotCombiner () override
 

Protected Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 

Private Member Functions

void makePlot (const ParameterSet &pset, DQMStore::IBooker &, DQMStore::IGetter &)
 

Private Attributes

string myDQMrootFolder
 
const VParameterSet plots
 

Detailed Description

Definition at line 19 of file PlotCombiner.cc.

Constructor & Destructor Documentation

PlotCombiner::PlotCombiner ( const edm::ParameterSet pset)

Definition at line 33 of file PlotCombiner.cc.

33  :
34  myDQMrootFolder( pset.getUntrackedParameter<string>("MyDQMrootFolder") ),
35  plots( pset.getUntrackedParameter<VParameterSet>("Plots") )
36 {
37 }
T getUntrackedParameter(std::string const &, T const &) const
string myDQMrootFolder
Definition: PlotCombiner.cc:26
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
const VParameterSet plots
Definition: PlotCombiner.cc:27
PlotCombiner::~PlotCombiner ( )
override

Definition at line 99 of file PlotCombiner.cc.

References DEFINE_FWK_MODULE.

99  {
100 }

Member Function Documentation

void PlotCombiner::dqmEndJob ( DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
overrideprotected

Definition at line 39 of file PlotCombiner.cc.

References makePlot(), plots, and muonDTDigis_cfi::pset.

39  {
40  for(VParameterSet::const_iterator pset = plots.begin(); pset!=plots.end(); pset++){
41  makePlot(*pset, ibooker_, igetter_);
42  }
43 }
const VParameterSet plots
Definition: PlotCombiner.cc:27
void makePlot(const ParameterSet &pset, DQMStore::IBooker &, DQMStore::IGetter &)
Definition: PlotCombiner.cc:45
void PlotCombiner::makePlot ( const ParameterSet pset,
DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
private

Definition at line 45 of file PlotCombiner.cc.

References DQMStore::IBooker::book2D(), DQMStore::IGetter::get(), MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), plotFactory::histos, mps_fire::i, tablePrinter::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, indexGen::outputDir, and DQMStore::IBooker::setCurrentFolder().

Referenced by dqmEndJob().

45  {
46 //get hold of MEs
47  vector<string> inputMEnames = pset.getUntrackedParameter<vector<string> >("InputMEnames");
48  vector<string> inputLabels = pset.getUntrackedParameter<vector<string> >("InputLabels");
49  if( inputMEnames.size() != inputLabels.size() ){
50  LogDebug("HLTriggerOfflineHeavyFlavor") << "Number of labels must match the histos[0]ber of InputMEnames"<<endl;
51  return;
52  }
53  vector<TH1*> histos;
54  vector<TString> labels;
55  for(size_t i=0; i<inputMEnames.size(); i++){
56  string MEname = myDQMrootFolder+"/"+inputMEnames[i];
57  MonitorElement *ME = igetter_.get(MEname);
58  if(ME==nullptr){
59  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not find ME: "<<MEname<<endl;
60  continue;
61  }
62  histos.push_back( ME->getTH1() );
63  labels.push_back( inputLabels[i] );
64  }
65  if(histos.empty()){
66  return;
67  }
68  //figure out the output directory name
69  string outputMEname = pset.getUntrackedParameter<string>("OutputMEname");;
70  string outputDir = myDQMrootFolder;
71  string::size_type slashPos = outputMEname.rfind('/');
72  if ( string::npos != slashPos ) {
73  outputDir += "/"+outputMEname.substr(0, slashPos);
74  outputMEname.erase(0, slashPos+1);
75  }
76  ibooker_.setCurrentFolder(outputDir);
77  //create output ME
78  TH2F * output;
79  if(histos[0]->GetXaxis()->GetXbins()->GetSize()==0){
80  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());
81  }else{
82  output = new TH2F(outputMEname.c_str(),outputMEname.c_str(),histos[0]->GetXaxis()->GetNbins(),histos[0]->GetXaxis()->GetXbins()->GetArray(),histos.size(),0,histos.size());
83  }
84  output->SetTitle(outputMEname.c_str());
85  output->SetXTitle( histos[0]->GetXaxis()->GetTitle() );
86  output->SetStats(kFALSE);
87  output->SetOption("colztexte");
88  for(size_t i=0; i<histos.size(); i++){
89  for(int j=1; j<=histos[0]->GetNbinsX(); j++){
90  output->SetBinContent(j,i+1,histos[i]->GetBinContent(j));
91  output->SetBinError(j,i+1,histos[i]->GetBinError(j));
92  }
93  output->GetYaxis()->SetBinLabel(i+1,labels[i]);
94  }
95  ibooker_.book2D(outputMEname,output);
96  delete output;
97 }
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
string myDQMrootFolder
Definition: PlotCombiner.cc:26
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
TH1 * getTH1() const
uint16_t size_type
Definition: ME.h:11
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136

Member Data Documentation

string PlotCombiner::myDQMrootFolder
private

Definition at line 26 of file PlotCombiner.cc.

Referenced by makePlot().

const VParameterSet PlotCombiner::plots
private

Definition at line 27 of file PlotCombiner.cc.

Referenced by dqmEndJob().