|
ATLAS Offline Software
|
Go to the documentation of this file.
6 #include "GaudiKernel/EventIDRange.h"
14 #include "Identifier/Identifier.h"
16 #include "CoralBase/Blob.h"
35 return StatusCode::SUCCESS;
42 ATH_MSG_DEBUG(
"Conditions updates every event!!! This should be avoided once RegionSelectorTable is fixed!!");
44 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.");
45 return StatusCode::SUCCESS;
49 std::unique_ptr<PixelCablingCondData> writeCdo(std::make_unique<PixelCablingCondData>());
52 int barrel_ec, eta_module;
57 uint32_t sl_40_fmt, sl_40_link, sl_80_fmt, sl_80_link;
71 std::ofstream output_mapping_file_raw;
72 if (moduleData->
getCablingMapToFile()) { output_mapping_file_raw.open(
"pixel_cabling_map_raw.txt"); }
73 std::ofstream output_mapping_file_interpreted;
74 if (moduleData->
getCablingMapToFile()) { output_mapping_file_interpreted.open(
"pixel_cabling_map_interpreted.txt"); }
76 std::stringstream instr;
80 if (readCdo==
nullptr) {
82 return StatusCode::FAILURE;
86 ATH_MSG_DEBUG(
"Size of AthenaAttributeList " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->size());
90 const char* p_cabling =
static_cast<const char*
>(blob_cabling.startingAddress());
92 unsigned int len_cabling = blob_cabling.size()/
sizeof(
char);
93 ATH_MSG_DEBUG(
"blob_cabling.size() = " << blob_cabling.size() <<
", len_cabling = " << len_cabling);
95 instr.str(std::string(p_cabling,blob_cabling.size()));
101 ATH_MSG_FATAL(
"Mapping File: " << cablingFilename <<
" not found!");
102 return StatusCode::FAILURE;
105 if (!
fin) {
return StatusCode::FAILURE; }
106 instr <<
fin.rdbuf();
109 ATH_MSG_DEBUG(
"Refilled pixel cabling from file \"" << cablingFilename <<
"\"");
116 while (instr.good() && getline(instr,
line)) {
121 if (
line.empty()) {
continue; }
122 if (
line[0]==
' ' ||
line[0]==
'#') {
continue; }
125 if (
line.length()<21) {
continue; }
128 if (
line.substr(
line.length()-3,
line.length())==
"GMT") {
continue; }
131 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;
135 output_mapping_file_interpreted << barrel_ec <<
"\t" << layer_disk <<
"\t" << phi_module <<
"\t"
136 << eta_module <<
"\t" << std::hex << robid <<
"\t" << rodid <<
"\t"
137 << sl_40_fmt <<
"\t" << sl_40_link <<
"\t" << sl_80_fmt <<
"\t"
138 << sl_80_link <<
"\t" << DCSname << std::dec << std::endl;
145 if ((robid & 0xFFFFFF)>=0x140000) {
146 linknumber = sl_40_link | (sl_40_fmt<<4) | (sl_80_link<<8) | (sl_80_fmt<<12);
150 bool readoutSpeed =
false;
151 if (rodReadoutMap.find(rodid)!=rodReadoutMap.end()) { readoutSpeed=rodReadoutMap[rodid]; }
153 if (!readoutSpeed) { linknumber=(sl_40_link & 0xF) | ((sl_40_fmt & 0xF)<<4); }
154 else { linknumber=(sl_80_link & 0xF) | ((sl_80_fmt & 0xF)<<4); }
158 onlineId = (robid & 0xFFFFFF) | (linknumber<<24);
169 ATH_MSG_ERROR(
"IdHash overflow! HashId is 0x" << std::hex << hashId);
170 ATH_MSG_ERROR(
"not mapped OfflineID: " << std::hex << offlineId << std::dec <<
" barrel_ec: " << barrel_ec
171 <<
" layer_disk: " << layer_disk <<
" phi_module: " << phi_module <<
" eta_module: " << eta_module);
172 ATH_MSG_ERROR(
"to OnlineID: 0x" << std::hex << onlineId <<
" robid: 0x" << robid <<
" rodid: 0x" << rodid << std::dec
173 <<
" link: 0x" << std::hex <<
" -> Linknumber: 0x" << linknumber <<
" HashId: 0x" << hashId << std::dec);
182 ATH_MSG_ERROR(
"eta_module range exceeded: Got eta_module = " << eta_module
185 ATH_MSG_ERROR(
"Input geometry tag may not be compatible with mapping file");
200 ATH_MSG_DEBUG(
"Mapped offlineID: " << std::hex << offlineId <<
" to onlineID: 0x" << onlineId
201 <<
", robID: 0x" << robid <<
", barrel_ec: " << std::dec << barrel_ec <<
", layer_disk: " << layer_disk
202 <<
", eta_module: " << eta_module <<
", phi_module: " << phi_module <<
", linknumber: 0x" << std::hex << linknumber);
206 output_mapping_file_raw.close();
207 output_mapping_file_interpreted.close();
210 ATH_MSG_DEBUG(
"Size of ROD readoutspeed map: " << rodReadoutMap.size());
213 if (writeHandle.
record(std::move(writeCdo)).isFailure()) {
214 ATH_MSG_FATAL(
"Could not record PixelCablingCondData " << writeHandle.
key() <<
" with EventRange " << writeHandle.
getRange() <<
" into Conditions Store");
215 return StatusCode::FAILURE;
217 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.
key() <<
" with range " << writeHandle.
getRange() <<
" into Conditions Store");
219 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
SG::WriteCondHandleKey< PixelCablingCondData > m_writeKey
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override final
Create hash id from compact id (return == 0 for OK)
PixelCablingCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
const EventIDRange & getRange()
const DataObjID & fullKey() const
const EventIDRange & getRange() const
void add_entry_offrob(const Identifier, const uint32_t)
void add_entry_onoff(const uint64_t, const Identifier)
void add_entry_DCSoffline(const std::string &, const Identifier)
SG::ReadCondHandleKey< PixelModuleData > m_moduleDataKey
bool empty() const
Test if the key is blank.
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const std::string & getCablingMapFileName() const
int eta_module_max(const Identifier &id) const
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
An algorithm that can be simultaneously executed in multiple threads.
const DataObjID & fullKey() const
void add_entry_robrod(int robid, int rodid)
::StatusCode StatusCode
StatusCode definition for legacy code.
const PixelID * m_pixelID
static EventIDRange infiniteRunLB()
Produces an EventIDRange that is infinite in RunLumi and invalid in Time.
SG::ReadCondHandleKey< PixelReadoutSpeedData > m_readoutspeedKey
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
const std::string & key() const
void add_entry_rodrob(int rodid, int robid)
StatusCode initialize(bool used=true)
size_type wafer_hash_max(void) const
void set_readout_map(std::map< uint32_t, bool > rodReadoutMap)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
int eta_module_min(const Identifier &id) const
IdContext wafer_context(void) const
virtual StatusCode initialize() override final
#define ATH_MSG_WARNING(x)
bool getCablingMapToFile() const
void add_entry_offon(const Identifier, const uint64_t)
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
virtual StatusCode execute(const EventContext &ctx) const override final
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
void add_entry_offlineList(const uint32_t, const Identifier)
void addDependency(const EventIDRange &range)