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 16 of file PlotCombiner.cc.

Constructor & Destructor Documentation

◆ PlotCombiner()

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

Definition at line 31 of file PlotCombiner.cc.

32  : myDQMrootFolder(pset.getUntrackedParameter<string>("MyDQMrootFolder")),
33  plots(pset.getUntrackedParameter<VParameterSet>("Plots")) {}
string myDQMrootFolder
Definition: PlotCombiner.cc:24
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:34
const VParameterSet plots
Definition: PlotCombiner.cc:25

◆ ~PlotCombiner()

PlotCombiner::~PlotCombiner ( )
override

Definition at line 109 of file PlotCombiner.cc.

109 {}

Member Function Documentation

◆ dqmEndJob()

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

Definition at line 35 of file PlotCombiner.cc.

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

35  {
36  for (VParameterSet::const_iterator pset = plots.begin(); pset != plots.end(); pset++) {
37  makePlot(*pset, ibooker_, igetter_);
38  }
39 }
const VParameterSet plots
Definition: PlotCombiner.cc:25
void makePlot(const ParameterSet &pset, DQMStore::IBooker &, DQMStore::IGetter &)
Definition: PlotCombiner.cc:41

◆ makePlot()

void PlotCombiner::makePlot ( const ParameterSet pset,
DQMStore::IBooker ibooker_,
DQMStore::IGetter igetter_ 
)
private

Definition at line 41 of file PlotCombiner.cc.

References dqm::implementation::IBooker::book2D(), dqm::implementation::IGetter::get(), combine::histos, mps_fire::i, dqmiolumiharvest::j, SummaryClient_cfi::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, hlx_dqm_sourceclient_cfi::outputDir, muonDTDigis_cfi::pset, and dqm::implementation::NavigatorBase::setCurrentFolder().

Referenced by dqmEndJob().

41  {
42  //get hold of MEs
43  vector<string> inputMEnames = pset.getUntrackedParameter<vector<string> >("InputMEnames");
44  vector<string> inputLabels = pset.getUntrackedParameter<vector<string> >("InputLabels");
45  if (inputMEnames.size() != inputLabels.size()) {
46  LogDebug("HLTriggerOfflineHeavyFlavor") << "Number of labels must match the histos[0]ber of InputMEnames" << endl;
47  return;
48  }
49  vector<TH1 *> histos;
50  vector<TString> labels;
51  for (size_t i = 0; i < inputMEnames.size(); i++) {
52  string MEname = myDQMrootFolder + "/" + inputMEnames[i];
53  MonitorElement *ME = igetter_.get(MEname);
54  if (ME == nullptr) {
55  LogDebug("HLTriggerOfflineHeavyFlavor") << "Could not find ME: " << MEname << endl;
56  continue;
57  }
58  histos.push_back(ME->getTH1());
59  labels.push_back(inputLabels[i]);
60  }
61  if (histos.empty()) {
62  return;
63  }
64  //figure out the output directory name
65  string outputMEname = pset.getUntrackedParameter<string>("OutputMEname");
66  ;
67  string outputDir = myDQMrootFolder;
68  string::size_type slashPos = outputMEname.rfind('/');
69  if (string::npos != slashPos) {
70  outputDir += "/" + outputMEname.substr(0, slashPos);
71  outputMEname.erase(0, slashPos + 1);
72  }
73  ibooker_.setCurrentFolder(outputDir);
74  //create output ME
75  TH2F *output;
76  if (histos[0]->GetXaxis()->GetXbins()->GetSize() == 0) {
77  output = new TH2F(outputMEname.c_str(),
78  outputMEname.c_str(),
79  histos[0]->GetXaxis()->GetNbins(),
80  histos[0]->GetXaxis()->GetXmin(),
81  histos[0]->GetXaxis()->GetXmax(),
82  histos.size(),
83  0,
84  histos.size());
85  } else {
86  output = new TH2F(outputMEname.c_str(),
87  outputMEname.c_str(),
88  histos[0]->GetXaxis()->GetNbins(),
89  histos[0]->GetXaxis()->GetXbins()->GetArray(),
90  histos.size(),
91  0,
92  histos.size());
93  }
94  output->SetTitle(outputMEname.c_str());
95  output->SetXTitle(histos[0]->GetXaxis()->GetTitle());
96  output->SetStats(kFALSE);
97  output->SetOption("colztexte");
98  for (size_t i = 0; i < histos.size(); i++) {
99  for (int j = 1; j <= histos[0]->GetNbinsX(); j++) {
100  output->SetBinContent(j, i + 1, histos[i]->GetBinContent(j));
101  output->SetBinError(j, i + 1, histos[i]->GetBinError(j));
102  }
103  output->GetYaxis()->SetBinLabel(i + 1, labels[i]);
104  }
105  ibooker_.book2D(outputMEname, output);
106  delete output;
107 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
string myDQMrootFolder
Definition: PlotCombiner.cc:24
uint16_t size_type
Definition: ME.h:11
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:690
histos
Definition: combine.py:4
#define LogDebug(id)

Member Data Documentation

◆ myDQMrootFolder

string PlotCombiner::myDQMrootFolder
private

Definition at line 24 of file PlotCombiner.cc.

Referenced by makePlot().

◆ plots

const VParameterSet PlotCombiner::plots
private

Definition at line 25 of file PlotCombiner.cc.

Referenced by dqmEndJob().