ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TRT_ConditionsSummarySvc Class Reference

#include <TRT_ConditionsSummarySvc.h>

Inheritance diagram for TRT_ConditionsSummarySvc:
Collaboration diagram for TRT_ConditionsSummarySvc:

Public Member Functions

 TRT_ConditionsSummarySvc (const std::string &name, ISvcLocator *svc)
 Service constructor. More...
 
virtual ~TRT_ConditionsSummarySvc ()
 
virtual StatusCode initialize ()
 Service init. More...
 
virtual StatusCode finalize ()
 Service finalize. More...
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual bool isActive (const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT)
 
virtual bool isActive (const IdentifierHash &elementHash)
 
virtual bool isActive (const IdentifierHash &elementHash, const Identifier &elementId)
 
virtual double activeFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd)
 activeFraction method gives the fraction of active elements in the range of identifiers More...
 
virtual bool isGood (const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT)
 
virtual bool isGood (const IdentifierHash &elementHash)
 
virtual bool isGood (const IdentifierHash &elementHash, const Identifier &elementId)
 
virtual double goodFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd)
 goodFraction method gives the fraction of good elements in the range of identifiers More...
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 reimplemented from Service->IService->IInterface inheritance More...
 

Private Member Functions

InDet::TRT_CondFlag condSummaryStatus (const Identifier &ident)
 

Private Attributes

ServiceHandleArray< ITRT_ConditionsSvcm_svcCollection
 
const InDetDD::TRT_DetectorManagerm_manager
 
const TRT_IDm_trtid
 

Detailed Description

Service providing summary of status of an TRT detector element Interface is IInDetConditionsSvc class

Definition at line 38 of file TRT_ConditionsSummarySvc.h.

Constructor & Destructor Documentation

◆ TRT_ConditionsSummarySvc()

TRT_ConditionsSummarySvc::TRT_ConditionsSummarySvc ( const std::string &  name,
ISvcLocator *  svc 
)

Service constructor.

Definition at line 21 of file TRT_ConditionsSummarySvc.cxx.

21  :
22  AthService(name, pSvcLocator),
24  m_manager(nullptr),
25  m_trtid(nullptr)
26 {
27  // Get properties from job options
28  declareProperty( "ServiceList", m_svcCollection );
29 }

◆ ~TRT_ConditionsSummarySvc()

TRT_ConditionsSummarySvc::~TRT_ConditionsSummarySvc ( )
virtualdefault

Member Function Documentation

◆ activeFraction()

double TRT_ConditionsSummarySvc::activeFraction ( const IdentifierHash elementHash,
const Identifier idStart,
const Identifier idEnd 
)
virtual

activeFraction method gives the fraction of active elements in the range of identifiers

Implements IInDetConditionsSvc.

Definition at line 150 of file TRT_ConditionsSummarySvc.cxx.

150  {
151  double result(0.0);
152 
153  Identifier layerId=m_trtid->layer_id(elementHash);
154 
155  int start=m_trtid->straw(idStart);
156  int end=m_trtid->straw(idEnd);
157 
158  double count=1.0;
159  for(int i=start;i<=end;i++){
160  Identifier elementId=m_trtid->straw_id(layerId,i);
161  if(isActive(elementId,InDetConditions::TRT_STRAW))
162  result+=1.0;
163  }
164  if(count>0){
165  result/=count;
166  }
167 
168  return result;
169 }

◆ condSummaryStatus()

InDet::TRT_CondFlag TRT_ConditionsSummarySvc::condSummaryStatus ( const Identifier ident)
private

Definition at line 253 of file TRT_ConditionsSummarySvc.cxx.

