ATLAS Offline Software
Public Member Functions | List of all members
TRT_DAQ_ConditionsSvc Class Reference

#include <TRT_DAQ_ConditionsSvc.h>

Inheritance diagram for TRT_DAQ_ConditionsSvc:
Collaboration diagram for TRT_DAQ_ConditionsSvc:

Public Member Functions

 TRT_DAQ_ConditionsSvc (const std::string &, ISvcLocator *)
 Constructor //. More...
 
virtual ~TRT_DAQ_ConditionsSvc ()
 Destructor //. More...
 
virtual StatusCode initialize ()
 Initialize //. More...
 
virtual StatusCode finalize ()
 Finalize //. More...
 
unsigned int RODid (const Identifier &)
 Return ROD identifier //. More...
 
InDet::TRT_CondFlag condSummaryStatus (unsigned int)
 ConditionsSummaryStatus for a ROD ID. More...
 

Functions inherited from ITRT_ConditionsSvc

ServiceHandle< StoreGateSvcm_detStore
 
std::string m_FolderName
 
const TRT_IDm_TRT_ID_Helper {}
 
SG::ReadCondHandleKey< CondAttrListCollectionm_RobinsReadKey {this,"RobinsReadKey","/TDAQ/Resources/ATLAS/TRT/Robins","Robins in-key"}
 
InDet::TRT_CondFlag condSummaryStatus (const Identifier &)
 Evaluation for TRT_ConditionsSummarySvc. More...
 

Detailed Description

Definition at line 29 of file TRT_DAQ_ConditionsSvc.h.

Constructor & Destructor Documentation

◆ TRT_DAQ_ConditionsSvc()

TRT_DAQ_ConditionsSvc::TRT_DAQ_ConditionsSvc ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructor //.

Definition at line 18 of file TRT_DAQ_ConditionsSvc.cxx.

18  :
19  base_class( name, pSvcLocator ),
20  m_detStore("DetectorStore",name),
21  m_FolderName("/TDAQ/Resources/ATLAS/TRT/Robins") // For run1 the name is /TDAQ/EnabledResources/ATLAS/TRT/Robins
22 {
23  // Get properties from job options
24  declareProperty( "FolderName", m_FolderName );
25  declareProperty( "DetectorStore", m_detStore );
26 }

◆ ~TRT_DAQ_ConditionsSvc()

TRT_DAQ_ConditionsSvc::~TRT_DAQ_ConditionsSvc ( )
virtualdefault

Destructor //.

Member Function Documentation

◆ condSummaryStatus() [1/2]

InDet::TRT_CondFlag TRT_DAQ_ConditionsSvc::condSummaryStatus ( const Identifier ident)

Evaluation for TRT_ConditionsSummarySvc.

StatusFlag for TRT_ConditionsSummarySvc (by Identifier) //.

Function inherited from ITRT_ConditionsSvc. Returns a InDet::TRT_CondFlag for the Identifier, as determined by the TRT_DAQ_ConditionSvc.

Definition at line 86 of file TRT_DAQ_ConditionsSvc.cxx.

87  {
88 
90  const CondAttrListCollection* EnabledRods{*readHandle};
91  if ( !EnabledRods ) return InDet::TRT_COND_NOINFO;
92 
93  unsigned int thisRODid = RODid( ident );
94 
95  return condSummaryStatus( thisRODid );
96 }

◆ condSummaryStatus() [2/2]

InDet::TRT_CondFlag TRT_DAQ_ConditionsSvc::condSummaryStatus ( unsigned int  thisRODid)

ConditionsSummaryStatus for a ROD ID.

StatusFlag for conditions summary (by ROD ID) //.

Similar to ITRT_ConditionsSvc::condSummaryStatus, but specific to this service

Definition at line 101 of file TRT_DAQ_ConditionsSvc.cxx.

