ATLAS Offline Software
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 () override
 Service init. More...
 
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),
24 {
25  // Get properties from job options
26  declareProperty( "ServiceList", m_svcCollection );
27 }

◆ ~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);
130  if(isActive(elementId,InDetConditions::TRT_STRAW))
131  result+=1.0;
132  }
133  if(count>0){
134  result/=count;
135  }
136 
137  return result;
138 }

◆ 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 ) {
240  if ( thisSvcFlag == InDet::TRT_COND_BAD ) status = InDet::TRT_COND_BAD;
241  }
242  }
243 
244  return status;
245 }

◆ 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);
212  if(isGood(elementId,InDetConditions::TRT_STRAW))
213  result+=1.0;
214  }
215  if(count>0){
216  result/=count;
217  }
218 
219  return result;
220 }

◆ 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 }

◆ 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++){
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 }

◆ 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++){
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++){
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++){
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.

◆ 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.


The documentation for this class was generated from the following files:
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:494
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
TRT_ConditionsSummarySvc::condSummaryStatus
InDet::TRT_CondFlag condSummaryStatus(const Identifier &ident)
Definition: TRT_ConditionsSummarySvc.cxx:223
TRT_ConditionsSummarySvc::m_svcCollection
ServiceHandleArray< ITRT_ConditionsSvc > m_svcCollection
Definition: TRT_ConditionsSummarySvc.h:62
InDetDD::TRT_BaseElement::nStraws
unsigned int nStraws() const
Number of straws in the element.
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:13
TRT_ConditionsSummarySvc::isActive
virtual bool isActive(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override
Definition: TRT_ConditionsSummarySvc.cxx:59
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
InDet::TRT_COND_NOINFO
@ TRT_COND_NOINFO
Definition: ITRT_ConditionsSvc.h:20
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:896
lumiFormat.i
int i
Definition: lumiFormat.py:85
InDet::TRT_COND_CAUTION
@ TRT_COND_CAUTION
Definition: ITRT_ConditionsSvc.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::TRT_COND_SKIPME
@ TRT_COND_SKIPME
Definition: ITRT_ConditionsSvc.h:26
master.flag
bool flag
Definition: master.py:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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:65
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
InDetDD::TRT_DetectorManager::getElement
const TRT_BaseElement * getElement(Identifier id) const
Access Elements Generically---------------------------------------------—.
Definition: TRT_DetectorManager.cxx:145
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
TRT_ConditionsSummarySvc::m_trtid
const TRT_ID * m_trtid
Definition: TRT_ConditionsSummarySvc.h:66
InDet::TRT_COND_BAD
@ TRT_COND_BAD
Definition: ITRT_ConditionsSvc.h:25
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
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:16
InDet::TRT_COND_GOOD
@ TRT_COND_GOOD
Definition: ITRT_ConditionsSvc.h:21
TRT_ConditionsSummarySvc::isGood
virtual bool isGood(const Identifier &elementId, const InDetConditions::Hierarchy h=InDetConditions::DEFAULT) override
Definition: TRT_ConditionsSummarySvc.cxx:141
InDetConditions::DEFAULT
@ DEFAULT
Definition: InDetHierarchy.h:14
InDetDD::TRT_BaseElement
Definition: TRT_BaseElement.h:52
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:575
Identifier
Definition: IdentifierFieldParser.cxx:14