Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 
0002 /*----------------------------------------------------------------------
0003 
0004 Toy EDAnalyzer for testing purposes only.
0005 It gets a compact map from the EventSetup and dumps it as a full map.
0006 
0007 ----------------------------------------------------------------------*/
0008 
0009 #include <stdexcept>
0010 #include <string>
0011 #include <iostream>
0012 #include <map>
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Framework/interface/MakerMacros.h"
0015 
0016 #include "CondFormats/DTObjects/test/stubs/DTFullMapPrint.h"
0017 
0018 namespace edmtest {
0019 
0020   DTFullMapPrint::DTFullMapPrint(edm::ParameterSet const& p) : es_token(esConsumes()) {}
0021 
0022   DTFullMapPrint::DTFullMapPrint(int i) {}
0023 
0024   void DTFullMapPrint::analyze(const edm::Event& e, const edm::EventSetup& context) {
0025     using namespace edm::eventsetup;
0026     // Context is not used.
0027     std::cout << " I AM IN RUN NUMBER " << e.id().run() << std::endl;
0028     std::cout << " ---EVENT NUMBER " << e.id().event() << std::endl;
0029     const auto& dbMap = context.getData(es_token);
0030     const DTReadOutMapping* ro_map = dbMap.fullMap();
0031     std::cout << ro_map->mapCellTdc() << " - " << ro_map->mapRobRos() << std::endl;
0032     std::cout << std::distance(ro_map->begin(), ro_map->end()) << " connections in the map" << std::endl;
0033     DTReadOutMapping::const_iterator iter = ro_map->begin();
0034     DTReadOutMapping::const_iterator iend = ro_map->end();
0035     while (iter != iend) {
0036       const DTReadOutGeometryLink& link = *iter++;
0037       std::cout << link.dduId << " " << link.rosId << " " << link.robId << " " << link.tdcId << " " << link.channelId
0038                 << " " << link.wheelId << " " << link.stationId << " " << link.sectorId << " " << link.slId << " "
0039                 << link.layerId << " " << link.cellId << std::endl;
0040     }
0041   }
0042   DEFINE_FWK_MODULE(DTFullMapPrint);
0043 }  // namespace edmtest