ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_ConditionsSummarySvc Class Reference

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

#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.
virtual ~TRT_ConditionsSummarySvc ()
virtual StatusCode initialize () override
 Service init.
virtual bool isActive (const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override
virtual bool isActive (const IdentifierHash &elementHash) override
virtual bool isActive (const IdentifierHash &elementHash, const Identifier &elementId) override
virtual double activeFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd) override
virtual bool isGood (const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override
virtual bool isGood (const IdentifierHash &elementHash) override
virtual bool isGood (const IdentifierHash &elementHash, const Identifier &elementId) override
virtual double goodFraction (const IdentifierHash &elementHash, const Identifier &idStart, const Identifier &idEnd) override

Private Member Functions

InDet::TRT_CondFlag condSummaryStatus (const Identifier &ident)

Private Attributes

ServiceHandleArray< ITRT_ConditionsSvcm_svcCollection
const InDetDD::TRT_DetectorManagerm_manager {nullptr}
const TRT_IDm_trtid {nullptr}

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 base_class(name, pSvcLocator),
23 m_svcCollection(name)
24{
25 // Get properties from job options
26 declareProperty( "ServiceList", m_svcCollection );
27}
ServiceHandleArray< ITRT_ConditionsSvc > m_svcCollection

◆ ~TRT_ConditionsSummarySvc()

TRT_ConditionsSummarySvc::~TRT_ConditionsSummarySvc ( )
virtualdefault

Member Function Documentation

◆ activeFraction()

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

Definition at line 119 of file TRT_ConditionsSummarySvc.cxx.

119 {
120 double result(0.0);
121
122 Identifier layerId=m_trtid->layer_id(elementHash);
123
124 int start=m_trtid->straw(idStart);
125 int end=m_trtid->straw(idEnd);
126
127 double count=1.0;
128 for(int i=start;i<=end;i++){
129 Identifier elementId=m_trtid->straw_id(layerId,i);
131 result+=1.0;
132 }
133 if(count>0){
134 result/=count;
135 }
136
137 return result;
138}
virtual bool isActive(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ condSummaryStatus()

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

Definition at line 223 of file TRT_ConditionsSummarySvc.cxx.

223 {
224
225 // Identifier id=ident;
227
228 // Call condSummaryStatus for each service in m_svcCollection.
229 ServiceHandleArray<ITRT_ConditionsSvc>::const_iterator svcItr;
230 for ( svcItr = m_svcCollection.begin();
231 svcItr != m_svcCollection.end(); ++svcItr ) {
232 InDet::TRT_CondFlag thisSvcFlag;
233 thisSvcFlag = (*svcItr)->condSummaryStatus( ident );
234 if ( thisSvcFlag == InDet::TRT_COND_SKIPME ) continue;
235 if ( thisSvcFlag == InDet::TRT_COND_NOINFO ) continue;
236 // If any tool reports CAUTION, return CAUTION.
237 // If any tool reports BAD, return BAD.
238 if ( thisSvcFlag != InDet::TRT_COND_GOOD ) {
239 if ( status != InDet::TRT_COND_BAD ) status = InDet::TRT_COND_CAUTION;
240 if ( thisSvcFlag == InDet::TRT_COND_BAD ) status = InDet::TRT_COND_BAD;
241 }
242 }
243
244 return status;
245}
TRT_CondFlag
status flag to be derived from the inheriting tool's conditions info
status
Definition merge.py:16

◆ goodFraction()

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

Definition at line 201 of file TRT_ConditionsSummarySvc.cxx.

201 {
202 double result(0.0);
203
204 Identifier layerId=m_trtid->layer_id(elementHash);
205
206 int start=m_trtid->straw(idStart);
207 int end=m_trtid->straw(idEnd);
208
209 double count=1.0;
210 for(int i=start;i<=end;i++){
211 Identifier elementId=m_trtid->straw_id(layerId,i);
213 result+=1.0;
214 }
215 if(count>0){
216 result/=count;
217 }
218
219 return result;
220}
virtual bool isGood(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override

◆ initialize()

StatusCode TRT_ConditionsSummarySvc::initialize ( )
overridevirtual

Service init.

Definition at line 34 of file TRT_ConditionsSummarySvc.cxx.

34 {
35 ATH_MSG_DEBUG("TRT_ConditionsSummarySvc::initialize.");
36
37 // Retrieve the services to be called.
38 if ( m_svcCollection.empty() ) {
39 ATH_MSG_WARNING("No services to be called!");
40 } else {
41 ATH_CHECK(m_svcCollection.retrieve());
42 ATH_MSG_DEBUG("Successfully retrieved services: " << m_svcCollection);
43 }
44
45 // Get DetectorStore service
46 SmartIF<StoreGateSvc> detStore{service("DetectorStore")};
47 ATH_CHECK( detStore.isValid() );
48
49 // Retrieve TRT_DetectorManager
50 ATH_CHECK(detStore->retrieve(m_manager, "TRT"));
51
52 // Retrieve TRT ID Helper
53 ATH_CHECK(detStore->retrieve(m_trtid,"TRT_ID"));
54
55 return StatusCode::SUCCESS;
56}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
const InDetDD::TRT_DetectorManager * m_manager

◆ isActive() [1/3]

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

Definition at line 59 of file TRT_ConditionsSummarySvc.cxx.

59 {
60 bool result(false);
61
64
67 //need to loop over all straws at this hierarchy level
68 result=true;
69 const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementId);
70
71 //loop over all straws
72 int nelements=element->nStraws();
73 for(int i=0;i<nelements;i++){
74 InDet::TRT_CondFlag flag=condSummaryStatus(m_trtid->straw_id(elementId,i));
75 if(!(flag==InDet::TRT_COND_GOOD || flag==InDet::TRT_COND_CAUTION || flag==InDet::TRT_COND_NOINFO)){
76 result=false;
77 break;
78 }
79 }
80 }else{
81 ATH_MSG_FATAL("Hierarchy Level "<<h<<" not yet implemented!!!");
82 result=false;
83 }
84
85 return result;
86}
#define ATH_MSG_FATAL(x)
unsigned int nStraws() const
Number of straws in the element.
InDet::TRT_CondFlag condSummaryStatus(const Identifier &ident)
bool flag
Definition master.py:29

◆ isActive() [2/3]

bool TRT_ConditionsSummarySvc::isActive ( const IdentifierHash & elementHash)
overridevirtual

Definition at line 89 of file TRT_ConditionsSummarySvc.cxx.

89 {
90 bool result(true);
91
92 const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementHash);
93
94 Identifier elementId=m_trtid->layer_id(elementHash);
95
96 //loop over all straws
97 int nelements=element->nStraws();
98 for(int i=0;i<nelements;i++){
99 InDet::TRT_CondFlag flag=condSummaryStatus(m_trtid->straw_id(elementId,i));
100 if(!(flag==InDet::TRT_COND_GOOD || flag==InDet::TRT_COND_CAUTION || flag==InDet::TRT_COND_NOINFO)){
101 result=false;
102 break;
103 }
104 }
105
106 return result;
107}

