Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-02 03:38:58

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/MakerMacros.h"
0016 
0017 #include "FWCore/Framework/interface/EventSetup.h"
0018 #include "FWCore/Utilities/interface/ESGetToken.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0022 
0023 #include "CondFormats/CSCObjects/interface/CSCChamberTimeCorrections.h"
0024 #include "CondFormats/DataRecord/interface/CSCChamberTimeCorrectionsRcd.h"
0025 
0026 using namespace std;
0027 
0028 namespace edmtest {
0029   class CSCReadChamberTimeCorrectionsValuesAnalyzer : public edm::global::EDAnalyzer<> {
0030   public:
0031     explicit CSCReadChamberTimeCorrectionsValuesAnalyzer(edm::ParameterSet const& p) : token_{esConsumes()} {}
0032     explicit CSCReadChamberTimeCorrectionsValuesAnalyzer(int i) {}
0033     ~CSCReadChamberTimeCorrectionsValuesAnalyzer() override {}
0034     void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;
0035 
0036   private:
0037     edm::ESGetToken<CSCChamberTimeCorrections, CSCChamberTimeCorrectionsRcd> token_;
0038   };
0039 
0040   void CSCReadChamberTimeCorrectionsValuesAnalyzer::analyze(edm::StreamID,
0041                                                             const edm::Event& e,
0042                                                             const edm::EventSetup& context) const {
0043     using namespace edm::eventsetup;
0044 
0045     edm::LogSystem log("CSCChamberTimeCorrections");
0046     log << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0047     log << " ---EVENT NUMBER " << e.id().event() << std::endl;
0048 
0049     const CSCChamberTimeCorrections* myChamberTimeCorrections = &context.getData(token_);
0050 
0051     //    std::map<int,CSCMapItem::MapItem>::const_iterator it;
0052     std::vector<CSCChamberTimeCorrections::ChamberTimeCorrections>::const_iterator it;
0053 
0054     int count = 0;
0055     for (it = myChamberTimeCorrections->chamberCorrections.begin();
0056          it != myChamberTimeCorrections->chamberCorrections.end();
0057          ++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 * 1. / myChamberTimeCorrections->factor_precision << "  ";
0064       log << it->cfeb_rev << "  ";
0065       log << it->alct_length * 1. / myChamberTimeCorrections->factor_precision << "  ";
0066       log << it->cfeb_tmb_skew_delay * 1. / myChamberTimeCorrections->factor_precision << "  ";
0067       log << it->cfeb_timing_corr * 1. / myChamberTimeCorrections->factor_precision << "  ";
0068       log << "delay " << it->cfeb_cable_delay << std::endl;
0069     }
0070   }
0071   DEFINE_FWK_MODULE(CSCReadChamberTimeCorrectionsValuesAnalyzer);
0072 }  // namespace edmtest