Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-14 00:04:40

0001 // -*- C++ -*-
0002 //
0003 // Package:    __subsys__/__pkgname__
0004 // Class:      __class__
0005 //
0006 /**\class __class__ __class__.cc __subsys__/__pkgname__/plugins/__class__.cc
0007 
0008  Description: [one line class summary]
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  __author__
0015 //         Created:  __date__
0016 //
0017 //
0018 
0019 #include <string>
0020 
0021 // user include files
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 // class declaration
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   // ------------ member data ------------
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 // constants, enums and typedefs
0071 //
0072 
0073 //
0074 // static data member definitions
0075 //
0076 
0077 //
0078 // constructors and destructor
0079 //
0080 __class__::__class__(const edm::ParameterSet& iConfig)
0081     : folder_(iConfig.getParameter<std::string>("folder")) {
0082   // now do what ever initialization is needed
0083 }
0084 
0085 __class__::~__class__() {
0086   // do anything here that needs to be done at desctruction time
0087   // (e.g. close files, deallocate resources etc.)
0088 }
0089 
0090 //
0091 // member functions
0092 //
0093 
0094 // ------------ method called for each event  ------------
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 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0134 void __class__::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0135   // The following says we do not know what parameters are allowed so do no
0136   // validation
0137   // Please change this to state exactly what you do use, even if it is no
0138   // parameters
0139   edm::ParameterSetDescription desc;
0140   desc.add<std::string>("folder", "MY_FOLDER");
0141   descriptions.add("__class_lowercase__", desc);
0142 }
0143 
0144 // define this as a plug-in
0145 DEFINE_FWK_MODULE(__class__);