◆ isActive() [3/3]

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

Definition at line 110 of file TRT_ConditionsSummarySvc.cxx.

110 {
111 bool result(false);
112
114
115 return result;
116}

◆ isGood() [1/3]

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

Definition at line 141 of file TRT_ConditionsSummarySvc.cxx.

141 {
142 bool result(false);
143
146
149 //need to loop over all straws at this hierarchy level
150 result=true;
151 const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementId);
152
153 //loop over all straws
154 int nelements=element->nStraws();
155 for(int i=0;i<nelements;i++){
156 InDet::TRT_CondFlag flag=condSummaryStatus(m_trtid->straw_id(elementId,i));
157 if(!(flag==InDet::TRT_COND_GOOD)){
158 result=false;
159 break;
160 }
161 }
162 }else{
163 ATH_MSG_FATAL("Hierarchy Level "<<h<<" not yet implemented!!!");
164 result=false;
165 }
166
167 return result;
168}

◆ isGood() [2/3]

bool TRT_ConditionsSummarySvc::isGood ( const IdentifierHash & elementHash)
overridevirtual

Definition at line 171 of file TRT_ConditionsSummarySvc.cxx.

171 {
172 bool result(false);
173
174 const InDetDD::TRT_BaseElement *element=m_manager->getElement(elementHash);
175
176 Identifier elementId=m_trtid->layer_id(elementHash);
177
178 //loop over all straws
179 int nelements=element->nStraws();
180 for(int i=0;i<nelements;i++){
181 InDet::TRT_CondFlag flag=condSummaryStatus(m_trtid->straw_id(elementId,i));
182 if(!(flag==InDet::TRT_COND_GOOD)){
183 result=false;
184 break;
185 }
186 }
187
188 return result;
189}

◆ isGood() [3/3]

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

Definition at line 192 of file TRT_ConditionsSummarySvc.cxx.

192 {
193 bool result(false);
194
196
197 return result;
198}

Member Data Documentation

◆ m_manager

const InDetDD::TRT_DetectorManager* TRT_ConditionsSummarySvc::m_manager {nullptr}
private

Definition at line 65 of file TRT_ConditionsSummarySvc.h.

65{nullptr};

◆ m_svcCollection

ServiceHandleArray<ITRT_ConditionsSvc> TRT_ConditionsSummarySvc::m_svcCollection
private

Definition at line 62 of file TRT_ConditionsSummarySvc.h.

◆ m_trtid

const TRT_ID* TRT_ConditionsSummarySvc::m_trtid {nullptr}
private

Definition at line 66 of file TRT_ConditionsSummarySvc.h.

66{nullptr};

The documentation for this class was generated from the following files: