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 
35 
37 
41 
43 public:
45  ~DTCCablingMapTestReader() override;
46 
47  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
48 
49 private:
50  void beginJob() override;
51  void analyze(const edm::Event&, const edm::EventSetup&) override;
52  void endJob() override;
53 };
54 
56  //The following says we do not know what parameters are allowed so do no validation
57  // Please change this to state exactly what you do use, even if it is no parameters
59  desc.setUnknown();
60  descriptions.add("DTCCablingMapTestReader", desc);
61 }
62 
64 
66 
68  using namespace edm;
69  using namespace std;
70 
72  iSetup.get<TrackerDetToDTCELinkCablingMapRcd>().get(cablingMapHandle);
73  TrackerDetToDTCELinkCablingMap const* p_cablingMap = cablingMapHandle.product();
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
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrackerDetToDTCELinkCablingMap
Definition: TrackerDetToDTCELinkCablingMap.h:29
EDAnalyzer.h
MessageLogger.h
DTCELinkId
Definition: DTCELinkId.h:28
ESHandle.h
DTCCablingMapTestReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: DTCCablingMapTestReader.cc:67
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
TrackerDetToDTCELinkCablingMap.h
TrackerDetToDTCELinkCablingMap::getKnownDTCELinkIds
std::vector< DTCELinkId > getKnownDTCELinkIds() const
Returns a vector containing all elink DTCELinkId nown to the map.
Definition: TrackerDetToDTCELinkCablingMap.cc:48
MakerMacros.h
TrackerDetToDTCELinkCablingMap::detIdToDTCELinkId
std::pair< std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator, std::unordered_multimap< uint32_t, DTCELinkId >::const_iterator > detIdToDTCELinkId(uint32_t const) const
Resolves one or more DTCELinkId of eLinks which are connected to the detector identified by the given...
Definition: TrackerDetToDTCELinkCablingMap.cc:27
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
Service.h
edm::ESHandle
Definition: DTSurvey.h:22
DTCCablingMapTestReader::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: DTCCablingMapTestReader.cc:55
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
TrackerDetToDTCELinkCablingMap::getKnownDetIds
std::vector< uint32_t > getKnownDetIds() const
Returns a vector containing all detector DetId known to the map.
Definition: TrackerDetToDTCELinkCablingMap.cc:60
DTCCablingMapTestReader::~DTCCablingMapTestReader
~DTCCablingMapTestReader() override
Definition: DTCCablingMapTestReader.cc:65
edm::ParameterSet
Definition: ParameterSet.h:36
TrackerDetToDTCELinkCablingMap::dtcELinkIdToDetId
std::unordered_map< DTCELinkId, uint32_t >::const_iterator dtcELinkIdToDetId(DTCELinkId const &) const
Resolves the raw DetId of the detector connected to the eLink identified by a DTCELinkId.
Definition: TrackerDetToDTCELinkCablingMap.cc:12
DTCCablingMapTestReader::DTCCablingMapTestReader
DTCCablingMapTestReader(const edm::ParameterSet &)
Definition: DTCCablingMapTestReader.cc:63
Event.h
DTCCablingMapTestReader::endJob
void endJob() override
Definition: DTCCablingMapTestReader.cc:120
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
DTCCablingMapTestReader::beginJob
void beginJob() override
Definition: DTCCablingMapTestReader.cc:118
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
DTCCablingMapTestReader
Definition: DTCCablingMapTestReader.cc:42
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
TrackerDetToDTCELinkCablingMapRcd.h
EventSetup.h
DTCELinkId.h
ParameterSet.h
edm::Event
Definition: Event.h:73
TrackerDetToDTCELinkCablingMapRcd
Definition: TrackerDetToDTCELinkCablingMapRcd.h:23