8 edm::LogInfo(
"SiStripFedCablingManipulator") <<
"SiStripFedCablingManipulator constructor " << std::endl;
13 <<
"SiStripFedCablingManipulator::~SiStripFedCablingManipulator()" << std::endl;
27 edm::LogError(
"SiStripFedCablingManipulator") <<
"null pointer obj. nothing will be written " << std::endl;
32 if (openIovAt ==
"beginOfTime")
34 else if (openIovAt ==
"currentTime")
41 edm::LogInfo(
"SiStripFedCablingManipulator") <<
"first request for storing objects with Record " 42 <<
"SiStripFedCablingRcd" 43 <<
" at time " << Time_ << std::endl;
46 edm::LogInfo(
"SiStripFedCablingManipulator") <<
"appending a new object to existing tag " 47 <<
"SiStripFedCablingRcd" 48 <<
" in since mode " << std::endl;
52 edm::LogError(
"SiStripFedCablingManipulator") <<
"Service is unavailable" << std::endl;
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
cond::Time_t beginOfTime() const
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
T getUntrackedParameter(std::string const &, T const &) const
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
~SiStripFedCablingManipulator() override
unsigned long long Time_t
bool isNewTagRequest(const std::string &recordName)
cond::Time_t currentTime() const
Class containning control, module, detector and connection information, at the level of a FED channel...
std::unique_ptr< SiStripFedCabling > manipulate(const SiStripFedCabling &)
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
SiStripFedCablingManipulator(const edm::ParameterSet &iConfig)
Log< level::Info, false > LogInfo
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
edm::ParameterSet iConfig_
void endRun(const edm::Run &run, const edm::EventSetup &es) override
FedsConstIterRange fedIds() const
ConnsConstIterRange fedConnections(uint16_t fed_id) const