101  {
102 
104  const CondAttrListCollection* EnabledRods{*readHandle};
105 
106  if ( !EnabledRods ) return InDet::TRT_COND_NOINFO;
107 
109  if ( EnabledRods->name_size() == 0 ) {
110  ATH_MSG_WARNING( m_FolderName << " has no entries in it's ChanNameMap." );
111  return InDet::TRT_COND_NOINFO;
112  }
113  int chanNum = -1;
114  std::string chanName = "";
115  for ( chanNameMapItr = EnabledRods->name_begin();
116  chanNameMapItr != EnabledRods->name_end(); ++chanNameMapItr ) {
117  chanNum = (*chanNameMapItr).first;
118  chanName = (*chanNameMapItr).second;
119  // Pull off last 6 characters from chanName and convert
120  // to an integer for comparison to identifier.
121  std::string ROD_Part = std::string( chanName, chanName.length()-6, 2 );
122  std::string ROD_Phi = std::string( chanName, chanName.length()-4, 2 );
123  std::string ROD_Half = std::string( chanName, chanName.length()-2, 2 );
124 
125  unsigned int rod = 0;
126 
127  // Convert string representation of hex representation of partition (detector) to integer
128  /* Partition number in string from database comes as hex number.
129  * Need to convert it to an integer. */
130  int ROD_Part_int;
131  std::istringstream iss(ROD_Part);
132  iss >> ROD_Part_int;
133  switch ( ROD_Part_int ) {
134  case 31:
135  rod += 0x10000 * 0x31;
136  break;
137  case 32:
138  rod += 0x10000 * 0x32;
139  break;
140  case 33:
141  rod += 0x10000 * 0x33;
142  break;
143  case 34:
144  rod += 0x10000 * 0x34;
145  break;
146  }
147 
148  // Convert string representation of hex representation of phi stack to integer
149  /* Phi stack number in string from database comes as hex number.
150  * Need to convert it to an integer. */
151  char* extra = nullptr;
152  int ROD_Phi_int = strtol( ROD_Phi.c_str(), &extra, 16 );
153  rod += ROD_Phi_int * 0x100;
154 
155  rod += atoi(ROD_Half.c_str());
156 
157  ATH_MSG_VERBOSE( "Comparing " << rod << " to " << thisRODid );
158  if ( rod == thisRODid ) break;
159  }
160  if ( chanNameMapItr == EnabledRods->name_end() ) {
161  ATH_MSG_VERBOSE( thisRODid << " not found in chanNameMap" );
162  return InDet::TRT_COND_BAD; // SHOULD THIS BE NOINFO??
163  // Either this is unnecessary (ROD absence won't show up here)
164  // or the next checking step is redundant.
165  }
166 
167  // Check for absence of AttributeList for this ROD.
169  chanAttrListPair = EnabledRods->chanAttrListPair( chanNum );
170  if ( chanAttrListPair == EnabledRods->end() ) {
171  ATH_MSG_VERBOSE( "Channel " << chanNum << " (" << chanName << ") not found." );
172  return InDet::TRT_COND_BAD;
173  }
174 
175  // Must have been present = GOOD.
176  ATH_MSG_VERBOSE( "Channel " << chanNum << " (" << chanName << ") enabled in this event." );
177  return InDet::TRT_COND_GOOD;
178 }

◆ finalize()

StatusCode TRT_DAQ_ConditionsSvc::finalize ( )
virtual

Finalize //.

Definition at line 183 of file TRT_DAQ_ConditionsSvc.cxx.

183  {
184  return StatusCode::SUCCESS;
185 }

◆ initialize()

StatusCode TRT_DAQ_ConditionsSvc::initialize ( )
virtual

Initialize //.

Definition at line 36 of file TRT_DAQ_ConditionsSvc.cxx.

36  {
37  StatusCode sc(StatusCode::SUCCESS);
38 
39  // Read key for Robins folder
41 
42  // Get the TRT Identifier Helper.
43  ATH_CHECK( m_detStore->retrieve( m_TRT_ID_Helper, "TRT_ID" ));
44 
45  return sc;
46 }

◆ RODid()

unsigned int TRT_DAQ_ConditionsSvc::RODid ( const Identifier ident)

Return ROD identifier //.

Definition at line 51 of file TRT_DAQ_ConditionsSvc.cxx.

