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 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, edm::Run const& run, edm::EventSetup const& iSetup) {
108 @example_stream ibook.setCurrentFolder(folder_);
109 @example_stream
110 @example_stream example_ = ibook.book1D("EXAMPLE", "Example 1D", 20, 0., 10.);
111 @example_stream example2D_ = ibook.book2D("EXAMPLE_2D", "Example 2D", 20, 0, 20, 15, 0, 15);
112 @example_stream example3D_ = ibook.book3D("EXAMPLE_3D", "Example 3D", 20, 0, 20, 15, 0, 15, 25, 0, 25);
113 @example_stream exampleTProfile_ = ibook.bookProfile("EXAMPLE_TPROFILE", "Example TProfile", 20, 0, 20, 15, 0, 15);
114 @example_stream exampleTProfile2D_ = ibook.bookProfile2D("EXAMPLE_TPROFILE2D", "Example TProfile 2D", 20, 0, 20, 15, 0, 15, 0, 100);
115 @example_stream}
116 
117 @example_globalvoid __class__::dqmAnalyze(edm::Event const& iEvent,
118 @example_global edm::EventSetup const& iSetup,
120 @example_global histos.histo_->Fill(1.);
123 
124 @example_globalvoid __class__::bookHistograms(DQMStore::IBooker& ibook,
125 @example_global edm::Run const& run,
126 @example_global edm::EventSetup const& iSetup,
129 @example_global histos.histo_ = ibook.book1D("EXAMPLE", "EXAMPLE", 10, 0., 10.);
131 
132 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
134  // The following says we do not know what parameters are allowed so do no
135  // validation
136  // Please change this to state exactly what you do use, even if it is no
137  // parameters
139  desc.add<std::string>("folder", "MY_FOLDER");
140  descriptions.add("__class_lowercase__", desc);
141 }
142 
143 // define this as a plug-in
dqm::impl::MonitorElement
Definition: MonitorElement.h:99
__class__::__class__
__class__()
Definition: Skeleton.cc:29
bookHistograms
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
example2D_
example_stream MonitorElement * example2D_
Definition: DQMEDAnalyzer.cc:62
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::IBooker::bookProfile2D
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
exampleTProfile_
example_stream MonitorElement * exampleTProfile_
Definition: DQMEDAnalyzer.cc:64
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
MakerMacros.h
__class__
Definition: c++11.h:13
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
dqm::implementation::IBooker::bookProfile
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
dqmAnalyze
example_global void dqmAnalyze(edm::Event const &, edm::EventSetup const &, Histograms___class__ const &) const override
eventCount_
example_stream int eventCount_
Definition: DQMEDAnalyzer.cc:66
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
folder_
std::string folder_
Definition: DQMEDAnalyzer.cc:60
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
Histograms___class__
example_stream example_global example_stream example_globalstruct Histograms___class__
Definition: DQMEDAnalyzer.cc:37
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
exampleTProfile2D_
example_stream MonitorElement * exampleTProfile2D_
Definition: DQMEDAnalyzer.cc:65
~__class__
~__class__() override
__class__
example_streamclass __class__
Definition: DQMEDAnalyzer.cc:44
iEvent
int iEvent
Definition: GenABIO.cc:224
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:58
__class__::~__class__
virtual ~__class__()
Definition: DQMEDAnalyzer.cc:85
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
combine.histos
histos
Definition: combine.py:4
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
__class__::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: DQMEDAnalyzer.cc:133
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
Frameworkfwd.h
dqm::implementation::IBooker::book2D
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
dqm::implementation::IBooker::book3D
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
dqm::implementation::IBooker
Definition: DQMStore.h:43
include
bool include(const CollT &coll, const ItemT &item)
Definition: EcalDetIdToBeRecoveredProducer.cc:71
DQMGlobalEDAnalyzer
Definition: DQMGlobalEDAnalyzer.h:76
ParameterSet.h
edm::Event
Definition: Event.h:73
example_global
example_global
Definition: DQMEDAnalyzer.cc:39
__class__::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DQMEDAnalyzer.cc:95
example3D_
example_stream MonitorElement * example3D_
Definition: DQMEDAnalyzer.cc:63
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
example_
example_stream MonitorElement * example_
Definition: DQMEDAnalyzer.cc:61