|
ATLAS Offline Software
|
Go to the documentation of this file.
11 #include "nlohmann/json.hpp"
13 #include "GeoModelHelpers/throwExcept.h"
39 return StatusCode::SUCCESS;
50 if (wrHdl.isValid()) {
51 ATH_MSG_DEBUG(
"CondHandle " << wrHdl.fullKey() <<
" is already valid."
52 <<
" In theory this should not be called, but may happen"
53 <<
" if multiple concurrent events are being processed out of order.");
54 return StatusCode::SUCCESS;
57 ATH_MSG_DEBUG(
"Range of time/charge output is " << wrHdl.getRange());
60 if (!detMgr.isValid()) {
62 "Failed to retrieve the detector manager from the conditions store "
64 return StatusCode::FAILURE;
66 wrHdl.addDependency(detMgr);
67 std::unique_ptr<NswDcsDbData> wrCdo{std::make_unique<NswDcsDbData>(
m_idHelperSvc.get(), detMgr.cptr())};
97 if (wrHdl.record(std::move(wrCdo)).isFailure()) {
99 <<
" with EventRange " << wrHdl.getRange()
100 <<
" into Conditions Store");
101 return StatusCode::FAILURE;
103 ATH_MSG_DEBUG(
"Recorded new " << wrHdl.key() <<
" with range " << wrHdl.getRange() <<
" into Conditions Store");
105 return StatusCode::SUCCESS;
118 return StatusCode::FAILURE;
121 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
122 ATH_MSG_DEBUG(
"Range of input is " << readHandle.getRange() <<
", range of output is " << writeHandle.
getRange());
126 unsigned int nChns = 0;
127 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
130 const unsigned int chanNum = itr->first;
131 const std::string& chanName = readCdo->chanName(
chanNum);
132 if(chanName.empty()){
141 ATH_MSG_ERROR(
"Could not identify valid channelId for channel "<<
chanNum<<
" with name "<< chanName<<
"!");
142 THROW_EXCEPTION(
"NswDcsDbAlg: Could not identify valid channelId for HV channel");
151 dcs_data.
standbyVolt = *(
static_cast<const float*
>((atr[
"v0Set"]).addressOfData()));
152 dcs_data.readyVolt = *(
static_cast<const float*
>((atr[
"v1Set"]).addressOfData()));
153 dcs_data.fsmState =
MuonCond::getFsmStateEnum(*(
static_cast<const std::string*
>((atr[
"fsmCurrentState"]).addressOfData())));
154 ATH_MSG_DEBUG(
"channel " << chanName <<
" has fsm state " << *(
static_cast<const std::string*
>((atr[
"fsmCurrentState"]).addressOfData()))<<
" has v0 state " << *(
static_cast<const float*
>( (atr[
"v0Set"]).addressOfData()))<<
" has v1 " << *(
static_cast<const float*
>((atr[
"v1Set"]).addressOfData())));
161 return StatusCode::SUCCESS;
173 return StatusCode::FAILURE;
176 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
177 ATH_MSG_DEBUG(
"Range of input is " << readHandle.getRange() <<
", range of output is " << writeHandle.
getRange());
181 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
185 std::string
data = *(
static_cast<const std::string *
>((atr[
"data_array"]).addressOfData()));
189 unsigned int nLB = 0;
192 for (
auto &
yy : jx[
"holes"].
items()) {
202 ATH_MSG_DEBUG(
"Could not identify valid channelId for channel "<<jt[
"channelId"]<<
" with name "<< jt[
"channelName"]<<
"! Skipping...");
206 int channelDead = jt[
"channelDead"];
207 writeCdo->
setDataTDaq(tech,
channelId, jt[
"hole_iovSince"], jt[
"hole_iovUntil"], elink, channelDead );
211 ATH_MSG_VERBOSE(
"Retrieved data for "<<
nLB<<
" entries (combinations of lumi block and channel).");
214 return StatusCode::SUCCESS;
224 return StatusCode::FAILURE;
227 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
228 ATH_MSG_DEBUG(
"Range of input is " << readHandle.getRange() <<
", range of output is " << writeHandle.
getRange());
236 for(itr = readCdo->begin(); itr != readCdo->end(); ++itr) {
239 const unsigned int chanNum = itr->first;
240 const std::string& chanName = readCdo->chanName(
chanNum);
241 if(chanName.empty()){
246 bool online = *(
static_cast<const bool*
>((atr[
"online"]).addressOfData()));
247 ATH_MSG_DEBUG(
"found SCA " << chanName <<
" with status " << atr[
"online"] <<
" " <<
online);
257 return StatusCode::SUCCESS;
267 std::regex reMMG(
"^([A-Za-z]{1})([0-9]{2})_ML([0-9])P([0-9])_(IP|HO)R([0-9])__HV");
268 std::regex reMMD(
"^([A-Za-z]{1})([0-9]{2})_DRIFT_(IP|HO)R([0-9])__HV");
269 std::regex reSTG(
"^([A-Za-z]{1})([0-9]{2})_ML([0-9])_(IP|HO)R([0-9])__HV");
274 if(std::regex_match(chanName, reMMG)) {
278 else if(std::regex_match(chanName, reMMD)) {
282 else if(std::regex_match(chanName, reSTG)) {
287 ATH_MSG_ERROR(
"Could not identify channel with name "<<chanName);
301 std::regex_match(chanName,
m,
re);
304 std::vector<std::string>
res;
305 for(
unsigned int i=0;
i<
m.size(); ++
i)
res.push_back(
m[
i].str());
309 int wheel =
res[1]==
"A"? 1 : -1;
310 int sector = std::stoi(
res[2]);
311 const std::string
stationName = sector%2==0 ?
"MMS" :
"MML";
316 int pcb = std::stoi(
res[4]);
319 ATH_MSG_DEBUG(
"Could not extract valid channelId for MMG channel "<<chanName);
329 int wheel =
res[1]==
"A"? 1 : -1;
330 int sector = std::stoi(
res[2]);
331 const std::string
stationName = sector%2==0 ?
"MMS" :
"MML";
337 ATH_MSG_DEBUG(
"Could not extract valid elementId for MMGD channel "<<chanName);
344 ATH_MSG_DEBUG(
"Could not extract valid multilayerId for MMG channel "<<chanName);
354 int wheel =
res[1]==
"A"? 1 : -1;
355 int sector = std::stoi(
res[2]);
356 const std::string
stationName = sector%2==0 ?
"STS" :
"STL";
364 ATH_MSG_DEBUG(
"Could not extract valid channelId for STG channel "<<chanName);
381 std::regex reMMG(
"^ELink-MM-(A|C)/V([0-9]{1})/L1A/Strip/S([0-9]{1,2})/L([0-9]{1})/R([0-9]{1,2})/E([0-9]{1})");
382 std::regex reSTG(
"^ELink-sTGC-(A|C)/V([0-9]{1})/L1A/(Strip|Pad)/S([0-9]{1,2})/L([0-9]{1})/R([0-9]{1})/E([0-9]{1})");
383 std::regex reSTGTrigProc(
"^ELink-sTGC-A/V0/L1A/TrigProc/");
384 std::regex reSTGPadTrig(
"^ELink-sTGC-A/V0/L1A/PadTrig/");
390 if(std::regex_match(chanName, reMMG)) {
394 else if(std::regex_match(chanName, reSTG)) {
397 }
else if(std::regex_match(chanName, reSTGPadTrig) || std::regex_match(chanName, reSTGTrigProc)){
402 ATH_MSG_DEBUG(
"Could not identify channel with name "<<chanName);
416 std::regex_match(chanName,
m,
re);
419 std::vector<std::string>
res;
420 for(
unsigned int i=0;
i<
m.size(); ++
i)
res.push_back(
m[
i].str());
424 int wheel =
res[1]==
"A"? 1 : -1;
425 int sector = std::stoi(
res[3])+1;
438 elink = std::stoi(
res[6]);
440 ATH_MSG_DEBUG(
"Could not extract valid channelId for MMG channel "<<chanName);
450 int wheel =
res[1]==
"A"? 1 : -1;
451 int sector = std::stoi(
res[4]) + 1;
452 std::string
stationName = sector%2==0 ?
"STS" :
"STL";
466 uint channelType = (
res[3] ==
"Pad" ? sTgcIdHelper::sTgcChannelTypes::Pad : sTgcIdHelper::sTgcChannelTypes::Strip);
469 ATH_MSG_DEBUG(
"Could not extract valid channelId for STG channel "<<chanName);
475 elink = std::stoi(
res[7]);
486 std::regex re(
"^(A|C)_([0-9]{2})_L([0-9])_B([0-9]{2})");
490 if(!std::regex_match(chanName,
re)) {
499 std::regex_match(chanName,
m,
re);
502 std::vector<std::string>
res;
503 for(
unsigned int i=0;
i<
m.size(); ++
i)
res.push_back(
m[
i].str());
506 int wheel =
res[1]==
"A"? 1 : -1;
507 int sector = std::stoi(
res[2])+1;
508 int board = std::stoi(
res[4]);
519 board -= (
layer%2==1 ? 1 : 2);
523 }
else if (board%4==3) {
533 ATH_MSG_WARNING(
"Could not extract valid channelId for MMG channel "<<chanName);
549 else if((
layer&1)==1){
551 channelType=sTgcIdHelper::sTgcChannelTypes::Strip;
553 channelType=sTgcIdHelper::sTgcChannelTypes::Pad;
555 }
else if(
layer%1==0){
557 channelType=sTgcIdHelper::sTgcChannelTypes::Pad;
559 channelType=sTgcIdHelper::sTgcChannelTypes::Strip;
564 ATH_MSG_WARNING(
"Could not extract valid channelId for STG channel "<<chanName);
def retrieve(aClass, aKey=None)
bool buildChannelIdForEltx(Identifier &channelId, const DcsTechType tech0, const std::string &chanName, bool &isOK) const
char data[hepevt_bytes_allocation_ATLAS]
constexpr uint8_t stationPhi
station Phi 1 to 8
void setDataEltx(const DcsTechType tech, const Identifier &chnlId)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
const EventIDRange & getRange() const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
#define ATH_MSG_VERBOSE(x)
bool buildChannelIdForTDaq(Identifier &channelId, uint &elink, const DcsTechType tech0, const std::string &chanName, bool &isOK) const
#define THROW_EXCEPTION(MSG)
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....
readKey_t m_readKey_stg_tdaq
bool buildChannelIdForHv(Identifier &channelId, const DcsTechType tech0, const std::string &chanName, bool &isOK) const
::StatusCode StatusCode
StatusCode definition for legacy code.
std::pair< std::vector< unsigned int >, bool > res
Helper struct to cache all dcs constants in a common place of the memory.
StatusCode loadELTXData(const EventContext &ctx, const readKey_t &readKey, const DcsTechType tech, writeHandleDcs_t &writeHandle, NswDcsDbData *writeCdo) const
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode loadHvData(const EventContext &ctx, const readKey_t &readKey, const DcsTechType tech, writeHandleDcs_t &writeHandle, NswDcsDbData *writeCdo) const
Gaudi::Property< bool > m_loadEltx
void setDataHv(const DcsTechType tech, const Identifier &chnlId, DcsConstants constants)
readKey_t m_readKey_mmg_tdaq
StatusCode initialize(bool used=true)
readKey_t m_readKey_mmg_eltx
virtual StatusCode execute(const EventContext &) const override
readKey_t m_readKey_stg_eltx
#define ATH_MSG_WARNING(x)
ChanAttrListMap::const_iterator const_iterator
const boost::regex re(r_e)
Gaudi::Property< bool > m_loadTdaq
readKey_t m_readKey_mmg_hv
DcsFsmState getFsmStateEnum(const std::string &fsmState)
StatusCode loadTDaqData(const EventContext &ctx, const readKey_t &readKey, const DcsTechType tech, writeHandleDcs_t &writeHandle, NswDcsDbData *writeCdo) const
void setDataTDaq(const DcsTechType tech, const Identifier &chnlId, uint64_t timeSince, uint64_t timeUntil, unsigned int elink, bool permanentlyDisabled)
virtual StatusCode initialize() override
ServiceHandle< ICondSvc > m_condSvc
constexpr uint8_t stationEta
1 to 3
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_muonManagerKey
readKey_t m_readKey_stg_hv
void addDependency(const EventIDRange &range)