51  {
52  int barrel_ec = m_TRT_ID_Helper->barrel_ec( ident );
53  int phi_module = m_TRT_ID_Helper->phi_module( ident );
54  int layer_or_wheel = m_TRT_ID_Helper->layer_or_wheel( ident );
55  int straw_layer = m_TRT_ID_Helper->straw_layer( ident );
56 
57  int partition = 0;
58  if ( barrel_ec == 1 ) partition = 0x31; // Barrel A
59  else if ( barrel_ec == -1 ) partition = 0x32; // Barrel C
60  else if ( barrel_ec == 2 ) partition = 0x33; // Endcap A
61  else if ( barrel_ec == -2 ) partition = 0x34; // Endcap C
62  else {
63  ATH_MSG_WARNING( "Invalid Barrel/EC identifier requested in RODid." );
64  return 0;
65  }
66 
67  int phi = phi_module + 1; // [0,31] -> [1,32]
68 
69  int rodHalf = 0;
70  if ( abs(barrel_ec) == 2 ) {
71  if ( layer_or_wheel >= 0 && layer_or_wheel < 4 ) rodHalf = 2;
72  if ( layer_or_wheel == 4 && straw_layer >= 0 && straw_layer < 8 ) rodHalf = 1;
73  if ( layer_or_wheel == 4 && straw_layer >= 8 && straw_layer < 16 ) rodHalf = 2;
74  if ( layer_or_wheel == 5 && straw_layer >= 0 && straw_layer < 8 ) rodHalf = 2;
75  if ( layer_or_wheel == 5 && straw_layer >= 8 && straw_layer < 16 ) rodHalf = 1;
76  if ( layer_or_wheel >= 6 && layer_or_wheel < 14 ) rodHalf = 1;
77  }
78 
79  int thisRODid = partition*0x10000 + phi*0x100 + rodHalf;
80  return thisRODid;
81 }

Member Data Documentation

◆ m_detStore

ServiceHandle<StoreGateSvc> TRT_DAQ_ConditionsSvc::m_detStore
private

Definition at line 63 of file TRT_DAQ_ConditionsSvc.h.

◆ m_FolderName

std::string TRT_DAQ_ConditionsSvc::m_FolderName
private

Definition at line 66 of file TRT_DAQ_ConditionsSvc.h.

◆ m_RobinsReadKey

SG::ReadCondHandleKey<CondAttrListCollection> TRT_DAQ_ConditionsSvc::m_RobinsReadKey {this,"RobinsReadKey","/TDAQ/Resources/ATLAS/TRT/Robins","Robins in-key"}
private

Definition at line 72 of file TRT_DAQ_ConditionsSvc.h.

◆ m_TRT_ID_Helper

const TRT_ID* TRT_DAQ_ConditionsSvc::m_TRT_ID_Helper {}
private

Definition at line 69 of file TRT_DAQ_ConditionsSvc.h.


The documentation for this class was generated from the following files:
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
TRT_DAQ_ConditionsSvc::m_RobinsReadKey
SG::ReadCondHandleKey< CondAttrListCollection > m_RobinsReadKey
Definition: TRT_DAQ_ConditionsSvc.h:72
TRT_DAQ_ConditionsSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: TRT_DAQ_ConditionsSvc.h:63
TRT_DAQ_ConditionsSvc::RODid
unsigned int RODid(const Identifier &)
Return ROD identifier //.
Definition: TRT_DAQ_ConditionsSvc.cxx:51
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
InDet::TRT_COND_NOINFO
@ TRT_COND_NOINFO
Definition: ITRT_ConditionsSvc.h:20
CondAttrListCollection::name_const_iterator
ChanNameMap::const_iterator name_const_iterator
Definition: CondAttrListCollection.h:69
checkCoolLatestUpdate.chanNum
chanNum
Definition: checkCoolLatestUpdate.py:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TRT_DAQ_ConditionsSvc::m_FolderName
std::string m_FolderName
Definition: TRT_DAQ_ConditionsSvc.h:66
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
TRT_DAQ_ConditionsSvc::condSummaryStatus
InDet::TRT_CondFlag condSummaryStatus(unsigned int)
ConditionsSummaryStatus for a ROD ID.
Definition: TRT_DAQ_ConditionsSvc.cxx:101
python.handimod.extra
int extra
Definition: handimod.py:522
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRT_DAQ_ConditionsSvc::m_TRT_ID_Helper
const TRT_ID * m_TRT_ID_Helper
Definition: TRT_DAQ_ConditionsSvc.h:69
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
InDet::TRT_COND_BAD
@ TRT_COND_BAD
Definition: ITRT_ConditionsSvc.h:25
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CondAttrListCollection::const_iterator
ChanAttrListMap::const_iterator const_iterator
Definition: CondAttrListCollection.h:63
StateLessPT_NewConfig.partition
partition
Definition: StateLessPT_NewConfig.py:49
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
InDet::TRT_COND_GOOD
@ TRT_COND_GOOD
Definition: ITRT_ConditionsSvc.h:21