Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-05 02:38:56

0001 
0002 /*----------------------------------------------------------------------
0003 
0004 Toy EDAnalyzer for testing purposes only.
0005 It reads a compact map from ascii file and dumps it as a full map.
0006 
0007 ----------------------------------------------------------------------*/
0008 
0009 #include <stdexcept>
0010 #include <iostream>
0011 #include <fstream>
0012 #include "FWCore/Framework/interface/ESHandle.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 
0015 #include "CondTools/DT/test/stubs/DTFullMapDump.h"
0016 //#include "CondFormats/DTObjects/interface/DTCompactMapAbstractHandler.h"
0017 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0018 //#include "CondTools/DT/interface/DTExpandMap.h"
0019 
0020 namespace edmtest {
0021 
0022   DTFullMapDump::DTFullMapDump(edm::ParameterSet const& p) {
0023     // parameters to setup
0024     fileName = p.getParameter<std::string>("fileName");
0025   }
0026 
0027   DTFullMapDump::DTFullMapDump(int i) {}
0028 
0029   void DTFullMapDump::analyze(const edm::Event& e, const edm::EventSetup& context) {}
0030 
0031   void DTFullMapDump::endJob() {
0032     std::ifstream mapFile(fileName.c_str());
0033     //    DTExpandMap::expandSteering( mapFile );
0034     DTReadOutMapping* compMap = new DTReadOutMapping("rob", "ros");
0035     int ddu;
0036     int ros;
0037     int rob;
0038     int tdc;
0039     int cha;
0040     int whe;
0041     int sta;
0042     int sec;
0043     int qua;
0044     int lay;
0045     int cel;
0046     while (mapFile >> ddu >> ros >> rob >> tdc >> cha >> whe >> sta >> sec >> qua >> lay >> cel) {
0047       //      std::cout << ddu << " "
0048       //                << ros << " "
0049       //                << rob << " "
0050       //                << tdc << " "
0051       //                << cha << " "
0052       //                << whe << " "
0053       //                << sta << " "
0054       //                << sec << " "
0055       //                << qua << " "
0056       //                << lay << " "
0057       //                << cel << std::endl;
0058       compMap->insertReadOutGeometryLink(ddu, ros, rob, tdc, cha, whe, sta, sec, qua, lay, cel);
0059     }
0060 
0061     std::cout << "now expand" << std::endl;
0062     //    std::cout << DTCompactMapAbstractHandler::getInstance() << std::endl;
0063     //    DTReadOutMapping* fullMap =
0064     //                      DTCompactMapAbstractHandler::getInstance()->expandMap(
0065     //                                                   *compMap );
0066     const DTReadOutMapping* fullMap = compMap->fullMap();
0067     std::cout << "done" << std::endl;
0068     DTReadOutMapping::const_iterator iter = fullMap->begin();
0069     DTReadOutMapping::const_iterator iend = fullMap->end();
0070     while (iter != iend) {
0071       const DTReadOutGeometryLink& link = *iter++;
0072       std::cout << link.dduId << " " << link.rosId << " " << link.robId << " " << link.tdcId << " " << link.channelId
0073                 << " " << link.wheelId << " " << link.stationId << " " << link.sectorId << " " << link.slId << " "
0074                 << link.layerId << " " << link.cellId << std::endl;
0075     }
0076   }
0077 
0078   DEFINE_FWK_MODULE(DTFullMapDump);
0079 }  // namespace edmtest