CMS 3D CMS Logo

DQMEDAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: __subsys__/__pkgname__
4 // Class: __class__
5 //
13 //
14 // Original Author: __author__
15 // Created: __date__
16 //
17 //
18 
19 #include <string>
20 
21 // user include files
23 @example_stream#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
24 @example_global#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
25 
28 
30 
31 @example_stream#include "DQMServices/Core/interface/MonitorElement.h"
32 @example_stream
33 //
34 // class declaration
35 //
36 
37 @example_globalstruct Histograms___class__ {
41 @example_streamclass __class__ : public DQMEDAnalyzer {
42 @example_globalclass __class__ : public DQMGlobalEDAnalyzer<Histograms___class__> {
43 public:
44  explicit __class__(const edm::ParameterSet&);
45  ~__class__() override;
46 
47  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
48 
49 private:
50 @example_stream void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
52 @example_global edm::Run const&,
54 @example_global Histograms___class__&) const override;
55 
56 @example_stream void analyze(const edm::Event&, const edm::EventSetup&) override;
57 @example_global void dqmAnalyze(edm::Event const&, edm::EventSetup const&, Histograms___class__ const&) const override;
58 
59  // ------------ member data ------------
61 @example_stream MonitorElement* example_;
62 @example_stream MonitorElement* example2D_;
63 @example_stream MonitorElement* example3D_;
66 @example_stream int eventCount_ = 0;
67 };
68 
69 //
70 // constants, enums and typedefs
71 //
72 
73 //
74 // static data member definitions
75 //
76 
77 //
78 // constructors and destructor
79 //
81  : folder_(iConfig.getParameter<std::string>("folder")) {
82  // now do what ever initialization is needed
83 }
84 
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88 }
89 
90 //
91 // member functions
92 //
93 
94 // ------------ method called for each event ------------
95 @example_streamvoid __class__::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
96 @example_stream using namespace edm;
97 @example_stream
98 @example_stream eventCount_++;
99 @example_stream
100 @example_stream example_->Fill(5);
101 @example_stream example2D_->Fill(eventCount_ / 10, eventCount_ / 10);
102 @example_stream example3D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
103 @example_stream exampleTProfile_->Fill(eventCount_ / 10, eventCount_ / 10.f);
104 @example_stream exampleTProfile2D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
105 @example_stream}
106 @example_stream
107 @example_streamvoid __class__::bookHistograms(DQMStore::IBooker& ibook,
108 @example_stream __class_space__ edm::Run const& run,
109 @example_stream __class_space__ edm::EventSetup const& iSetup) {
110 @example_stream ibook.setCurrentFolder(folder_);
111 @example_stream
112 @example_stream example_ = ibook.book1D("EXAMPLE", "Example 1D", 20, 0., 10.);
113 @example_stream example2D_ = ibook.book2D("EXAMPLE_2D", "Example 2D", 20, 0, 20, 15, 0, 15);
114 @example_stream example3D_ = ibook.book3D("EXAMPLE_3D", "Example 3D", 20, 0, 20, 15, 0, 15, 25, 0, 25);
115 @example_stream exampleTProfile_ = ibook.bookProfile("EXAMPLE_TPROFILE", "Example TProfile", 20, 0, 20, 15, 0, 15);
116 @example_stream exampleTProfile2D_ = ibook.bookProfile2D("EXAMPLE_TPROFILE2D", "Example TProfile 2D", 20, 0, 20, 15, 0, 15, 0, 100);
117 @example_stream}
118 
119 @example_globalvoid __class__::dqmAnalyze(edm::Event const& iEvent,
120 @example_global __class_space__ edm::EventSetup const& iSetup,
121 @example_global __class_space__ Histograms___class__ const& histos) const {
122 @example_global histos.histo_->Fill(1.);
125 @example_globalvoid __class__::bookHistograms(DQMStore::IBooker& ibook,
126 @example_global __class_space__ edm::Run const& run,
127 @example_global __class_space__ edm::EventSetup const& iSetup,
128 @example_global __class_space__ Histograms___class__& histos) const {
130 @example_global histos.histo_ = ibook.book1D("EXAMPLE", "EXAMPLE", 10, 0., 10.);
133 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
135  // The following says we do not know what parameters are allowed so do no
136  // validation
137  // Please change this to state exactly what you do use, even if it is no
138  // parameters
140  desc.add<std::string>("folder", "MY_FOLDER");
141  descriptions.add("__class_lowercase__", desc);
142 }
143 
144 // 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:476
std::string folder_
example_stream int eventCount_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
example_stream MonitorElement * exampleTProfile2D_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
__class__()
Definition: Skeleton.cc:29
example_stream MonitorElement * exampleTProfile_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
example_global example_streamclass __class__
example_stream MonitorElement * example3D_
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
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:399
example_global
example_stream MonitorElement * example_
double f[11][100]
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
example_global void dqmAnalyze(edm::Event const &, edm::EventSetup const &, Histograms___class__ const &) const override
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:212
virtual ~__class__()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
example_stream MonitorElement * example2D_
histos
Definition: combine.py:4
HLT enums.
bool include(const CollT &coll, const ItemT &item)
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:367
example_stream example_global example_stream example_stream example_globalstruct Histograms___class__
~__class__() override
Definition: Run.h:45