File indexing completed on 2024-04-06 12:13:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <string>
0020
0021
0022 #include "FWCore/Framework/interface/Frameworkfwd.h"
0023 @example_stream#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0024 @example_global#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
0025
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030
0031 @example_stream#include "DQMServices/Core/interface/MonitorElement.h"
0032 @example_stream
0033
0034
0035
0036
0037 @example_globalstruct Histograms___class__ {
0038 @example_global dqm::reco::MonitorElement* histo_;
0039 @example_global};
0040 @example_global
0041 @example_streamclass __class__ : public DQMEDAnalyzer {
0042 @example_globalclass __class__ : public DQMGlobalEDAnalyzer<Histograms___class__> {
0043 public:
0044 explicit __class__(const edm::ParameterSet&);
0045 ~__class__() override;
0046
0047 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0048
0049 private:
0050 @example_stream void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0051 @example_global void bookHistograms(DQMStore::IBooker&,
0052 @example_global edm::Run const&,
0053 @example_global edm::EventSetup const&,
0054 @example_global Histograms___class__&) const override;
0055
0056 @example_stream void analyze(const edm::Event&, const edm::EventSetup&) override;
0057 @example_global void dqmAnalyze(edm::Event const&, edm::EventSetup const&, Histograms___class__ const&) const override;
0058
0059
0060 std::string folder_;
0061 @example_stream MonitorElement* example_;
0062 @example_stream MonitorElement* example2D_;
0063 @example_stream MonitorElement* example3D_;
0064 @example_stream MonitorElement* exampleTProfile_;
0065 @example_stream MonitorElement* exampleTProfile2D_;
0066 @example_stream int eventCount_ = 0;
0067 };
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 __class__::__class__(const edm::ParameterSet& iConfig)
0081 : folder_(iConfig.getParameter<std::string>("folder")) {
0082
0083 }
0084
0085 __class__::~__class__() {
0086
0087
0088 }
0089
0090
0091
0092
0093
0094
0095 @example_streamvoid __class__::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0096 @example_stream using namespace edm;
0097 @example_stream
0098 @example_stream eventCount_++;
0099 @example_stream
0100 @example_stream example_->Fill(5);
0101 @example_stream example2D_->Fill(eventCount_ / 10, eventCount_ / 10);
0102 @example_stream example3D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
0103 @example_stream exampleTProfile_->Fill(eventCount_ / 10, eventCount_ / 10.f);
0104 @example_stream exampleTProfile2D_->Fill(eventCount_ / 10, eventCount_ / 10, eventCount_ / 10.f);
0105 @example_stream}
0106 @example_stream
0107 @example_streamvoid __class__::bookHistograms(DQMStore::IBooker& ibook,
0108 @example_stream __class_space__ edm::Run const& run,
0109 @example_stream __class_space__ edm::EventSetup const& iSetup) {
0110 @example_stream ibook.setCurrentFolder(folder_);
0111 @example_stream
0112 @example_stream example_ = ibook.book1D("EXAMPLE", "Example 1D", 20, 0., 10.);
0113 @example_stream example2D_ = ibook.book2D("EXAMPLE_2D", "Example 2D", 20, 0, 20, 15, 0, 15);
0114 @example_stream example3D_ = ibook.book3D("EXAMPLE_3D", "Example 3D", 20, 0, 20, 15, 0, 15, 25, 0, 25);
0115 @example_stream exampleTProfile_ = ibook.bookProfile("EXAMPLE_TPROFILE", "Example TProfile", 20, 0, 20, 15, 0, 15);
0116 @example_stream exampleTProfile2D_ = ibook.bookProfile2D("EXAMPLE_TPROFILE2D", "Example TProfile 2D", 20, 0, 20, 15, 0, 15, 0, 100);
0117 @example_stream}
0118
0119 @example_globalvoid __class__::dqmAnalyze(edm::Event const& iEvent,
0120 @example_global __class_space__ edm::EventSetup const& iSetup,
0121 @example_global __class_space__ Histograms___class__ const& histos) const {
0122 @example_global histos.histo_->Fill(1.);
0123 @example_global}
0124 @example_global
0125 @example_globalvoid __class__::bookHistograms(DQMStore::IBooker& ibook,
0126 @example_global __class_space__ edm::Run const& run,
0127 @example_global __class_space__ edm::EventSetup const& iSetup,
0128 @example_global __class_space__ Histograms___class__& histos) const {
0129 @example_global ibook.setCurrentFolder(folder_);
0130 @example_global histos.histo_ = ibook.book1D("EXAMPLE", "EXAMPLE", 10, 0., 10.);
0131 @example_global}
0132 @example_global
0133
0134 void __class__::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0135
0136
0137
0138
0139 edm::ParameterSetDescription desc;
0140 desc.add<std::string>("folder", "MY_FOLDER");
0141 descriptions.add("__class_lowercase__", desc);
0142 }
0143
0144
0145 DEFINE_FWK_MODULE(__class__);