Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-28 03:09:56

0001 #include "FWCore/Framework/interface/Frameworkfwd.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 
0007 namespace edmtest {
0008 
0009   class UTC_V1
0010       : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::WatchProcessBlock> {
0011   public:
0012     explicit UTC_V1(edm::ParameterSet const& ps) : ev(0) {
0013       identifier = ps.getUntrackedParameter<int>("identifier", 99);
0014     }
0015 
0016     void analyze(edm::Event const&, edm::EventSetup const&) override;
0017 
0018     void beginJob() override;
0019     void beginRun(edm::Run const&, edm::EventSetup const&) override;
0020     void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
0021     void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override {}
0022     void endRun(edm::Run const&, edm::EventSetup const&) override {}
0023 
0024     void beginProcessBlock(edm::ProcessBlock const&) override;
0025     void endProcessBlock(edm::ProcessBlock const&) override;
0026 
0027   private:
0028     int identifier;
0029     int ev;
0030   };
0031 
0032   class UTC_V2 : public edm::one::EDAnalyzer<> {
0033   public:
0034     explicit UTC_V2(edm::ParameterSet const& ps) : ev(0) {
0035       identifier = ps.getUntrackedParameter<int>("identifier", 98);
0036     }
0037 
0038     void analyze(edm::Event const&, edm::EventSetup const&) override;
0039 
0040   private:
0041     int identifier;
0042     int ev;
0043   };
0044 
0045   void UTC_V1::analyze(edm::Event const&, edm::EventSetup const&) {
0046     edm::LogError("cat_A") << "T1 analyze error with identifier " << identifier << " event " << ev;
0047     edm::LogWarning("cat_A") << "T1 analyze warning with identifier " << identifier << " event " << ev;
0048     edm::LogInfo("cat_A") << "T1 analyze info with identifier " << identifier << " event " << ev;
0049     LogDebug("cat_A") << "T1 analyze debug with identifier " << identifier << " event " << ev;
0050     ev++;
0051   }
0052 
0053   void UTC_V1::beginJob() {
0054     edm::LogWarning("cat_BJ") << "T1 beginJob warning with identifier " << identifier << " event " << ev;
0055     LogDebug("cat_BJ") << "T1 beginJob debug with identifier " << identifier << " event " << ev;
0056   }
0057 
0058   void UTC_V1::beginRun(edm::Run const&, edm::EventSetup const&) {
0059     edm::LogInfo("cat_BR") << "T1 beginRun info with identifier " << identifier << " event " << ev;
0060     LogDebug("cat_BR") << "T1 beginRun debug with identifier " << identifier << " event " << ev;
0061   }
0062 
0063   void UTC_V1::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {
0064     edm::LogWarning("cat_BL") << "T1 beginLumi warning with identifier " << identifier << " event " << ev;
0065     LogDebug("cat_BL") << "T1 beginLumi debug with identifier " << identifier << " event " << ev;
0066   }
0067 
0068   void UTC_V1::beginProcessBlock(edm::ProcessBlock const&) {
0069     edm::LogInfo("cat_BPB") << "T1 beginProcessBlock info with identifier " << identifier << " event " << ev;
0070     LogDebug("cat_BPB") << "T1 beginProcessBlock debug with identifier " << identifier << " event " << ev;
0071   }
0072 
0073   void UTC_V1::endProcessBlock(edm::ProcessBlock const&) {
0074     edm::LogInfo("cat_EPB") << "T1 endProcessBlock info with identifier " << identifier << " event " << ev;
0075     LogDebug("cat_EPB") << "T1 endProcessBlock debug with identifier " << identifier << " event " << ev;
0076   }
0077 
0078   void UTC_V2::analyze(edm::Event const&, edm::EventSetup const&) {
0079     edm::LogError("cat_A") << "T1 analyze error with identifier " << identifier << " event " << ev;
0080     edm::LogWarning("cat_A") << "T1 analyze warning with identifier " << identifier << " event " << ev;
0081     edm::LogInfo("cat_A") << "T1 analyze info with identifier " << identifier << " event " << ev;
0082     ev++;
0083   }
0084 
0085 }  // end namespace edmtest
0086 
0087 using edmtest::UTC_V1;
0088 using edmtest::UTC_V2;
0089 DEFINE_FWK_MODULE(UTC_V1);
0090 DEFINE_FWK_MODULE(UTC_V2);