254  {
255 
256  // Identifier id=ident;
258 
259  // Call condSummaryStatus for each service in m_svcCollection.
260  ServiceHandleArray<ITRT_ConditionsSvc>::const_iterator svcItr;
261  for ( svcItr = m_svcCollection.begin();
262  svcItr != m_svcCollection.end(); ++svcItr ) {
263  InDet::TRT_CondFlag thisSvcFlag;
264  thisSvcFlag = (*svcItr)->condSummaryStatus( ident );
265  if ( thisSvcFlag == InDet::TRT_COND_SKIPME ) continue;
266  if ( thisSvcFlag == InDet::TRT_COND_NOINFO ) continue;
267  // If any tool reports CAUTION, return CAUTION.
268  // If any tool reports BAD, return BAD.
269  if ( thisSvcFlag != InDet::TRT_COND_GOOD ) {
271  if ( thisSvcFlag == InDet::TRT_COND_BAD ) status = InDet::TRT_COND_BAD;
272  }
273  }
274 
275  return status;
276 }

◆ finalize()

StatusCode TRT_ConditionsSummarySvc::finalize ( )
virtual

Service finalize.

Definition at line 85 of file TRT_ConditionsSummarySvc.cxx.

85  {
86  return StatusCode::SUCCESS;
87 }

◆ goodFraction()

double TRT_ConditionsSummarySvc::goodFraction ( const IdentifierHash elementHash,
const Identifier idStart,
const Identifier idEnd 
)
virtual

goodFraction method gives the fraction of good elements in the range of identifiers

Implements IInDetConditionsSvc.

Definition at line 232 of file TRT_ConditionsSummarySvc.cxx.

232  {
233  double result(0.0);
234 
235  Identifier layerId=m_trtid->layer_id(elementHash);
236 
237  int start=m_trtid->straw(idStart);
238  int end=m_trtid->straw(idEnd);
239 
240  double count=1.0;
241  for(int i=start;i<=end;i++){
242  Identifier elementId=m_trtid->straw_id(layerId,i);
243  if(isGood(elementId,InDetConditions::TRT_STRAW))
244  result+=1.0;
245  }
246  if(count>0){
247  result/=count;
248  }
249 
250  return result;
251 }

◆ initialize()

StatusCode TRT_ConditionsSummarySvc::initialize ( )
virtual

Service init.

Definition at line 36 of file TRT_ConditionsSummarySvc.cxx.

36  {
37  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "TRT_ConditionsSummarySvc::initialize." << endmsg;
38  StatusCode sc(StatusCode::SUCCESS);
39 
40  // Retrieve the services to be called.
41  if ( m_svcCollection.empty() ) {
42  msg(MSG::WARNING) << "No services to be called!" << endmsg;
43  } else {
44  sc = m_svcCollection.retrieve();
45  if ( sc.isFailure() ) {
46  msg(MSG::ERROR) << "Couldn't retrieve services: "
47  << m_svcCollection << endmsg;
48  return sc;
49  } else {
50  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Successfully retrieved services: "
51  << m_svcCollection << endmsg;
52  }
53  }
54 
55  // Get DetectorStore service
57  sc = service("DetectorStore", detStore);
58  if (sc.isFailure()){
59  msg(MSG::FATAL) << "DetectorStore service not found!" << endmsg;
60  return sc;
61  }
62 
63  // Retrieve TRT_DetectorManager
64  std::string managerName;
65  sc=detStore->retrieve(m_manager, managerName);
66  if (sc.isFailure() || !m_manager)
67  {
68  msg(MSG::FATAL) << "Could not find the Manager: "
69  << managerName << " !" << endmsg;
70  return sc;
71  }
72 
73  // Retrieve TRT ID Helper
74  sc = detStore->retrieve(m_trtid,"TRT_ID");
75  if ( sc.isFailure() ) {
76  ATH_MSG_FATAL("Could not retrieve TRT ID Helper.");
77  return sc;
78  }
79 
80  return sc;
81 }

◆ interfaceID()

const InterfaceID & TRT_ConditionsSummarySvc::interfaceID ( )
inlinestatic

reimplemented from Service->IService->IInterface inheritance

Definition at line 74 of file TRT_ConditionsSummarySvc.h.

74  {
76 }

◆ isActive() [1/3]

