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