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 
33 //
34 // class declaration
35 //
36 
37 @example_globalstruct Histograms___class__ {
40 
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 
50 private:
51 @example_stream void bookHistograms(DQMStore::IBooker &,
52 @example_stream edm::Run const&,
53 @example_stream edm::EventSetup const&) override;
55 @example_global edm::Run const&,
57 @example_global Histograms___class__&) const override;
58 
59 @example_stream void analyze(const edm::Event&, const edm::EventSetup&) override;
62 @example_global Histograms___class__ const&) const override;
63 
64 // ------------ member data ------------
66 @example_stream MonitorElement* example_;
67 @example_stream MonitorElement* example2D_;
68 @example_stream MonitorElement* example3D_;
71 @example_stream int eventCount_ = 0;
72 };
73 
74 //
75 // constants, enums and typedefs
76 //
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86  : folder_(iConfig.getParameter<std::string>("folder")) {
87  // now do what ever initialization is needed
88 }
89 
90 
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 }
95 
96 
97 //
98 // member functions
99 //
100 
101 // ------------ method called for each event ------------
102 @example_streamvoid __class__::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
103 @example_stream using namespace edm;
104 @example_stream
105 @example_stream eventCount_++;
106 @example_stream
107 @example_stream example_->Fill(5);
108 @example_stream example2D_->Fill(eventCount_ / 10, eventCount_ / 10);
109 @example_stream example3D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
110 @example_stream exampleTProfile_->Fill(eventCount_ / 10, eventCount_ / 10.f);
111 @example_stream exampleTProfile2D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
112 @example_stream}
113 @example_stream
114 @example_streamvoid __class__::bookHistograms(DQMStore::IBooker & ibook,
115 @example_stream edm::Run const& run,
116 @example_stream edm::EventSetup const & iSetup) {
117 @example_stream ibook.setCurrentFolder(folder_);
118 @example_stream
119 @example_stream example_ = ibook.book1D("EXAMPLE", "Example 1D", 20, 0., 10.);
120 @example_stream example2D_ = ibook.book2D("EXAMPLE_2D", "Example 2D", 20, 0, 20, 15, 0, 15);
121 @example_stream example3D_ = ibook.book3D("EXAMPLE_3D", "Example 3D", 20, 0, 20, 15, 0, 15, 25, 0, 25);
122 @example_stream exampleTProfile_ = ibook.bookProfile("EXAMPLE_TPROFILE", "Example TProfile", 20, 0, 20, 15, 0, 15);
123 @example_stream exampleTProfile2D_ =ibook.bookProfile2D("EXAMPLE_TPROFILE2D", "Example TProfile 2D", 20, 0, 20, 15, 0, 15, 0, 100);
124 @example_stream}
125 
126 @example_globalvoid __class__::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup const& iSetup,
130 
131 @example_globalvoid __class__::bookHistograms(DQMStore::ConcurrentBooker & ibook,
132 @example_global edm::Run const & run,
133 @example_global edm::EventSetup const & iSetup,
134 @example_global Histograms___class__ & histos) const {
136 @example_global histos.histo_ = ibook.book1D("EXAMPLE", "EXAMPLE", 10, 0., 10.);
138 
139 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
141  // The following says we do not know what parameters are allowed so do no
142  // validation
143  // Please change this to state exactly what you do use, even if it is no
144  // parameters
146  desc.add<std::string>("folder", "MY_FOLDER");
147  descriptions.add("__class_lowercase__", desc);
148 }
149 
150 // define this as a plug-in
std::string folder_
example_stream int eventCount_
example_streamclass __class__
example_stream MonitorElement * exampleTProfile2D_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
example_stream example_global example_stream example_globalstruct Histograms___class__
__class__()
Definition: Skeleton.cc:30
example_stream MonitorElement * exampleTProfile_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void Fill(long long x)
example_stream MonitorElement * example3D_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * bookProfile2D(Args &&...args)
Definition: DQMStore.h:114
example_global void dqmAnalyze(edm::Event const &,@example_global edm::EventSetup const &,@example_global Histograms___class__ const &) const override
example_global
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
example_stream MonitorElement * example_
ConcurrentMonitorElement book1D(Args &&...args)
Definition: DQMStore.h:160
double f[11][100]
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
virtual ~__class__()
void add(std::string const &label, ParameterSetDescription const &psetDescription)
example_stream MonitorElement * example2D_
HLT enums.
bool include(const CollT &coll, const ItemT &item)
MonitorElement * book3D(Args &&...args)
Definition: DQMStore.h:112
~__class__() override
Definition: Run.h:45