58 std::unique_ptr<SiStripFedCabling> oobj;
60 std::ifstream inputFile_;
61 inputFile_.open(
fp.c_str());
63 std::map<uint32_t, std::pair<uint32_t, uint32_t> > dcuDetIdMap;
64 uint32_t dcuid, Olddetid, Newdetid;
69 <<
"::manipulate : since no file is specified, the copy of the input cabling will be applied" << std::endl;
70 oobj = std::make_unique<SiStripFedCabling>(iobj);
71 }
else if (!inputFile_.is_open()) {
72 edm::LogError(
"SiStripFedCablingManipulator") <<
"::manipulate - ERROR in opening file " <<
fp << std::endl;
73 throw cms::Exception(
"CorruptedData") <<
"::manipulate - ERROR in opening file " <<
fp << std::endl;
76 inputFile_ >> dcuid >> Olddetid >> Newdetid;
78 if (!(inputFile_.eof() || inputFile_.fail())) {
79 if (dcuDetIdMap.find(dcuid) == dcuDetIdMap.end()) {
80 edm::LogInfo(
"SiStripFedCablingManipulator") << dcuid <<
" " << Olddetid <<
" " << Newdetid << std::endl;
82 dcuDetIdMap[dcuid] = std::pair<uint32_t, uint32_t>(Olddetid, Newdetid);
85 <<
"::manipulate - ERROR duplicated dcuid " << dcuid << std::endl;
87 <<
"SiStripFedCablingManipulator::manipulate - ERROR duplicated dcuid " << dcuid;
90 }
else if (inputFile_.eof()) {
91 edm::LogInfo(
"SiStripFedCablingManipulator") <<
"::manipulate - END of file reached" << std::endl;
93 }
else if (inputFile_.fail()) {
94 edm::LogError(
"SiStripFedCablingManipulator") <<
"::manipulate - ERROR while reading file" << std::endl;
99 std::map<uint32_t, std::pair<uint32_t, uint32_t> >::const_iterator
it = dcuDetIdMap.begin();
100 for (;
it != dcuDetIdMap.end(); ++
it)
102 <<
"::manipulate - Map " <<
it->first <<
" " <<
it->second.first <<
" " <<
it->second.second;
104 std::vector<FedChannelConnection> conns;
107 for (
auto ifeds =
feds.begin(); ifeds !=
feds.end(); ifeds++) {
109 for (
auto iconn = conns_per_fed.begin(); iconn != conns_per_fed.end(); ++iconn) {
110 std::map<uint32_t, std::pair<uint32_t, uint32_t> >::const_iterator
it = dcuDetIdMap.find(iconn->dcuId());
111 if (
it != dcuDetIdMap.end() &&
it->second.first == iconn->detId()) {
113 <<
"::manipulate - fedid " << *ifeds <<
" dcuid " << iconn->dcuId() <<
" oldDet " << iconn->detId()
114 <<
" newDetID " <<
it->second.second;
127 iconn->fiberLength(),
145 iconn->fiberLength(),
154 oobj = std::make_unique<SiStripFedCabling>(conns);
T getParameter(std::string const &) const
Log< level::Error, false > LogError
Class containning control, module, detector and connection information, at the level of a FED channel...
Log< level::Info, false > LogInfo
edm::ParameterSet iConfig_
FedsConstIterRange fedIds() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const