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