Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:01

0001 /*----------------------------------------------------------------------
0002 
0003 Toy EDProducers and EDProducts for testing purposes only.
0004 
0005 ----------------------------------------------------------------------*/
0006 
0007 #include <stdexcept>
0008 #include <string>
0009 #include <iostream>
0010 #include <fstream>
0011 #include <map>
0012 #include <vector>
0013 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/ESHandle.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/Utilities/interface/ESGetToken.h"
0020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 
0023 #include "CondFormats/CSCObjects/interface/CSCChamberTimeCorrections.h"
0024 #include "CondFormats/DataRecord/interface/CSCChamberTimeCorrectionsRcd.h"
0025 //#include "CondFormats/CSCObjects/interface/CSCMapItem.h"
0026 //#include "OnlineDB/CSCCondDB/interface/CSCCableRead.h"
0027 
0028 using namespace std;
0029 
0030 namespace edmtest {
0031   class CSCReadChamberTimeCorrAnalyzer : public edm::global::EDAnalyzer<> {
0032   public:
0033     explicit CSCReadChamberTimeCorrAnalyzer(edm::ParameterSet const& p) : corrToken_{esConsumes()} {}
0034     ~CSCReadChamberTimeCorrAnalyzer() override {}
0035     void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;
0036 
0037   private:
0038     edm::ESGetToken<CSCChamberTimeCorrections, CSCChamberTimeCorrectionsRcd> corrToken_;
0039   };
0040 
0041   void CSCReadChamberTimeCorrAnalyzer::analyze(edm::StreamID,
0042                                                const edm::Event& e,
0043                                                const edm::EventSetup& context) const {
0044     using namespace edm::eventsetup;
0045 
0046     edm::LogSystem log("CSCCamberTimeCorrections");
0047 
0048     log << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0049     log << " ---EVENT NUMBER " << e.id().event() << std::endl;
0050 
0051     const CSCChamberTimeCorrections* myCorr = &context.getData(corrToken_);
0052 
0053     //    std::map<int,CSCMapItem::MapItem>::const_iterator it;
0054     std::vector<CSCChamberTimeCorrections::ChamberTimeCorrections>::const_iterator it;
0055 
0056     int count = 0;
0057     for (it = myCorr->chamberCorrections.begin(); it != myCorr->chamberCorrections.end(); ++it) {
0058       count = count + 1;
0059       //      log<<"Key: ddu_crate*10+ddu_input "<<it->first<<std::endl;
0060 
0061       log << count << ") ";
0062       //      log<<it->chamber_label<<"  ";
0063       log << it->cfeb_length << "  ";
0064       log << it->cfeb_rev << "  ";
0065       log << it->alct_length << "  ";
0066       log << it->alct_rev << "  ";
0067       log << it->cfeb_tmb_skew_delay << "  ";
0068       log << it->anode_bx_offset << "  ";
0069       log << it->cfeb_timing_corr << "  " << std::endl;
0070     }
0071   }
0072   DEFINE_FWK_MODULE(CSCReadChamberTimeCorrAnalyzer);
0073 }  // namespace edmtest