27 ISvcLocator* pSvcLocator ) :
28 base_class( name, pSvcLocator ),
59 declareProperty(
"HV_WarningValueLow",
m_HVWarnValHi = 2000. );
60 declareProperty(
"HV_WarningValueHigh",
m_HVWarnValLo = 1000. );
61 declareProperty(
"HWMapSvc",
m_mapSvc );
66 declareProperty(
"DetectorStore",
m_detStore );
69 ATH_MSG_WARNING(
"DoIOVChecking is deprecated and does nothing. Please remove from your job options configuration." );
73 m_evtBA.push_back(-1);
74 m_evtEA.push_back(-1);
75 m_evtEC.push_back(-1);
76 m_Barrel_HV_COOLCont.push_back(
nullptr);
77 m_EndcapA_HV_COOLCont.push_back(
nullptr);
78 m_EndcapC_HV_COOLCont.push_back(
nullptr);
90 if (msgLvl(MSG::DEBUG))
msg() <<
"Initialize." <<
endmsg;
91 StatusCode
sc(StatusCode::SUCCESS);
95 if (
sc.isFailure() ) {
99 if (
sc.isFailure() ) {
111 if (
sc.isFailure() ) {
112 ATH_MSG_ERROR(
"Unable to retrieve pointer to TRT ID Helper." );
118 if (
sc.isFailure() ) {
130 StatusCode
sc(StatusCode::SUCCESS);
133 InDet::TRT_DCS_ValueType theVoltage = -10.;
134 sc =
getValue( ident, InDet::TRT_DCS_HV_VOLTAGE, theVoltage );
135 if (
sc.isFailure() ) {
138 return InDet::TRT_DCS_NOINFO;
140 if ( theVoltage < m_HVWarnValLo || theVoltage >
m_HVWarnValHi ) {
143 return InDet::TRT_DCS_RED;
147 return InDet::TRT_DCS_GREEN;
154 InDet::TRT_DCS_DataType dataType,
155 InDet::TRT_DCS_ValueType& theValue ) {
156 StatusCode
sc(StatusCode::SUCCESS);
166 if ( dataType == InDet::TRT_DCS_HV_VOLTAGE ) {
169 std::string folderName =
"";
173 if ( folderName.empty() ) {
175 return StatusCode::FAILURE;
180 chanNum =
m_mapSvc->get_HV_CoolChanNum( ident );
183 << barrel_ec <<
"," << phi_slice <<
"," << module_or_wheel <<
","
184 << straw_layer <<
"," << straw );
188 sc =
getValue( folderName, chanNum, theValue );
189 if (
sc.isFailure() ) {
193 std::string chanName =
"";
194 chanName =
m_mapSvc->get_HV_CoolChanName( ident );
195 if ( chanName.empty() ) {
197 << barrel_ec <<
"," << phi_slice <<
"," << module_or_wheel <<
","
198 << straw_layer <<
"," << straw );
199 return StatusCode::FAILURE;
202 sc =
getValue( folderName, chanName, theValue );
203 if (
sc.isFailure() ) {
207 }
else return StatusCode::FAILURE;
212 return StatusCode::FAILURE;
222 const std::string & chanName,
223 InDet::TRT_DCS_ValueType& theValue ) {
224 StatusCode
sc(StatusCode::SUCCESS);
234 if ( !DCScondFolder ) {
236 if (
sc.isFailure() ) {
238 <<
" from DetectorStore. Has it been loaded into IOVDbSvc?" );
239 return StatusCode::FAILURE;
242 if ( !DCScondFolder )
return StatusCode::FAILURE;
248 <<
" in its ChanNameMap. Won't be able to get channel numbers." );
250 for ( chanNameMapItr = DCScondFolder->
name_begin();
251 chanNameMapItr != DCScondFolder->
name_end(); ++chanNameMapItr ) {
252 if ( (*chanNameMapItr).second == chanName ) {
253 chanNum = (*chanNameMapItr).first;
261 if ( chanAttrListPair == DCScondFolder->
end() ) {
263 <<
" not found in folder " << foldername
264 <<
" for this IOV." );
265 return StatusCode::FAILURE;
270 theValue = attrList[
"OUTPUTVOLTAGE_VALUE"].data<InDet::TRT_DCS_ValueType>();
280 InDet::TRT_DCS_ValueType& theValue ) {
290 if ( !DCScondFolder ) {
291 StatusCode
sc =
m_detStore->retrieve( DCScondFolder, foldername );
292 if (
sc.isFailure() ) {
294 <<
" from DetectorStore. Has it been loaded into IOVDbSvc?" );
298 if ( !DCScondFolder )
return StatusCode::FAILURE;
302 if ( chanAttrListPair == DCScondFolder->
end() ) {
304 <<
" not found in folder " << foldername
305 <<
" for this IOV." );
306 return StatusCode::FAILURE;
311 theValue = attrList[
"OUTPUTVOLTAGE_VALUE"].data<InDet::TRT_DCS_ValueType>();
313 return StatusCode::SUCCESS;
321 InDet::TRT_CondFlag condFlag(InDet::TRT_COND_NOINFO);
322 InDet::TRT_DCS_StatusFlag theFlag =
getFlag( ident );
324 if ( theFlag == InDet::TRT_DCS_GREEN ) condFlag = InDet::TRT_COND_GOOD;
325 if ( theFlag == InDet::TRT_DCS_RED ) condFlag = InDet::TRT_COND_BAD;
333 std::string chanName =
m_mapSvc->get_HV_CoolChanName( ident );
335 ATH_MSG_VERBOSE(
"Channel " << det <<
" " <<
phi <<
" " << lay <<
" " << strawLay <<
" " << straw <<
" on line " << chanName <<
" has flag " << theFlag);
347 ATH_MSG_INFO(
"If these are suspicious numbers, turn on VERBOSE output and set VeryVerbose=True to see more info." );
352 TFile* outFile =
new TFile(
"TRT_DCS_Monitoring.root",
"RECREATE");
353 bool file = outFile->cd();
367 return StatusCode::SUCCESS;
374 const EventContext& event_context=Gaudi::Hive::currentContext();
375 EventContext::ContextID_t slot=event_context.slot();
376 EventContext::ContextEvt_t event_id=event_context.evt();
379 if(slot>=m_evtBA.size()) {
380 m_evtBA.resize(slot+1);
381 m_Barrel_HV_COOLCont.resize(slot+1);
383 if(m_evtBA[slot]!=event_id) {
385 m_evtBA[slot]=event_id;
386 m_Barrel_HV_COOLCont[slot]=(*rst);
389 return m_Barrel_HV_COOLCont[slot];
392 if(slot>=m_evtEA.size()) {
393 m_evtEA.resize(slot+1);
394 m_EndcapA_HV_COOLCont.resize(slot+1);
396 if(m_evtEA[slot]!=event_id) {
398 m_evtEA[slot]=event_id;
399 m_EndcapA_HV_COOLCont[slot]=(*rst);
402 return m_EndcapA_HV_COOLCont[slot];
405 if(slot>=m_evtEC.size()) {
406 m_evtEC.resize(slot+1);
407 m_EndcapC_HV_COOLCont.resize(slot+1);
409 if(m_evtEC[slot]!=event_id) {
411 m_evtEC[slot]=event_id;
412 m_EndcapC_HV_COOLCont[slot]=(*rst);
415 return m_EndcapC_HV_COOLCont[slot];
418 ATH_MSG_WARNING(
" TRT DCS HV folder requested with bad folder name " );
428 StatusCode
sc(StatusCode::SUCCESS);
436 <<
" from StoreGate." );
455 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
456 std::string chanName( (*chanNameMapItr).second );
457 int chanNum( (*chanNameMapItr).first );
467 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
468 std::string chanName( (*chanNameMapItr).second );
469 int chanNum( (*chanNameMapItr).first );
470 InDet::TRT_DCS_StatusFlag theFlag;
471 InDet::TRT_DCS_ValueType theVoltage = -10.;
473 if (
sc.isFailure() ) theFlag = InDet::TRT_DCS_NOINFO;
474 else if ( theVoltage < m_HVWarnValLo || theVoltage >
m_HVWarnValHi ) theFlag = InDet::TRT_DCS_RED;
475 else theFlag = InDet::TRT_DCS_GREEN;
488 StatusCode
sc(StatusCode::SUCCESS);
496 <<
" from StoreGate." );
515 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
516 std::string chanName( (*chanNameMapItr).second );
517 int chanNum( (*chanNameMapItr).first );
525 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
526 std::string chanName( (*chanNameMapItr).second );
527 int chanNum( (*chanNameMapItr).first );
528 InDet::TRT_DCS_StatusFlag theFlag;
529 InDet::TRT_DCS_ValueType theVoltage = -10.;
531 if (
sc.isFailure() ) theFlag = InDet::TRT_DCS_NOINFO;
532 else if ( theVoltage < m_HVWarnValLo || theVoltage >
m_HVWarnValHi ) theFlag = InDet::TRT_DCS_RED;
533 else theFlag = InDet::TRT_DCS_GREEN;
544 StatusCode
sc(StatusCode::SUCCESS);
552 <<
" from StoreGate." );
571 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
572 std::string chanName( (*chanNameMapItr).second );
573 int chanNum( (*chanNameMapItr).first );
581 chanNameMapItr != clc->
name_end(); ++chanNameMapItr ) {
582 std::string chanName( (*chanNameMapItr).second );
583 int chanNum( (*chanNameMapItr).first );
584 InDet::TRT_DCS_StatusFlag theFlag;
585 InDet::TRT_DCS_ValueType theVoltage = -10.;
587 if (
sc.isFailure() ) theFlag = InDet::TRT_DCS_NOINFO;
588 else if ( theVoltage < m_HVWarnValLo || theVoltage >
m_HVWarnValHi ) theFlag = InDet::TRT_DCS_RED;
589 else theFlag = InDet::TRT_DCS_GREEN;
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Handle class for reading from StoreGate.
Service to provide a simple Athena interface to read DCS conditions data from COOL author Denver Whit...
This is an Identifier helper class for the TRT subdetector.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
name_const_iterator name_begin() const
Access to Chan/Name pairs via iterators.
name_size_type name_size() const
number of Chan/Name pairs
name_const_iterator name_end() const
ChanAttrListMap::const_iterator const_iterator
ChanNameMap::const_iterator name_const_iterator
const_iterator chanAttrListPair(ChanNum chanNum) const
Access to Chan/AttributeList pairs via channel number: returns map iterator.
coral::AttributeList AttributeList
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::string m_EndcapC_HV_COOLFolderName
TH1D * m_h_EndcapA_nNOINFO
ServiceHandle< ICondSvc > m_condSvc
std::string m_Barrel_HV_COOLFolderName
TRT_DCS_ConditionsSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor //.
SG::ReadCondHandleKey< CondAttrListCollection > m_barrelReadKey
ServiceHandle< ITRT_HWMappingSvc > m_mapSvc
TH1D * m_h_EndcapC_HVvalAvg
ServiceHandle< StoreGateSvc > m_evtStore
virtual ~TRT_DCS_ConditionsSvc()
Destructor //.
bool m_FallBackOnCOOLChanNames
InDet::TRT_DCS_StatusFlag getFlag(const Identifier)
Returns the DCS conditions StatusFlag for a given identifier.
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
const TRT_ID * m_TRT_ID_Helper
SG::ReadCondHandleKey< CondAttrListCollection > m_ECReadKey
InDet::TRT_CondFlag condSummaryStatus(const Identifier &)
Evaluation for TRT_ConditionsSummarySvc.
TH1D * m_h_EndcapA_HVvalAvg
TH1D * m_h_Barrel_nNOINFO
ServiceHandle< StoreGateSvc > m_detStore
TH1D * m_h_EndcapC_nNOINFO
void monitorBarrel()
Monitor barrel HV //.
virtual StatusCode finalize()
Finalize //.
int m_numFlagRED
Counters.
const CondAttrListCollection * getCollection(const std::string &collName)
get pointer
SG::ReadCondHandleKey< CondAttrListCollection > m_EAReadKey
void monitorEndcapA()
Monitor EndcapA HV //.
std::string m_EndcapA_HV_COOLFolderName
StatusCode getValue(const Identifier, const InDet::TRT_DCS_DataType, InDet::TRT_DCS_ValueType &)
Returns the value for a given identifier and data type.
virtual StatusCode initialize()
Initialize //.
void monitorEndcapC()
Monitor EndcapC HV //.
TH1D * m_h_Barrel_HVvalAvg