CMS 3D CMS Logo

DTCCablingMapTestReader.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CondTools/SiPhase2Tracker
4 // Class: DTCCablingMapTestReader
5 //
13 //
14 // Original Author: Luigi Calligaris, SPRACE, São Paulo, BR
15 // Created : Wed, 27 Feb 2019 21:41:13 GMT
16 //
17 //
18 
19 #include <memory>
20 #include <utility>
21 #include <unordered_map>
22 
23 #include <string>
24 #include <iostream>
25 
34 
36 
40 
42 public:
44  ~DTCCablingMapTestReader() override;
45 
46  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
47 
48 private:
49  void beginJob() override;
50  void analyze(const edm::Event&, const edm::EventSetup&) override;
51  void endJob() override;
52 
53  // ----------member data ---------------------------
55 };
56 
58  //The following says we do not know what parameters are allowed so do no validation
59  // Please change this to state exactly what you do use, even if it is no parameters
61  desc.setUnknown();
62  descriptions.add("DTCCablingMapTestReader", desc);
63 }
64 
66 
68 
70  using namespace edm;
71  using namespace std;
72 
73  const auto p_cablingMap = &iSetup.getData(cablingMapToken_);
74 
75  {
76  ostringstream dump_DetToElink;
77 
78  dump_DetToElink << "Det To DTC ELink map elements dump (Python-style):" << endl;
79  std::vector<uint32_t> const knownDetIds = p_cablingMap->getKnownDetIds();
80 
81  dump_DetToElink << "{";
82  for (uint32_t detId : knownDetIds) {
83  dump_DetToElink << "(" << detId << " : [";
84  auto equal_range = p_cablingMap->detIdToDTCELinkId(detId);
85 
86  for (auto it = equal_range.first; it != equal_range.second; ++it)
87  dump_DetToElink << "(" << unsigned(it->second.dtc_id()) << ", " << unsigned(it->second.gbtlink_id()) << ", "
88  << unsigned(it->second.elink_id()) << "), ";
89 
90  dump_DetToElink << "], ";
91  }
92  dump_DetToElink << "}" << endl;
93 
94  edm::LogInfo("DetToElinkCablingMapDump") << dump_DetToElink.str();
95  }
96 
97  {
98  ostringstream dump_ElinkToDet;
99 
100  dump_ElinkToDet << "DTC Elink To Det map elements dump (Python-style):" << endl;
101  std::vector<DTCELinkId> const knownDTCELinkIds = p_cablingMap->getKnownDTCELinkIds();
102 
103  dump_ElinkToDet << "{";
104  for (DTCELinkId const& currentELink : knownDTCELinkIds) {
105  dump_ElinkToDet << "(" << unsigned(currentELink.dtc_id()) << ", " << unsigned(currentELink.gbtlink_id()) << ", "
106  << unsigned(currentELink.elink_id()) << ") "
107  << " : ";
108  auto detId_it = p_cablingMap->dtcELinkIdToDetId(currentELink);
109 
110  dump_ElinkToDet << detId_it->second << ", ";
111  }
112  dump_ElinkToDet << "}" << endl;
113 
114  edm::LogInfo("DetToElinkCablingMapDump") << dump_ElinkToDet.str();
115  }
116 }
117 
119 
121 
122 //define this as a plug-in
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void analyze(const edm::Event &, const edm::EventSetup &) override
DTCCablingMapTestReader(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Log< level::Info, false > LogInfo
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
const edm::ESGetToken< TrackerDetToDTCELinkCablingMap, TrackerDetToDTCELinkCablingMapRcd > cablingMapToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)