|
ATLAS Offline Software
|
Go to the documentation of this file.
24 ATH_MSG_WARNING(
"You have activated the retrieval of the pslope per CSC channel from the COOL database. "
25 <<
"Please make sure that a correct PSLOPE database is in place which uses geometrical CSC hashes in hex format "
26 <<
"as keys and different values of the pslopes for the different CSC channels as values, otherwise please run "
27 <<
"with the ReadPSlopeFromDatabase property set to false");
30 if (!(pslope > 0 && pslope < 1)) {
31 ATH_MSG_FATAL(
"The Pslope cannot be set to a value <=0 or >=1");
32 return StatusCode::FAILURE;
35 <<
"). Please check whether this is really intended.");
49 return StatusCode::SUCCESS;
58 if (writeHandle.isValid()) {
59 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
60 <<
" In theory this should not be called, but may happen"
61 <<
" if multiple concurrent events are being processed out of order.");
62 return StatusCode::SUCCESS;
64 std::unique_ptr<CscCondDbData> writeCdo{std::make_unique<CscCondDbData>()};
87 if (writeHandle.record(std::move(writeCdo)).isFailure()) {
88 ATH_MSG_FATAL(
"Could not record CscCondDbData " << writeHandle.key() <<
" with EventRange " << writeHandle.getRange()
89 <<
" into Conditions Store");
90 return StatusCode::FAILURE;
92 ATH_MSG_DEBUG(
"Recorded new " << writeHandle.key() <<
" with range " << writeHandle.getRange() <<
" into Conditions Store");
94 return StatusCode::SUCCESS;
101 if (readCdo ==
nullptr) {
103 return StatusCode::FAILURE;
107 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
108 ATH_MSG_DEBUG(
"Range of input is " << readHandle.getRange() <<
", range of output is " << writeHandle.
getRange());
111 std::map<Identifier, int> layerMap;
112 int hv_state, lv_state, hv_setpoint0, hv_setpoint1;
113 unsigned int chan_index = 0;
114 for (itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
115 unsigned int chanNum = readCdo->chanNum(chan_index);
116 const std::string& csc_chan_name = readCdo->chanName(
chanNum);
121 hv_state = *(
static_cast<const int*
>((atr[
"HVState"]).addressOfData()));
122 lv_state = *(
static_cast<const int*
>((atr[
"LVState"]).addressOfData()));
123 hv_setpoint0 = *(
static_cast<const int*
>((atr[
"HVSetpoint0"]).addressOfData()));
124 hv_setpoint1 = *(
static_cast<const int*
>((atr[
"HVSetpoint1"]).addressOfData()));
129 if ((hv_state != 1 or lv_state != 1 or hv_setpoint0 < 1000 or hv_setpoint1 < 1000) && !
tokens.empty()) {
131 std::string number_layer =
tokens[1].substr(1, 2);
135 char eta_side =
tokens[0][0];
136 if (eta_side ==
'A')
eta = +1;
137 if (eta_side ==
'C')
eta = -1;
140 char size_side =
tokens[0][1];
145 std::string sector_side =
tokens[0].substr(2, 4);
146 if (sector_side ==
"01" || sector_side ==
"02")
phi = 1;
147 else if (sector_side ==
"03" || sector_side ==
"04")
phi = 2;
148 else if (sector_side ==
"05" || sector_side ==
"06")
phi = 3;
149 else if (sector_side ==
"07" || sector_side ==
"08")
phi = 4;
150 else if (sector_side ==
"09" || sector_side ==
"10")
phi = 5;
151 else if (sector_side ==
"11" || sector_side ==
"12")
phi = 6;
152 else if (sector_side ==
"13" || sector_side ==
"14")
phi = 7;
153 else if (sector_side ==
"15" || sector_side ==
"16")
phi = 8;
157 std::string WireLayerstring = std::string(
chamber_name);
158 WireLayerstring +=
'_';
159 WireLayerstring += eta_side;
160 WireLayerstring +=
'_';
161 WireLayerstring += sector_side;
162 WireLayerstring +=
'_';
163 WireLayerstring +=
layer;
166 int& mapval = layerMap[ChamberId];
174 return StatusCode::SUCCESS;
181 return loadData(writeCdo, *readHandle,
"f001");
188 return loadData(writeCdo, *readHandle,
"noise");
195 return loadData(writeCdo, *readHandle,
"ped");
202 return loadData(writeCdo, *readHandle,
"pslope");
209 return loadData(writeCdo, *readHandle,
"rms");
216 return loadData(writeCdo, *readHandle,
"status");
223 return loadData(writeCdo, *readHandle,
"t0base");
230 return loadData(writeCdo, *readHandle,
"t0phase",
true);
238 for (itr = readCdo->
begin(); itr != readCdo->
end(); ++itr) {
240 std::string
data = atr[
"Data"].data<std::string>();
243 std::istringstream
ss(
data);
253 if (
version ==
"02-00" && parAsm) {
255 ATH_MSG_ERROR(
"Failed caching from COOL string version 02-00 in ASM format");
256 return StatusCode::FAILURE;
258 }
else if (
version ==
"02-00") {
260 ATH_MSG_ERROR(
"Failed caching from COOL string version 02-00");
261 return StatusCode::FAILURE;
266 ATH_MSG_WARNING(
"Don't recognize CSC COOL string version " <<
version <<
". Will treat as default version "
270 ATH_MSG_ERROR(
"Failed caching from COOL string version 02-00 in ASM format");
271 return StatusCode::FAILURE;
275 ATH_MSG_ERROR(
"Failed caching from COOL string version 02-00");
276 return StatusCode::FAILURE;
281 <<
". Currently, only version 02-00 is supported. The keys of the database have to be geometrical CSC hashes "
283 return StatusCode::FAILURE;
288 return StatusCode::SUCCESS;
292 std::istringstream
ss(
data);
293 std::string valueStr;
294 unsigned int chanAddress = 0;
296 bool started =
false;
300 if (valueStr ==
"<END_DATA>")
break;
302 if (valueStr ==
"<BEGIN_DATA>") {
306 if (!started)
continue;
308 std::istringstream iss(valueStr);
311 if (chanAddress == 0) {
312 iss >> std::hex >> chanAddress;
323 return StatusCode::SUCCESS;
327 std::istringstream
ss(
data);
328 std::string valueStr;
329 std::string chanAddress;
330 bool setAddress =
false;
332 bool started =
false;
336 if (valueStr ==
"<END_DATA>")
break;
338 if (valueStr ==
"<BEGIN_DATA>") {
342 if (!started)
continue;
344 std::istringstream iss(valueStr);
356 int asmNum =
atoi(chanAddress.substr(3, 1).c_str());
359 if (chanAddress[5] ==
'A')
361 else if (chanAddress[5] ==
'C')
364 ATH_MSG_FATAL(
"Bad ASMID String in CSC COOL database \"" << chanAddress <<
"\" (wheel " << chanAddress[5] <<
" doesn't exist!");
365 return StatusCode::FAILURE;
371 if (stationPhi < 1 || stationPhi > 8 || stationName < 50 || stationName > 51) {
372 ATH_MSG_FATAL(
"Bad ASMID String in CSC COOL database: \"" << chanAddress <<
"\"");
374 return StatusCode::FAILURE;
377 int chamberLayer = 2;
384 if (!
getAsmScope(asmNum, measuresPhi, layerSince, layerUntil, stripSince, stripUntil).isSuccess()) {
386 return StatusCode::FAILURE;
390 unsigned int index = 0;
393 for (
int iStrip = stripSince; iStrip < stripUntil; iStrip++) {
394 for (
int iLayer = layerSince; iLayer < layerUntil; iLayer++) {
402 static std::atomic<bool> conversionFailPrinted =
false;
404 if (!conversionFailPrinted.load()) {
406 "Failed to retrieve offline identifier from ASM cool "
409 <<
". This is likely due to the fact that the CSCCool "
411 <<
"more entries than the detector layout.");
412 conversionFailPrinted.store(
true);
416 if (
m_idHelperSvc->cscIdHelper().get_channel_hash(chanId, hashIdentifier)) {
420 if (
index == UINT_MAX)
continue;
424 <<
"\nchamberLayer " << chamberLayer <<
"\niLayer " << iLayer
425 <<
"\nmeasuresPhi " << measuresPhi <<
"\niStrip " << iStrip);
437 return StatusCode::SUCCESS;
442 int& stripUntil)
const {
451 }
else if (asmNum == 2) {
457 }
else if (asmNum == 3) {
463 }
else if (asmNum == 4) {
469 }
else if (asmNum == 5) {
476 ATH_MSG_FATAL(
"ASM number \"" << asmNum <<
"\" is invalid. It needs to end in a number from 1-5.");
477 return StatusCode::FAILURE;
479 return StatusCode::SUCCESS;
484 const std::string&
parName)
const {
491 return StatusCode::SUCCESS;
496 ATH_MSG_WARNING(
"recordParameter(): Failed to retrieve channel Identifier hash for Identifier " <<
channelId.get_compact()
497 <<
". Not recording parameter...");
498 return StatusCode::SUCCESS;
507 const std::string&
parName)
const {
528 ATH_MSG_ERROR(
"Cannot extract parameter " <<
parName <<
" for channel hash " << chanHash <<
" from data string '" <<
data <<
"'");
535 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
537 return StatusCode::SUCCESS;
543 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
545 return StatusCode::SUCCESS;
551 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
553 return StatusCode::SUCCESS;
560 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
566 return StatusCode::SUCCESS;
572 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
574 return StatusCode::SUCCESS;
580 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
582 return StatusCode::SUCCESS;
588 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
590 return StatusCode::SUCCESS;
596 if (
getParameter(chanHash, std::move(
data), token).isFailure())
return StatusCode::FAILURE;
598 return StatusCode::SUCCESS;
char data[hepevt_bytes_allocation_ATLAS]
constexpr uint8_t stationPhi
station Phi 1 to 8
const_iterator end() const
StatusCode recordParameterT0Phase(IdentifierHash, std::string, CscCondDbData *) const
Scalar phi() const
phi method
StatusCode recordParameter(unsigned int, const std::string &, CscCondDbData *, const std::string &) const
StatusCode loadDataF001(writeHandle_t &, CscCondDbData *, const EventContext &) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_t0base
Scalar eta() const
pseudorapidity method
void setChannelNoise(IdentifierHash, float)
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
const EventIDRange & getRange() const
Gaudi::Property< bool > m_isOnline
value_type get_compact() const
Get the compact id.
void setChannelPSlope(IdentifierHash, float)
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
StatusCode recordParameterT0Base(IdentifierHash, std::string, CscCondDbData *) const
#define ATH_MSG_VERBOSE(x)
StatusCode recordParameterPed(IdentifierHash, std::string, CscCondDbData *) const
bool empty() const
Test if the key is blank.
This class is a collection of AttributeLists where each one is associated with a channel number....
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_ped
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_hv
StatusCode loadDataPSlope(writeHandle_t &, CscCondDbData *, const EventContext &) const
Gaudi::Property< bool > m_onlineOfflinePhiFlip
An algorithm that can be simultaneously executed in multiple threads.
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Gaudi::Property< float > m_pslope
CscCondDbAlg(const std::string &name, ISvcLocator *svc)
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_noise
StatusCode recordParameterRMS(IdentifierHash, std::string, CscCondDbData *) const
Gaudi::Property< bool > m_isData
void setChannelRMS(IdentifierHash, float)
void setChannelPed(IdentifierHash, float)
Gaudi::Property< bool > m_pslopeFromDB
The pslope is the gain of each CSC channel.
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::WriteCondHandleKey< CscCondDbData > m_writeKey
StatusCode loadDataRMS(writeHandle_t &, CscCondDbData *, const EventContext &) const
StatusCode loadDataNoise(writeHandle_t &, CscCondDbData *, const EventContext &) const
StatusCode cache(const std::string &, CscCondDbData *, const std::string &) const
void setChannelT0Phase(IdentifierHash, bool)
void setChannelStatus(IdentifierHash, int)
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_pslope
void setDeadStation(std::string_view, Identifier)
StatusCode cacheASM(const std::string &, CscCondDbData *, const std::string &) const
void setDeadLayer(std::string_view, Identifier)
StatusCode loadDataStatus(writeHandle_t &, CscCondDbData *, const EventContext &) const
StatusCode loadDataPed(writeHandle_t &, CscCondDbData *, const EventContext &) const
StatusCode getParameter(IdentifierHash chanHash, std::string data, T &token) const
StatusCode initialize(bool used=true)
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_f001
StatusCode loadData(CscCondDbData *, const CondAttrListCollection *, const std::string &, bool=false) const
void setChannelF001(IdentifierHash, float)
StatusCode loadDataHv(writeHandle_t &, CscCondDbData *, const EventContext &) const
StatusCode recordParameterF001(IdentifierHash, std::string, CscCondDbData *) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_t0phase
StatusCode getAsmScope(int, int &, int &, int &, int &, int &) const
StatusCode onlineToOfflineIds(const CscIdHelper *, const unsigned int &, Identifier &, Identifier &) const
virtual StatusCode execute(const EventContext &) const override
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_status
#define ATH_MSG_WARNING(x)
ChanAttrListMap::const_iterator const_iterator
virtual StatusCode initialize() override
StatusCode recordParameterNoise(IdentifierHash, std::string, CscCondDbData *) const
SG::ReadCondHandleKey< CondAttrListCollection > m_readKey_folder_da_rms
StatusCode recordParameterStatus(IdentifierHash, std::string, CscCondDbData *) const
const float m_DEFAULT_PSLOPE
The CSC gain was originally 5.304 ADC counts per fC, but later increased to 5.7 ADC counts per fC,...
StatusCode loadDataT0Phase(writeHandle_t &, CscCondDbData *, const EventContext &) const
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Gaudi::Property< std::string > m_defaultDatabaseReadVersion
constexpr uint8_t stationEta
1 to 3
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
StatusCode recordParameterPSlope(IdentifierHash, std::string, CscCondDbData *) const
StatusCode loadDataT0Base(writeHandle_t &, CscCondDbData *, const EventContext &) const
void setChannelT0Base(IdentifierHash, float)
void addDependency(const EventIDRange &range)