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

Constructor & Destructor Documentation

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

Definition at line 33 of file PlotCombiner.cc.

34  : myDQMrootFolder(pset.getUntrackedParameter<string>("MyDQMrootFolder")),
35  plots(pset.getUntrackedParameter<VParameterSet>("Plots")) {}
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 111 of file PlotCombiner.cc.

References DEFINE_FWK_MODULE.

111 {}

Member Function Documentation

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

Definition at line 37 of file PlotCombiner.cc.

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

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

Definition at line 43 of file PlotCombiner.cc.

References dqm::legacy::MonitorElement::getTH1(), edm::ParameterSet::getUntrackedParameter(), combine::histos, mps_fire::i, dqmiolumiharvest::j, SummaryClient_cfi::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, and hlx_dqm_sourceclient_cfi::outputDir.

Referenced by dqmEndJob().

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

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().