CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DemoNormalDQMEDAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DQMServices/Demo
4 // Class: DemoNormalDQMEDAnalyzer
5 //
13 //
14 // Original Author: Marcel Schneider
15 // Created: Wed, 22 May 2019 15:18:07 GMT
16 //
17 //
18 
19 #include <string>
20 
23 
27 
29 public:
31  ~DemoNormalDQMEDAnalyzer() override;
32 
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35 private:
36  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
37 
38  void analyze(const edm::Event&, const edm::EventSetup&) override;
39 
46 };
47 
49  : folder_(iConfig.getParameter<std::string>("folder")) {
50  // now do what ever initialization is needed
51 }
52 
54  // do anything here that needs to be done at desctruction time
55  // (e.g. close files, deallocate resources etc.)
56 }
57 
58 // ------------ method called for each event ------------
60  using namespace edm;
61  example_->Fill(5);
62  example2D_->Fill(1.0, 2.0);
63  example3D_->Fill(1.0, 2.0, 3.0);
64  exampleTProfile_->Fill(1.0, 2.0);
65  exampleTProfile2D_->Fill(1.0, 2.0, 3.0);
66 }
67 
69  edm::Run const& run,
70  edm::EventSetup const& iSetup) {
72 
73  example_ = ibook.book1D(
74  "EXAMPLE", "Example 1D", 20, 0., 10., [](TH1*) { edm::LogInfo("DemoNormalDQMEDAnalyzer") << "booked!\n"; });
75  example2D_ = ibook.book2D("EXAMPLE_2D", "Example 2D", 20, 0, 20, 15, 0, 15);
76  example3D_ = ibook.book3D("EXAMPLE_3D", "Example 3D", 20, 0, 20, 15, 0, 15, 25, 0, 25);
77  exampleTProfile_ = ibook.bookProfile("EXAMPLE_TPROFILE", "Example TProfile", 20, 0, 20, 15, 0, 15);
78  exampleTProfile2D_ = ibook.bookProfile2D("EXAMPLE_TPROFILE2D", "Example TProfile 2D", 20, 0, 20, 15, 0, 15, 0, 100);
79 }
80 
81 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
84  desc.add<std::string>("folder", "MY_FOLDER");
85  descriptions.add("demo", desc);
86 }
87 
88 // define this as a plug-in
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
std::string folder_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DemoNormalDQMEDAnalyzer(const edm::ParameterSet &)
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
void analyze(const edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Log< level::Info, false > LogInfo
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:177
void add(std::string const &label, ParameterSetDescription const &psetDescription)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())
Definition: DQMStore.h:290
Definition: Run.h:45