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/CSCDDUMap.h"
0024 #include "CondFormats/DataRecord/interface/CSCDDUMapRcd.h"
0025 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
0026 
0027 using namespace std;
0028 
0029 namespace edmtest {
0030   class CSCReadDDUMapValuesAnalyzer : public edm::global::EDAnalyzer<> {
0031   public:
0032     explicit CSCReadDDUMapValuesAnalyzer(edm::ParameterSet const& p) : mapToken_{esConsumes()} {}
0033     ~CSCReadDDUMapValuesAnalyzer() override {}
0034     void analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& c) const override;
0035 
0036   private:
0037     edm::ESGetToken<CSCDDUMap, CSCDDUMapRcd> mapToken_;
0038   };
0039 
0040   void CSCReadDDUMapValuesAnalyzer::analyze(edm::StreamID, const edm::Event& e, const edm::EventSetup& context) const {
0041     using namespace edm::eventsetup;
0042 
0043     edm::LogSystem log("CSCDDUMap");
0044     log << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0045     log << " ---EVENT NUMBER " << e.id().event() << std::endl;
0046 
0047     const CSCDDUMap* myDDUMap = &context.getData(mapToken_);
0048 
0049     std::map<int, CSCMapItem::MapItem>::const_iterator it;
0050 
0051     int count = 0;
0052     for (it = myDDUMap->ddu_map.begin(); it != myDDUMap->ddu_map.end(); ++it) {
0053       count = count + 1;
0054       log << "Key: ddu_crate*10+ddu_input " << it->first << std::endl;
0055 
0056       log << count << ") ";
0057       log << it->second.chamberLabel << "  ";
0058       log << it->second.chamberId << "  ";
0059       log << it->second.endcap << "  ";
0060       log << it->second.station << "  ";
0061       log << it->second.ring << "  ";
0062       log << it->second.chamber << "  ";
0063       log << it->second.cscIndex << "  ";
0064       log << it->second.layerIndex << "  ";
0065       log << it->second.stripIndex << "  ";
0066       log << it->second.anodeIndex << "  ";
0067       log << it->second.strips << "  ";
0068       log << it->second.anodes << "  ";
0069       log << it->second.crateLabel << "  ";
0070       log << it->second.crateid << "  ";
0071       log << it->second.sector << "  ";
0072       log << it->second.trig_sector << "  ";
0073       log << it->second.dmb << "  ";
0074       log << it->second.cscid << "  ";
0075       log << it->second.ddu << "  ";
0076       log << it->second.ddu_input << "  ";
0077       log << it->second.slink << "  ";
0078       log << it->second.fed_crate << "  "
0079           << "  ";
0080       log << it->second.ddu_slot << "  "
0081           << "  ";
0082       log << it->second.dcc_fifo << "  "
0083           << "  ";
0084       log << it->second.fiber_crate << "  "
0085           << "  ";
0086       log << it->second.fiber_pos << "  "
0087           << "  ";
0088       log << it->second.fiber_socket << "  " << std::endl;
0089     }
0090   }
0091   DEFINE_FWK_MODULE(CSCReadDDUMapValuesAnalyzer);
0092 }  // namespace edmtest