Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-08 02:27:20

0001 // Test reading of values from the config file into
0002 // an analyzer. Especially useful for some of the more
0003 // complex data types
0004 
0005 //
0006 // Original Author:  Eric Vaandering
0007 //         Created:  Mon Dec 22 13:43:10 CST 2008
0008 //
0009 //
0010 
0011 // user include files
0012 #include "DataFormats/Provenance/interface/EventRange.h"
0013 #include "DataFormats/Provenance/interface/LuminosityBlockRange.h"
0014 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0015 #include "FWCore/Framework/interface/MakerMacros.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 
0018 // system include files
0019 #include <iostream>
0020 #include <memory>
0021 
0022 //
0023 // class decleration
0024 //
0025 
0026 class TestPSetAnalyzer : public edm::global::EDAnalyzer<> {
0027 public:
0028   explicit TestPSetAnalyzer(edm::ParameterSet const&);
0029 
0030 private:
0031   void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const final;
0032 
0033   edm::LuminosityBlockID testLumi_;
0034   edm::LuminosityBlockRange testLRange_;
0035   edm::EventRange testERange_;
0036 
0037   std::vector<edm::LuminosityBlockID> testVLumi_;
0038   std::vector<edm::LuminosityBlockRange> testVLRange_;
0039   std::vector<edm::EventRange> testVERange_;
0040 
0041   edm::EventID testEventID1_;
0042   edm::EventID testEventID2_;
0043   edm::EventID testEventID3_;
0044   edm::EventID testEventID4_;
0045   std::vector<edm::EventID> testVEventID_;
0046   edm::EventRange testERange1_;
0047   edm::EventRange testERange2_;
0048   edm::EventRange testERange3_;
0049   edm::EventRange testERange4_;
0050   edm::EventRange testERange5_;
0051   std::vector<edm::EventRange> testVERange2_;
0052 
0053   // ----------member data ---------------------------
0054 };
0055 
0056 //
0057 // constants, enums and typedefs
0058 //
0059 
0060 //
0061 // static data member definitions
0062 //
0063 
0064 //
0065 // constructors and destructor
0066 //
0067 TestPSetAnalyzer::TestPSetAnalyzer(edm::ParameterSet const& iConfig) {
0068   testLumi_ = iConfig.getParameter<edm::LuminosityBlockID>("testLumi");
0069   testVLumi_ = iConfig.getParameter<std::vector<edm::LuminosityBlockID> >("testVLumi");
0070   testLRange_ = iConfig.getParameter<edm::LuminosityBlockRange>("testRange");
0071   testVLRange_ = iConfig.getParameter<std::vector<edm::LuminosityBlockRange> >("testVRange");
0072   testERange_ = iConfig.getParameter<edm::EventRange>("testERange");
0073   testVERange_ = iConfig.getParameter<std::vector<edm::EventRange> >("testVERange");
0074 
0075   testEventID1_ = iConfig.getParameter<edm::EventID>("testEventID1");
0076   testEventID2_ = iConfig.getParameter<edm::EventID>("testEventID2");
0077   testEventID3_ = iConfig.getParameter<edm::EventID>("testEventID3");
0078   testEventID4_ = iConfig.getParameter<edm::EventID>("testEventID4");
0079   testVEventID_ = iConfig.getParameter<std::vector<edm::EventID> >("testVEventID");
0080   testERange1_ = iConfig.getParameter<edm::EventRange>("testERange1");
0081   testERange2_ = iConfig.getParameter<edm::EventRange>("testERange2");
0082   testERange3_ = iConfig.getParameter<edm::EventRange>("testERange3");
0083   testERange4_ = iConfig.getParameter<edm::EventRange>("testERange4");
0084   testERange5_ = iConfig.getParameter<edm::EventRange>("testERange5");
0085   testVERange2_ = iConfig.getParameter<std::vector<edm::EventRange> >("testVERange2");
0086 
0087   std::cout << "Lumi PSet test " << testLumi_ << std::endl;
0088   std::cout << "LRange PSet test " << testLRange_ << std::endl;
0089   std::cout << "ERange PSet test " << testERange_ << std::endl;
0090 
0091   for (auto const& i : testVLumi_) {
0092     std::cout << "VLumi PSet test " << i << std::endl;
0093   }
0094 
0095   for (auto const& i : testVLRange_) {
0096     std::cout << "VLRange PSet test " << i << std::endl;
0097   }
0098 
0099   for (auto const& i : testVERange_) {
0100     std::cout << "VERange PSet test " << i << std::endl;
0101   }
0102 
0103   std::cout << "EventID1 PSet test " << testEventID1_ << std::endl;
0104   std::cout << "EventID2 PSet test " << testEventID2_ << std::endl;
0105   std::cout << "EventID3 PSet test " << testEventID3_ << std::endl;
0106   std::cout << "EventID4 PSet test " << testEventID4_ << std::endl;
0107   std::cout << "ERange1 PSet test " << testERange1_ << std::endl;
0108   std::cout << "ERange2 PSet test " << testERange2_ << std::endl;
0109   std::cout << "ERange3 PSet test " << testERange3_ << std::endl;
0110   std::cout << "ERange4 PSet test " << testERange4_ << std::endl;
0111   std::cout << "ERange5 PSet test " << testERange5_ << std::endl;
0112 
0113   for (auto const& i : testVEventID_) {
0114     std::cout << "VEventID PSet test " << i << std::endl;
0115   }
0116 
0117   for (auto const& i : testVERange2_) {
0118     std::cout << "VERange2 PSet test " << i << std::endl;
0119   }
0120 }
0121 
0122 //
0123 // member functions
0124 //
0125 
0126 // ------------ method called to for each event  ------------
0127 void TestPSetAnalyzer::analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const {}
0128 
0129 //define this as a plug-in
0130 DEFINE_FWK_MODULE(TestPSetAnalyzer);