bool TRT_ConditionsSummarySvc::isActive ( const Identifier elementId,
const InDetConditions::Hierarchy  h = InDetConditions::DEFAULT 
)
virtual

Implements IInDetConditionsSvc.

Definition at line 90 of file TRT_ConditionsSummarySvc.cxx.

90  {
91  bool result(false);
92 
95 
98  //need to loop over all straws at this hierarchy level
99  result=true;
100  const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementId);
101 
102  //loop over all straws
103  int nelements=element->nStraws();
104  for(int i=0;i<nelements;i++){
107  result=false;
108  break;
109  }
110  }
111  }else{
112  msg(MSG::FATAL)<<"Hierarchy Level "<<h<<" not yet implemented!!!"<<endmsg;
113  result=false;
114  }
115 
116  return result;
117 }

◆ isActive() [2/3]

bool TRT_ConditionsSummarySvc::isActive ( const IdentifierHash elementHash)
virtual

Implements IInDetConditionsSvc.

Definition at line 120 of file TRT_ConditionsSummarySvc.cxx.

120  {
121  bool result(true);
122 
123  const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementHash);
124 
125  Identifier elementId=m_trtid->layer_id(elementHash);
126 
127  //loop over all straws
128  int nelements=element->nStraws();
129  for(int i=0;i<nelements;i++){
132  result=false;
133  break;
134  }
135  }
136 
137  return result;
138 }

◆ isActive() [3/3]

bool TRT_ConditionsSummarySvc::isActive ( const IdentifierHash elementHash,
const Identifier elementId 
)
virtual

Implements IInDetConditionsSvc.

Definition at line 141 of file TRT_ConditionsSummarySvc.cxx.

141  {
142  bool result(false);
143 
145 
146  return result;
147 }

◆ isGood() [1/3]

bool TRT_ConditionsSummarySvc::isGood ( const Identifier elementId,
const InDetConditions::Hierarchy  h = InDetConditions::DEFAULT 
)
virtual

Implements IInDetConditionsSvc.

Definition at line 172 of file TRT_ConditionsSummarySvc.cxx.

172  {
173  bool result(false);
174 
177 
180  //need to loop over all straws at this hierarchy level
181  result=true;
182  const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementId);
183 
184  //loop over all straws
185  int nelements=element->nStraws();
186  for(int i=0;i<nelements;i++){
188  if(!(flag==InDet::TRT_COND_GOOD)){
189  result=false;
190  break;
191  }
192  }
193  }else{
194  msg(MSG::FATAL)<<"Hierarchy Level "<<h<<" not yet implemented!!!"<<endmsg;
195  result=false;
196  }
197 
198  return result;
199 }

◆ isGood() [2/3]

bool TRT_ConditionsSummarySvc::isGood ( const IdentifierHash elementHash)
virtual

Implements IInDetConditionsSvc.

Definition at line 202 of file TRT_ConditionsSummarySvc.cxx.

202  {
203  bool result(false);
204 
205  const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementHash);
206 
207  Identifier elementId=m_trtid->layer_id(elementHash);
208 
209  //loop over all straws
210  int nelements=element->nStraws();
211  for(int i=0;i<nelements;i++){
213  if(!(flag==InDet::TRT_COND_GOOD)){
214  result=false;
215  break;
216  }
217  }
218 
219  return result;
220 }

◆ isGood() [3/3]

bool TRT_ConditionsSummarySvc::isGood ( const IdentifierHash elementHash,
const Identifier elementId 
)
virtual

Implements IInDetConditionsSvc.

Definition at line 223 of file TRT_ConditionsSummarySvc.cxx.

