43 ATH_MSG_DEBUG(
"Conditions updates every event!!! This should be avoided once RegionSelectorTable is fixed!!");
45 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.
fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
46 return StatusCode::SUCCESS;
50 std::unique_ptr<PixelCablingCondData> writeCdo(std::make_unique<PixelCablingCondData>());
53 int barrel_ec{}, eta_module{};
56 uint32_t layer_disk{}, phi_module{};
57 uint32_t robid{}, rodid{};
58 uint32_t sl_40_fmt{}, sl_40_link{}, sl_80_fmt{}, sl_80_link{};
61 uint64_t onlineId = 0;
62 uint64_t linknumber = 0;
72 std::ofstream output_mapping_file_raw;
73 if (moduleData->
getCablingMapToFile()) { output_mapping_file_raw.open(
"pixel_cabling_map_raw.txt"); }
74 std::ofstream output_mapping_file_interpreted;
75 if (moduleData->
getCablingMapToFile()) { output_mapping_file_interpreted.open(
"pixel_cabling_map_interpreted.txt"); }
77 std::stringstream instr;
81 if (readCdo==
nullptr) {
83 return StatusCode::FAILURE;
87 ATH_MSG_DEBUG(
"Size of AthenaAttributeList " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->size());
90 const coral::Blob& blob_cabling=(*readCdo)[
"CablingMapData"].data<coral::Blob>();
91 const char* p_cabling =
static_cast<const char*
>(blob_cabling.startingAddress());
93 unsigned int len_cabling = blob_cabling.size()/
sizeof(char);
94 ATH_MSG_DEBUG(
"blob_cabling.size() = " << blob_cabling.size() <<
", len_cabling = " << len_cabling);
96 instr.str(std::string(p_cabling,blob_cabling.size()));
101 if (filename.empty()) {
102 ATH_MSG_FATAL(
"Mapping File: " << cablingFilename <<
" not found!");
103 return StatusCode::FAILURE;
105 std::ifstream fin(filename.c_str());
106 if (!fin) {
return StatusCode::FAILURE; }
107 instr << fin.rdbuf();
110 ATH_MSG_DEBUG(
"Refilled pixel cabling from file \"" << cablingFilename <<
"\"");
117 while (instr.good() && getline(instr, line)) {
122 if (line.empty()) {
continue; }
123 if (line[0]==
' ' || line[0]==
'#') {
continue; }
126 if (line.length()<21) {
continue; }
129 if (line.substr(line.length()-3,line.length())==
"GMT") {
continue; }
131 std::istringstream
parse(line);
133 parse >> barrel_ec >> layer_disk >> phi_module >> eta_module >> std::hex >> robid >> rodid >> sl_40_fmt >> sl_40_link >> sl_80_fmt >> sl_80_link >> DCSname;
137 output_mapping_file_interpreted << barrel_ec <<
"\t" << layer_disk <<
"\t" << phi_module <<
"\t"
138 << eta_module <<
"\t" << std::hex << robid <<
"\t" << rodid <<
"\t"
139 << sl_40_fmt <<
"\t" << sl_40_link <<
"\t" << sl_80_fmt <<
"\t"
140 << sl_80_link <<
"\t" << DCSname << std::dec << std::endl;
146 ATH_MSG_ERROR(
"Value for layer_disk is insane: "<<layer_disk);
147 return StatusCode::FAILURE;
150 if (!std::in_range<int>(layer_disk) || !std::in_range<int>(phi_module)) {
151 ATH_MSG_ERROR(
"Input value out of range for wafer_id arguments: "
152 <<
"layer_disk=" << layer_disk
153 <<
", phi_module=" << phi_module);
154 return StatusCode::FAILURE;
160 if ((robid & 0xFFFFFF)>=0x140000) {
161 linknumber = sl_40_link | (sl_40_fmt<<4) | (sl_80_link<<8) | (sl_80_fmt<<12);
165 bool readoutSpeed =
false;
166 if (rodReadoutMap.find(rodid)!=rodReadoutMap.end()) { readoutSpeed=rodReadoutMap[rodid]; }
168 if (!readoutSpeed) { linknumber=(sl_40_link & 0xF) | ((sl_40_fmt & 0xF)<<4); }
169 else { linknumber=(sl_80_link & 0xF) | ((sl_80_fmt & 0xF)<<4); }
173 onlineId = (robid & 0xFFFFFF) | (linknumber<<24);
179 if (
m_pixelID->get_hash(offlineId, hashId, &cntxpixel)) {
183 if (hashId>
m_pixelID->wafer_hash_max()) {
184 ATH_MSG_ERROR(
"IdHash overflow! HashId is 0x" << std::hex << hashId);
185 ATH_MSG_ERROR(
"not mapped OfflineID: " << std::hex << offlineId << std::dec <<
" barrel_ec: " << barrel_ec
186 <<
" layer_disk: " << layer_disk <<
" phi_module: " << phi_module <<
" eta_module: " << eta_module);
187 ATH_MSG_ERROR(
"to OnlineID: 0x" << std::hex << onlineId <<
" robid: 0x" << robid <<
" rodid: 0x" << rodid << std::dec
188 <<
" link: 0x" << std::hex <<
" -> Linknumber: 0x" << linknumber <<
" HashId: 0x" << hashId << std::dec);
191 if (eta_module>
m_pixelID->eta_module_max(offlineId) || eta_module<m_pixelID->eta_module_min(offlineId)) {
197 ATH_MSG_ERROR(
"eta_module range exceeded: Got eta_module = " << eta_module
198 <<
", but allowed range is [" <<
m_pixelID->eta_module_min(offlineId)
199 <<
"," <<
m_pixelID->eta_module_max(offlineId) <<
"]");
200 ATH_MSG_ERROR(
"Input geometry tag may not be compatible with mapping file");
204 if (!std::in_range<int>(robid) || !std::in_range<int>(rodid)) [[
unlikely]]{
205 ATH_MSG_ERROR(
"Input value out of range for add_entry_robrod arguments: "
207 <<
", rodid=" << rodid);
208 return StatusCode::FAILURE;
211 writeCdo->add_entry_onoff(onlineId, offlineId);
212 writeCdo->add_entry_offon(offlineId, onlineId);
213 writeCdo->add_entry_offlineList(robid,offlineId);
214 writeCdo->add_entry_offrob(offlineId, robid);
215 writeCdo->add_entry_rodrob(rodid, robid);
216 writeCdo->add_entry_robrod(robid, rodid);
217 writeCdo->add_entry_DCSoffline(DCSname, offlineId);
220 ATH_MSG_DEBUG(
"Mapped offlineID: " << std::hex << offlineId <<
" to onlineID: 0x" << onlineId
221 <<
", robID: 0x" << robid <<
", barrel_ec: " << std::dec << barrel_ec <<
", layer_disk: " << layer_disk
222 <<
", eta_module: " << eta_module <<
", phi_module: " << phi_module <<
", linknumber: 0x" << std::hex << linknumber);
226 output_mapping_file_raw.close();
227 output_mapping_file_interpreted.close();
230 ATH_MSG_DEBUG(
"Size of ROD readoutspeed map: " << rodReadoutMap.size());
231 writeCdo->set_readout_map(std::move(rodReadoutMap));
233 if (writeHandle.
record(std::move(writeCdo)).isFailure()) {
234 ATH_MSG_FATAL(
"Could not record PixelCablingCondData " << writeHandle.
key() <<
" with EventRange " << writeHandle.
getRange() <<
" into Conditions Store");
235 return StatusCode::FAILURE;
237 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
239 return StatusCode::SUCCESS;
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...