test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
12  edm::LogInfo("DQMScaleToClient") << "Constructor DQMScaleToClient::DQMScaleToClient " << std::endl;
13 
14  scaled_ = nullptr;
15 
16 }
17 
19 {
20  return MEPSet{
21  pset.getParameter<std::string>("name"),
22  pset.getParameter<std::string>("folder"),
23  };
24 }
25 
27 {
28  return OutputMEPSet{
29  pset.getParameter<std::string>("name"),
30  pset.getParameter<std::string>("folder"),
31  pset.getParameter<double>("factor"),
32  };
33 }
34 
35 //
36 // -------------------------------------- beginJob --------------------------------------------
37 //
39 {
40  edm::LogInfo("DQMScaleToClient") << "DQMScaleToClient::beginJob " << std::endl;
41 }
42 
43 //
44 // -------------------------------------- get and book in the endJob --------------------------------------------
45 //
47 {
48  std::string hname = "";
49 
50  // create and cd into new folder
51  std::string currentFolder = outputmepset_.folder;
52  ibooker_.setCurrentFolder(currentFolder.c_str());
53 
54  //get available histograms
55  hname = inputmepset_.folder + "/" + inputmepset_.name;
56  MonitorElement* inputme = igetter_.get( hname.c_str() );
57 
58  if (!inputme) {
59  edm::LogError("DQMScaleToClient") << "MEs not found! "
60  << inputmepset_.folder + "/" + inputmepset_.name + " not found "
61  << std::endl;
62  return;
63  }
64 
65  //book new histogram
66  ibooker_.setCurrentFolder(currentFolder.c_str());
67  hname = outputmepset_.name;
68  scaled_ = ibooker_.book1D(hname,(TH1F*)inputme->getTH1()->Clone(hname.c_str()));
69 
70  // handle mes
71  double integral = (scaled_->getTH1()->Integral() > 0. ? scaled_->getTH1()->Integral() : 1.);
72  scaled_->getTH1()->Scale(outputmepset_.factor/integral);
73 }
74 
75 //
76 // -------------------------------------- get in the endLumi if needed --------------------------------------------
77 //
79 {
80  edm::LogInfo("DQMScaleToClient") << "DQMScaleToClient::endLumi " << std::endl;
81 }
82 
84 {
85  pset.add<std::string>("folder","");
86  pset.add<std::string>("name","");
87 }
88 
90 {
91  pset.add<std::string>("folder","");
92  pset.add<std::string>("name","");
93  pset.add<double>("factor",1.);
94 }
95 
97 {
98 
100  edm::ParameterSetDescription outputmePSet;
101  fillOutputMePSetDescription(outputmePSet);
102  desc.add<edm::ParameterSetDescription>("outputme", outputmePSet);
103 
104  edm::ParameterSetDescription inputmePSet;
105  fillMePSetDescription(inputmePSet);
106  desc.add<edm::ParameterSetDescription>("inputme", inputmePSet);
107 
108  descriptions.add("dqmScaleToClient", desc);
109 
110 }
111 
112 // Define this as a plug-in
T getParameter(std::string const &) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OutputMEPSet outputmepset_
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::string folder
std::string folder
MonitorElement * scaled_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1 * getTH1(void) const
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:69
std::string name
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
static OutputMEPSet getOutputHistoPSet(edm::ParameterSet pset)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
static MEPSet getHistoPSet(edm::ParameterSet pset)
DQMScaleToClient(const edm::ParameterSet &ps)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)