Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-14 11:44:45

0001 #include <stdexcept>
0002 #include <string>
0003 #include <iostream>
0004 #include <map>
0005 
0006 #include "CondFormats/Calibration/interface/mySiStripNoises.h"
0007 #include "CondFormats/DataRecord/interface/mySiStripNoisesRcd.h"
0008 
0009 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 
0014 using namespace std;
0015 
0016 namespace edmtest {
0017   class NoisesAnalyzer : public edm::global::EDAnalyzer<> {
0018   public:
0019     explicit NoisesAnalyzer(edm::ParameterSet const& p) : theNoisesToken_(esConsumes()) {
0020       edm::LogPrint("NoisesAnalyzer") << "NoisesAnalyzer";
0021     }
0022     explicit NoisesAnalyzer(int i) { edm::LogPrint("NoisesAnalyzer") << "NoisesAnalyzer " << i; }
0023     virtual ~NoisesAnalyzer() { edm::LogPrint("NoisesAnalyzer") << "~NoisesAnalyzer "; }
0024     void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;
0025 
0026   private:
0027     const edm::ESGetToken<mySiStripNoises, mySiStripNoisesRcd> theNoisesToken_;
0028   };
0029 
0030   void NoisesAnalyzer::analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& context) const {
0031     using namespace edm::eventsetup;
0032     // Context is not used.
0033     edm::LogPrint("NoisesAnalyzer") << " I AM IN RUN NUMBER " << e.id().run();
0034     edm::LogPrint("NoisesAnalyzer") << " ---EVENT NUMBER " << e.id().event();
0035     edm::eventsetup::EventSetupRecordKey recordKey(
0036         edm::eventsetup::EventSetupRecordKey::TypeTag::findType("mySiStripNoisesRcd"));
0037     if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
0038       //record not found
0039       edm::LogPrint("NoisesAnalyzer") << "Record \"mySiStripNoisesRcd\" does not exist";
0040     }
0041     edm::LogPrint("NoisesAnalyzer") << "got context";
0042     auto const& mynoise = &context.getData(theNoisesToken_);
0043     edm::LogPrint("NoisesAnalyzer") << "Noises* " << mynoise;
0044     unsigned int a = mynoise->v_noises.size();
0045     edm::LogPrint("NoisesAnalyzer") << "size a " << a;
0046     unsigned int b = mynoise->indexes.size();
0047     edm::LogPrint("NoisesAnalyzer") << "size b " << b;
0048     /*for(std::vector<mySiStripNoises::DetRegistry>::const_iterator it=mynoise->indexes.begin(); it!=mynoise->indexes.end(); ++it){
0049       std::cout << "  detid  " <<it->detid<< std::endl;
0050       }*/
0051   }
0052   DEFINE_FWK_MODULE(NoisesAnalyzer);
0053 }  // namespace edmtest