223  {
224  bool result(false);
225 
227 
228  return result;
229 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< Service >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ queryInterface()

StatusCode TRT_ConditionsSummarySvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
inlinevirtual

Definition at line 84 of file TRT_ConditionsSummarySvc.h.

85 {
86  if ( IInDetConditionsSvc::interfaceID().versionMatch(riid) ) {
87  *ppvInterface = dynamic_cast<IInDetConditionsSvc*>(this);
88  } else {
89  // Interface is not directly available : try out a base class
90  return AthService::queryInterface(riid, ppvInterface);
91  }
92  addRef();
93  return StatusCode::SUCCESS;
94 }

Member Data Documentation

◆ m_manager

const InDetDD::TRT_DetectorManager* TRT_ConditionsSummarySvc::m_manager
private

Definition at line 69 of file TRT_ConditionsSummarySvc.h.

◆ m_svcCollection

ServiceHandleArray<ITRT_ConditionsSvc> TRT_ConditionsSummarySvc::m_svcCollection
private

Definition at line 66 of file TRT_ConditionsSummarySvc.h.

◆ m_trtid

const TRT_ID* TRT_ConditionsSummarySvc::m_trtid
private

Definition at line 70 of file TRT_ConditionsSummarySvc.h.


The documentation for this class was generated from the following files:
AthService::AthService
AthService()
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
IInDetConditionsSvc
Definition: IInDetConditionsSvc.h:24
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
TRT_ConditionsSummarySvc::condSummaryStatus
InDet::TRT_CondFlag condSummaryStatus(const Identifier &ident)
Definition: TRT_ConditionsSummarySvc.cxx:253
TRT_ConditionsSummarySvc::m_svcCollection
ServiceHandleArray< ITRT_ConditionsSvc > m_svcCollection
Definition: TRT_ConditionsSummarySvc.h:66
IInDetConditionsSvc::interfaceID
static const InterfaceID & interfaceID()
reimplemented from IInterface
Definition: IInDetConditionsSvc.h:52
InDetDD::TRT_BaseElement::nStraws
unsigned int nStraws() const
Number of straws in the element.
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
AthCommonMsg< Service >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
InDet::TRT_COND_NOINFO
@ TRT_COND_NOINFO
Definition: ITRT_ConditionsSvc.h:20
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
InDet::TRT_COND_CAUTION
@ TRT_COND_CAUTION
Definition: ITRT_ConditionsSvc.h:22
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::TRT_COND_SKIPME
@ TRT_COND_SKIPME
Definition: ITRT_ConditionsSvc.h:26
master.flag
bool flag
Definition: master.py:29
TRT_ConditionsSummarySvc::isGood
virtual bool isGood(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT)
Definition: TRT_ConditionsSummarySvc.cxx:172
InDetConditions::TRT_STRAW_LAYER
@ TRT_STRAW_LAYER
Definition: InDetHierarchy.h:16
TRT_ConditionsSummarySvc::m_manager
const InDetDD::TRT_DetectorManager * m_manager
Definition: TRT_ConditionsSummarySvc.h:69
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
InDetDD::TRT_DetectorManager::getElement
const TRT_BaseElement * getElement(Identifier id) const
Access Elements Generically---------------------------------------------—.
Definition: TRT_DetectorManager.cxx:158
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
TRT_ConditionsSummarySvc::isActive
virtual bool isActive(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT)
Definition: TRT_ConditionsSummarySvc.cxx:90
TRT_ConditionsSummarySvc::m_trtid
const TRT_ID * m_trtid
Definition: TRT_ConditionsSummarySvc.h:70
InDet::TRT_COND_BAD
@ TRT_COND_BAD
Definition: ITRT_ConditionsSvc.h:25
h
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< Service >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
InDetConditions::TRT_STRAW
@ TRT_STRAW
Definition: InDetHierarchy.h:16
InDet::TRT_CondFlag
TRT_CondFlag
status flag to be derived from the inheriting tool's conditions info
Definition: ITRT_ConditionsSvc.h:19
merge.status
status
Definition: merge.py:17
InDet::TRT_COND_GOOD
@ TRT_COND_GOOD
Definition: ITRT_ConditionsSvc.h:21
InDetConditions::DEFAULT
@ DEFAULT
Definition: InDetHierarchy.h:14
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:57
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581