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::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")) {}

◆ ~PlotCombiner()

PlotCombiner::~PlotCombiner ( )
override

Definition at line 111 of file PlotCombiner.cc.

111 {}

Member Function Documentation

◆ dqmEndJob()

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

Definition at line 37 of file PlotCombiner.cc.

37  {
38  for (VParameterSet::const_iterator pset = plots.begin(); pset != plots.end(); pset++) {
39  makePlot(*pset, ibooker_, igetter_);
40  }
41 }

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

◆ makePlot()

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

Definition at line 43 of file PlotCombiner.cc.

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 }

References combine::histos, mps_fire::i, dqmiolumiharvest::j, SummaryClient_cfi::labels, LogDebug, myDQMrootFolder, convertSQLitetoXML_cfg::output, hlx_dqm_sourceclient_cfi::outputDir, and muonDTDigis_cfi::pset.

Referenced by dqmEndJob().

Member Data Documentation

◆ myDQMrootFolder

string PlotCombiner::myDQMrootFolder
private

Definition at line 26 of file PlotCombiner.cc.

Referenced by makePlot().

◆ plots

const VParameterSet PlotCombiner::plots
private

Definition at line 27 of file PlotCombiner.cc.

Referenced by dqmEndJob().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
mps_fire.i
i
Definition: mps_fire.py:355
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm::VParameterSet
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
PlotCombiner::myDQMrootFolder
string myDQMrootFolder
Definition: PlotCombiner.cc:26
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
combine.histos
histos
Definition: combine.py:4
PlotCombiner::makePlot
void makePlot(const ParameterSet &pset, DQMStore::IBooker &, DQMStore::IGetter &)
Definition: PlotCombiner.cc:43
ME
Definition: ME.h:11
PlotCombiner::plots
const VParameterSet plots
Definition: PlotCombiner.cc:27
hlx_dqm_sourceclient_cfi.outputDir
outputDir
Definition: hlx_dqm_sourceclient_cfi.py:28
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27