CMS 3D CMS Logo

DQMScaleToClient.cc
Go to the documentation of this file.
2 
4 
5 //
6 // -------------------------------------- Constructor --------------------------------------------
7 //
9  : inputmepset_(getHistoPSet(iConfig.getParameter<edm::ParameterSet>("inputme"))),
10  outputmepset_(getOutputHistoPSet(iConfig.getParameter<edm::ParameterSet>("outputme"))) {
11  edm::LogInfo("DQMScaleToClient") << "Constructor DQMScaleToClient::DQMScaleToClient " << std::endl;
12 
13  scaled_ = nullptr;
14 }
15 
17  return MEPSet{
18  pset.getParameter<std::string>("name"),
19  pset.getParameter<std::string>("folder"),
20  };
21 }
22 
24  return OutputMEPSet{
25  pset.getParameter<std::string>("name"),
26  pset.getParameter<std::string>("folder"),
27  pset.getParameter<double>("factor"),
28  };
29 }
30 
31 //
32 // -------------------------------------- beginJob --------------------------------------------
33 //
34 void DQMScaleToClient::beginJob() { edm::LogInfo("DQMScaleToClient") << "DQMScaleToClient::beginJob " << std::endl; }
35 
36 //
37 // -------------------------------------- get and book in the endJob --------------------------------------------
38 //
40  std::string hname = "";
41 
42  // create and cd into new folder
43  std::string currentFolder = outputmepset_.folder;
44  ibooker_.setCurrentFolder(currentFolder);
45 
46  //get available histograms
47  hname = inputmepset_.folder + "/" + inputmepset_.name;
48  MonitorElement* inputme = igetter_.get(hname);
49 
50  if (!inputme) {
51  edm::LogError("DQMScaleToClient") << "MEs not found! "
52  << inputmepset_.folder + "/" + inputmepset_.name + " not found " << std::endl;
53  return;
54  }
55 
56  //book new histogram
57  ibooker_.setCurrentFolder(currentFolder);
58  hname = outputmepset_.name;
59  scaled_ = ibooker_.book1D(hname, (TH1F*)inputme->getTH1()->Clone(hname.c_str()));
60 
61  // handle mes
62  double integral = (scaled_->getTH1()->Integral() > 0. ? scaled_->getTH1()->Integral() : 1.);
63  scaled_->getTH1()->Scale(outputmepset_.factor / integral);
64 }
65 
66 //
67 // -------------------------------------- get in the endLumi if needed --------------------------------------------
68 //
70  DQMStore::IGetter& igetter_,
71  edm::LuminosityBlock const& iLumi,
72  edm::EventSetup const& iSetup) {
73  edm::LogInfo("DQMScaleToClient") << "DQMScaleToClient::endLumi " << std::endl;
74 }
75 
77  pset.add<std::string>("folder", "");
78  pset.add<std::string>("name", "");
79 }
80 
82  pset.add<std::string>("folder", "");
83  pset.add<std::string>("name", "");
84  pset.add<double>("factor", 1.);
85 }
86 
89  edm::ParameterSetDescription outputmePSet;
90  fillOutputMePSetDescription(outputmePSet);
91  desc.add<edm::ParameterSetDescription>("outputme", outputmePSet);
92 
93  edm::ParameterSetDescription inputmePSet;
94  fillMePSetDescription(inputmePSet);
95  desc.add<edm::ParameterSetDescription>("inputme", inputmePSet);
96 
97  descriptions.add("dqmScaleToClient", desc);
98 }
99 
100 // Define this as a plug-in
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
OutputMEPSet outputmepset_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
std::string folder
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::string folder
MonitorElement * scaled_
static void fillMePSetDescription(edm::ParameterSetDescription &pset)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillOutputMePSetDescription(edm::ParameterSetDescription &pset)
Integral< F, X >::type integral(const F &f)
Definition: Integral.h:70
std::string name
void beginJob() override
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
static OutputMEPSet getOutputHistoPSet(edm::ParameterSet pset)
static MEPSet getHistoPSet(edm::ParameterSet pset)
DQMScaleToClient(const edm::ParameterSet &ps)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:437
virtual TH1 * getTH1() const