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

#include <TRTStrawStatusWrite.h>

Inheritance diagram for TRTStrawStatusWrite:
Collaboration diagram for TRTStrawStatusWrite:

Public Types

typedef TRTCond::StrawStatusMultChanContainer StrawStatusContainer

Public Member Functions

 TRTStrawStatusWrite (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TRTStrawStatusWrite ()=default
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode finalize () override
virtual void set_status_temp (StrawStatusContainer *ssc, Identifier offlineID, bool set)
virtual void set_status_permanent (StrawStatusContainer *ssc, Identifier offlineID, bool set)
virtual StatusCode readStatFromTextFile (const std::string &filename)
virtual StatusCode readStatPermFromTextFile (const std::string &filename)
virtual StatusCode readStatHTFromTextFile (const std::string &filename)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< std::string > m_par_strawstatuscontainerkey {this, "StrawStatusKey", "/TRT/Cond/Status", ""}
Gaudi::Property< std::string > m_par_strawstatuspermanentcontainerkey {this, "StrawStatusPermanentKey", "/TRT/Cond/StatusPermanent", ""}
Gaudi::Property< std::string > m_par_strawstatusHTcontainerkey {this, "StrawStatusHTKey", "/TRT/Cond/StatusHT", ""}
Gaudi::Property< std::string > m_par_stattextfile {this, "StatusInputFile", "", "input text file"}
Gaudi::Property< std::string > m_par_stattextfilepermanent {this, "StatusInputFilePermanent", "", "input text file: permanent"}
Gaudi::Property< std::string > m_par_stattextfileHT {this, "StatusInputFileHT", "", "input text file: HT"}
const TRT_IDm_trtid {}
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 24 of file TRTStrawStatusWrite.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

◆ StrawStatusContainer

Constructor & Destructor Documentation

◆ TRTStrawStatusWrite()

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

Definition at line 21 of file TRTStrawStatusWrite.cxx.

21: AthAlgorithm(name, pSvcLocator){}
AthAlgorithm()
Default constructor:

◆ ~TRTStrawStatusWrite()

virtual TRTStrawStatusWrite::~TRTStrawStatusWrite ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TRTStrawStatusWrite::execute ( )
overridevirtual

Definition at line 64 of file TRTStrawStatusWrite.cxx.

65{
66 return StatusCode::SUCCESS;
67}

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TRTStrawStatusWrite::finalize ( )
overridevirtual

Definition at line 69 of file TRTStrawStatusWrite.cxx.

70{
71 return StatusCode::SUCCESS;
72}

◆ initialize()

StatusCode TRTStrawStatusWrite::initialize ( )
overridevirtual

Definition at line 23 of file TRTStrawStatusWrite.cxx.

24{
25 ATH_MSG_INFO(" Initializing TRTStrawStatusWrite ");
26 ATH_CHECK(detStore()->retrieve(m_trtid, "TRT_ID"));
27
28 if (!m_par_stattextfile.empty())
29 {
30 ATH_MSG_INFO("Recording StrawStatusContainer for key " << m_par_strawstatuscontainerkey);
32 {
33 ATH_MSG_ERROR(" Could not read TRT StrawStatus objects ");
34 return StatusCode::FAILURE;
35 }
36 ATH_MSG_INFO(" Filled " << m_par_strawstatuscontainerkey << " using input file " << m_par_stattextfile);
37 }
38
39 if (!m_par_stattextfilepermanent.empty())
40 {
41 ATH_MSG_INFO("Recording StrawStatusPermanent Container for key " << m_par_strawstatuspermanentcontainerkey);
43 {
44 ATH_MSG_ERROR(" Could not read TRT StrawStatus permanent objects ");
45 return StatusCode::FAILURE;
46 }
48 }
49
50 if (!m_par_stattextfileHT.empty())
51 {
52 ATH_MSG_INFO("Recording StrawStatusHTContainer for key " << m_par_strawstatusHTcontainerkey);
54 {
55 ATH_MSG_ERROR(" Could not read TRT StrawStatus HT objects ");
56 return StatusCode::FAILURE;
57 }
58 ATH_MSG_INFO(" Filled " << m_par_strawstatusHTcontainerkey << " using input file " << m_par_stattextfileHT);
59 }
60
61 return StatusCode::SUCCESS;
62}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
const ServiceHandle< StoreGateSvc > & detStore() const
Gaudi::Property< std::string > m_par_strawstatuspermanentcontainerkey
Gaudi::Property< std::string > m_par_stattextfilepermanent
virtual StatusCode readStatHTFromTextFile(const std::string &filename)
Gaudi::Property< std::string > m_par_stattextfileHT
Gaudi::Property< std::string > m_par_strawstatuscontainerkey
Gaudi::Property< std::string > m_par_strawstatusHTcontainerkey
virtual StatusCode readStatPermFromTextFile(const std::string &filename)
Gaudi::Property< std::string > m_par_stattextfile
virtual StatusCode readStatFromTextFile(const std::string &filename)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ readStatFromTextFile()

StatusCode TRTStrawStatusWrite::readStatFromTextFile ( const std::string & filename)
virtual

Definition at line 117 of file TRTStrawStatusWrite.cxx.

118{
119
120 StrawStatusContainer *strawstatus = new TRTCond::StrawStatusMultChanContainer();
121
122 strawstatus->clear();
123 ATH_MSG_INFO(" ***************** TRTStrawStatusWrite ************************ ");
124 ATH_MSG_INFO(" readStatFromTextFile called with file name " << filename);
125
126 int deadba0[32];
127 int deadba1[32];
128 int deadba2[32];
129 int deadbc0[32];
130 int deadbc1[32];
131 int deadbc2[32];
132 int deadea[14];
133 int deadec[14];
134 for (int i = 0; i < 32; i++)
135 {
136 deadba0[i] = 0;
137 deadba1[i] = 0;
138 deadba2[i] = 0;
139 deadbc0[i] = 0;
140 deadbc1[i] = 0;
141 deadbc2[i] = 0;
142 }
143 for (int i = 0; i < 14; i++)
144 {
145 deadea[i] = 0;
146 deadec[i] = 0;
147 }
148 // initialize detector layers with status 'good'
149 for (int l = 0; l < 3; l++)
150 {
151 TRTCond::ExpandedIdentifier idbc(-1, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
152 strawstatus->setStatus(idbc, TRTCond::StrawStatus::Good);
153 TRTCond::ExpandedIdentifier idba(1, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
154 strawstatus->setStatus(idba, TRTCond::StrawStatus::Good);
155 }
156 for (int l = 0; l < 14; l++)
157 {
158 TRTCond::ExpandedIdentifier idec(-2, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
159 strawstatus->setStatus(idec, TRTCond::StrawStatus::Good);
160 TRTCond::ExpandedIdentifier idea(2, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
161 strawstatus->setStatus(idea, TRTCond::StrawStatus::Good);
162 }
163
164 if (filename.empty())
165 {
166 ATH_MSG_FATAL(" Empty input file! ");
167 return StatusCode::FAILURE;
168 }
169 std::ifstream ifs(filename.c_str());
170 int bec, layer, sector, strawlayer, straw, status;
171 // txt file format : bec sector straw strawlayer layer dead/alive
172 int line = 0;
174 while (ifs >> bec >> sector >> straw >> strawlayer >> layer >> status)
175 {
176 if ((status == 3) || (status == 4) || (status == 5))
177 status = 1;
178 if (status != 1)
179 {
180 ATH_MSG_FATAL(" The Status Temp : " << status << " IS NOT ACCEPTED, Use 1 for dead ");
181 return StatusCode::FAILURE;
182 }
184 line += 1;
185
186 if (straw < 0)
187 {
189 straw = 0;
190 }
191 if (strawlayer < 0)
192 {
194 strawlayer = 0;
195 }
196 if (sector < 0)
197 {
199 sector = 0;
200 }
201 if (layer < 0)
202 {
204 layer = 0;
205 }
206 if (bec < -2)
207 {
209 bec = -2;
210 }
211
213 {
214 if (bec == -1 && sector >= 0 && sector < 32)
215 {
216 if (layer == 0)
217 deadbc0[sector]++;
218 if (layer == 1)
219 deadbc1[sector]++;
220 if (layer == 2)
221 deadbc2[sector]++;
222 }
223 if (bec == 1 && sector >= 0 && sector < 32)
224 {
225 if (layer == 0)
226 deadba0[sector]++;
227 if (layer == 1)
228 deadba1[sector]++;
229 if (layer == 2)
230 deadba2[sector]++;
231 }
232 if (bec == -2 && layer >= 0 && layer < 14)
233 deadec[layer]++;
234 if (bec == 2 && layer >= 0 && layer < 14)
235 deadea[layer]++;
236 }
237 else
238 {
239 ATH_MSG_INFO("Entire Module dead: bec: " << bec << " layer: " << layer << " phi: " << sector << " stl: " << strawlayer << " stw: " << straw << " level " << level);
240 }
241
242 TRTCond::ExpandedIdentifier id(bec, layer, sector, strawlayer, straw, level);
243 // 1 means BAD
244 strawstatus->setStatus(id, 1);
245
246 // I don't know why to set this extra bit 8 here for dead straws. Been always like that. (PH)
247 strawstatus->set(id, 1);
248 Identifier ID = m_trtid->straw_id(bec, sector, layer, strawlayer, straw);
249 set_status_temp(strawstatus, ID, status == 1 ? true : false);
250 }
251
252 ATH_MSG_INFO(" Dead straws BA layer 0");
253 ATH_MSG_INFO("deadba0[] = { " << deadba0[0] << ", " << deadba0[1] << ", " << deadba0[2] << ", " << deadba0[3] << ", " << deadba0[4] << ", " << deadba0[5] << ", " << deadba0[6] << ", " << deadba0[7] << ", " << deadba0[8] << ", " << deadba0[9] << ", " << deadba0[10] << ", " << deadba0[11] << ", " << deadba0[12] << ", " << deadba0[13] << ", " << deadba0[14] << ", " << deadba0[15] << ", " << deadba0[16] << ", " << deadba0[17] << ", " << deadba0[18] << ", " << deadba0[19] << ", " << deadba0[20] << ", " << deadba0[21] << ", " << deadba0[22] << ", " << deadba0[23] << ", " << deadba0[24] << ", " << deadba0[25] << ", " << deadba0[26] << ", " << deadba0[27] << ", " << deadba0[28] << ", " << deadba0[29] << ", " << deadba0[30] << ", " << deadba0[31] << "}; ");
254 ATH_MSG_INFO(" Dead straws BA layer 1 ");
255 ATH_MSG_INFO("deadba1[] = { " << deadba1[0] << ", " << deadba1[1] << ", " << deadba1[2] << ", " << deadba1[3] << ", " << deadba1[4] << ", " << deadba1[5] << ", " << deadba1[6] << ", " << deadba1[7] << ", " << deadba1[8] << ", " << deadba1[9] << ", " << deadba1[10] << ", " << deadba1[11] << ", " << deadba1[12] << ", " << deadba1[13] << ", " << deadba1[14] << ", " << deadba1[15] << ", " << deadba1[16] << ", " << deadba1[17] << ", " << deadba1[18] << ", " << deadba1[19] << ", " << deadba1[20] << ", " << deadba1[21] << ", " << deadba1[22] << ", " << deadba1[23] << ", " << deadba1[24] << ", " << deadba1[25] << ", " << deadba1[26] << ", " << deadba1[27] << ", " << deadba1[28] << ", " << deadba1[29] << ", " << deadba1[30] << ", " << deadba1[31] << "};");
256 ATH_MSG_INFO(" Dead straws BA layer 2");
257 ATH_MSG_INFO("deadba2[]= { " << deadba2[0] << ", " << deadba2[1] << ", " << deadba2[2] << ", " << deadba2[3] << ", " << deadba2[4] << ", " << deadba2[5] << ", " << deadba2[6] << ", " << deadba2[7] << ", " << deadba2[8] << ", " << deadba2[9] << ", " << deadba2[10] << ", " << deadba2[11] << ", " << deadba2[12] << ", " << deadba2[13] << ", " << deadba2[14] << ", " << deadba2[15] << ", " << deadba2[16] << ", " << deadba2[17] << ", " << deadba2[18] << ", " << deadba2[19] << ", " << deadba2[20] << ", " << deadba2[21] << ", " << deadba2[22] << ", " << deadba2[23] << ", " << deadba2[24] << ", " << deadba2[25] << ", " << deadba2[26] << ", " << deadba2[27] << ", " << deadba2[28] << ", " << deadba2[29] << ", " << deadba2[30] << ", " << deadba2[31] << "}; ");
258
259 ATH_MSG_INFO(" Dead straws BC layer 0");
260 ATH_MSG_INFO("deadbc0[] = { " << deadbc0[0] << ", " << deadbc0[1] << ", " << deadbc0[2] << ", " << deadbc0[3] << ", " << deadbc0[4] << ", " << deadbc0[5] << ", " << deadbc0[6] << ", " << deadbc0[7] << ", " << deadbc0[8] << ", " << deadbc0[9] << ", " << deadbc0[10] << ", " << deadbc0[11] << ", " << deadbc0[12] << ", " << deadbc0[13] << ", " << deadbc0[14] << ", " << deadbc0[15] << ", " << deadbc0[16] << ", " << deadbc0[17] << ", " << deadbc0[18] << ", " << deadbc0[19] << ", " << deadbc0[20] << ", " << deadbc0[21] << ", " << deadbc0[22] << ", " << deadbc0[23] << ", " << deadbc0[24] << ", " << deadbc0[25] << ", " << deadbc0[26] << ", " << deadbc0[27] << ", " << deadbc0[28] << ", " << deadbc0[29] << ", " << deadbc0[30] << ", " << deadbc0[31] << "}; ");
261 ATH_MSG_INFO(" Dead straws BC layer 1 ");
262 ATH_MSG_INFO("deadbc1[] = { " << deadbc1[0] << ", " << deadbc1[1] << ", " << deadbc1[2] << ", " << deadbc1[3] << ", " << deadbc1[4] << ", " << deadbc1[5] << ", " << deadbc1[6] << ", " << deadbc1[7] << ", " << deadbc1[8] << ", " << deadbc1[9] << ", " << deadbc1[10] << ", " << deadbc1[11] << ", " << deadbc1[12] << ", " << deadbc1[13] << ", " << deadbc1[14] << ", " << deadbc1[15] << ", " << deadbc1[16] << ", " << deadbc1[17] << ", " << deadbc1[18] << ", " << deadbc1[19] << ", " << deadbc1[20] << ", " << deadbc1[21] << ", " << deadbc1[22] << ", " << deadbc1[23] << ", " << deadbc1[24] << ", " << deadbc1[25] << ", " << deadbc1[26] << ", " << deadbc1[27] << ", " << deadbc1[28] << ", " << deadbc1[29] << ", " << deadbc1[30] << ", " << deadbc1[31] << "};");
263 ATH_MSG_INFO(" Dead straws BC leayer 2");
264 ATH_MSG_INFO("deadbc2[]= { " << deadbc2[0] << ", " << deadbc2[1] << ", " << deadbc2[2] << ", " << deadbc2[3] << ", " << deadbc2[4] << ", " << deadbc2[5] << ", " << deadbc2[6] << ", " << deadbc2[7] << ", " << deadbc2[8] << ", " << deadbc2[9] << ", " << deadbc2[10] << ", " << deadbc2[11] << ", " << deadbc2[12] << ", " << deadbc2[13] << ", " << deadbc2[14] << ", " << deadbc2[15] << ", " << deadbc2[16] << ", " << deadbc2[17] << ", " << deadbc2[18] << ", " << deadbc2[19] << ", " << deadbc2[20] << ", " << deadbc2[21] << ", " << deadbc2[22] << ", " << deadbc2[23] << ", " << deadbc2[24] << ", " << deadbc2[25] << ", " << deadbc2[26] << ", " << deadbc2[27] << ", " << deadbc2[28] << ", " << deadbc2[29] << ", " << deadbc2[30] << ", " << deadbc2[31] << "}; ");
265
266 ATH_MSG_INFO(" Dead straws EA");
267 ATH_MSG_INFO("deadea[] = { " << deadea[0] << ", " << deadea[1] << ", " << deadea[2] << ", " << deadea[3] << ", " << deadea[4] << ", " << deadea[5] << ", " << deadea[6] << ", " << deadea[7] << ", " << deadea[8] << ", " << deadea[9] << ", " << deadea[10] << ", " << deadea[11] << ", " << deadea[12] << ", " << deadea[13] << "}; ");
268 ATH_MSG_INFO(" Dead straws EC");
269 ATH_MSG_INFO("deadec[] = { " << deadec[0] << ", " << deadec[1] << ", " << deadec[2] << ", " << deadec[3] << ", " << deadec[4] << ", " << deadec[5] << ", " << deadec[6] << ", " << deadec[7] << ", " << deadec[8] << ", " << deadec[9] << ", " << deadec[10] << ", " << deadec[11] << ", " << deadec[12] << ", " << deadec[13] << "}; ");
270
271 ATH_MSG_INFO("Recording StrawStatus Container. Number of dead straws " << line << " straws");
272 if ((detStore()->record(strawstatus, m_par_strawstatuscontainerkey)) != StatusCode::SUCCESS)
273 {
274 ATH_MSG_ERROR("Could not record StrawStatus Container for key " << m_par_strawstatuscontainerkey);
275 return StatusCode::FAILURE;
276 }
277 else
278 {
279 ATH_MSG_INFO("Recorded StrawStatus container " << m_par_strawstatuscontainerkey << " with DetStore ");
280 }
281
282 return StatusCode::SUCCESS;
283}
#define ATH_MSG_FATAL(x)
std::vector< Identifier > ID
virtual void set_status_temp(StrawStatusContainer *ssc, Identifier offlineID, bool set)
TRTCond::StrawStatusMultChanContainer StrawStatusContainer
l
Printing final latex table to .tex output file.
@ layer
Definition HitInfo.h:79
@ straw
Definition HitInfo.h:82
status
Definition merge.py:16

◆ readStatHTFromTextFile()

StatusCode TRTStrawStatusWrite::readStatHTFromTextFile ( const std::string & filename)
virtual

Definition at line 285 of file TRTStrawStatusWrite.cxx.

286{
287
288 StrawStatusContainer *strawstatusHT = new TRTCond::StrawStatusMultChanContainer();
289
290 strawstatusHT->clear();
291
292 ATH_MSG_INFO(" ***************** TRTStrawStatusWrite ************************ ");
293 ATH_MSG_INFO(" readStatHTFromTextFile called with file name " << filename);
294
295 std::ifstream ifsHT(filename.c_str());
296 if (ifsHT)
297 {
298
299 // initialize detector layers with Good like in rel21 (PH: Good and Xenon is treated as the same)
300 int lineXe = 0;
301 TRTCond::ExpandedIdentifier iddet(0, 0, 0, 0, 0, TRTCond::ExpandedIdentifier::DETECTOR);
302 strawstatusHT->setStatus(iddet, TRTCond::StrawStatus::Good);
303
304 for (int l = 0; l < 3; l++)
305 {
306
307 TRTCond::ExpandedIdentifier idbc(-1, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
308 strawstatusHT->setStatus(idbc, TRTCond::StrawStatus::Good);
309 TRTCond::ExpandedIdentifier idba(1, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
310 strawstatusHT->setStatus(idba, TRTCond::StrawStatus::Good);
311 lineXe += 2;
312 }
313 for (int l = 0; l < 14; l++)
314 {
315 TRTCond::ExpandedIdentifier idec(-2, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
316 strawstatusHT->setStatus(idec, TRTCond::StrawStatus::Good);
317 TRTCond::ExpandedIdentifier idea(2, l, 0, 0, 0, TRTCond::ExpandedIdentifier::LAYERWHEEL);
318 strawstatusHT->setStatus(idea, TRTCond::StrawStatus::Good);
319 lineXe += 2;
320 }
321
322 int bec, layer, sector, strawlayer, straw, status;
323 // txt file format : bec sector straw strawlayer layer dead/alive
324 int line = 0;
325 int lineAr = 0;
326 int lineKr = 0;
327 int lineEAr = 0;
328 int lineEKr = 0;
329
330 while (ifsHT >> bec >> sector >> strawlayer >> straw >> layer >> status)
331 {
333
334 line += 1;
335 if (straw < 0)
336 {
338 straw = 0;
339 }
340 if (strawlayer < 0)
341 {
343 strawlayer = 0;
344 }
345 if (sector < 0)
346 {
348 sector = 0;
349 }
350 if (layer < 0)
351 {
353 layer = 0;
354 }
355 if (bec < -2)
356 {
358 bec = -2;
359 }
360
361 ATH_MSG_INFO("Layer/Wheel with Argon: bec: " << bec << " layer: " << layer << " phi: " << sector << " stl: " << strawlayer << " stw: " << straw << " status (" << TRTCond::StrawStatus::Argon << " is Argon): " << status << " level (" << TRTCond::ExpandedIdentifier::LAYERWHEEL << " is LAYERWHEEL) " << level);
362 TRTCond::ExpandedIdentifier id(bec, layer, sector, strawlayer, straw, level);
363 if (status == 4)
364 { // Argon
365 strawstatusHT->setStatus(id, TRTCond::StrawStatus::Argon);
366 lineAr += 1;
367 lineXe -= 1;
368 }
369 else if (status == 5)
370 { // Krypton
371 strawstatusHT->setStatus(id, TRTCond::StrawStatus::Krypton);
372 lineKr += 1;
373 lineXe -= 1;
374 }
375 else if (status == 6)
376 { // EmulateArgon
377 strawstatusHT->setStatus(id, TRTCond::StrawStatus::EmulateArgon);
378 lineEAr += 1;
379 }
380 else if (status == 7)
381 { // EmulateKrypton
382 strawstatusHT->setStatus(id, TRTCond::StrawStatus::EmulateKrypton);
383 lineEKr += 1;
384 lineXe -= 1;
385 }
386 else
387 {
388 ATH_MSG_FATAL(" The HT Status: " << status << " IS NOT ACCEPTED, 4 for Argon, 5 for Krypton!! "
389 << " Or 6 or 7 for emulated types!");
390 return StatusCode::FAILURE;
391 }
392 }
393 ATH_MSG_INFO("All the rest is running Xenon");
394 ATH_MSG_INFO("HT Status. Read " << line << " layers. " << " Xenon: " << lineXe << " Argon: " << lineAr << " Krypton: " << lineKr << " EmulateArgon: " << lineEAr << " EmulateKrypton: " << lineEKr);
395
396 if ((detStore()->record(strawstatusHT, m_par_strawstatusHTcontainerkey)) != StatusCode::SUCCESS)
397 {
398 ATH_MSG_ERROR("Could not record StrawStatusHT Container for key " << m_par_strawstatusHTcontainerkey);
399 return StatusCode::FAILURE;
400 }
401 else
402 {
403 ATH_MSG_INFO("Recorded StrawStatusHT container " << m_par_strawstatusHTcontainerkey << " with DetStore ");
404 }
405 }
406 else
407 {
408 ATH_MSG_WARNING(" The HT Status input file not found ");
409 }
410 return StatusCode::SUCCESS;
411}
#define ATH_MSG_WARNING(x)

◆ readStatPermFromTextFile()

StatusCode TRTStrawStatusWrite::readStatPermFromTextFile ( const std::string & filename)
virtual

Definition at line 413 of file TRTStrawStatusWrite.cxx.

414{
415
416 StrawStatusContainer *strawstatuspermanent = new TRTCond::StrawStatusMultChanContainer();
417 strawstatuspermanent->clear();
418
419 ATH_MSG_INFO(" readStatPermFromTextFile called with file name " << filename);
420
421 std::ifstream ifspermanent(filename.c_str());
422
423 if (ifspermanent)
424 {
425
426 // initialize all straws with status 'Good'
427 for (std::vector<Identifier>::const_iterator it = m_trtid->straw_layer_begin(); it != m_trtid->straw_layer_end(); ++it)
428 {
429 Identifier id = m_trtid->straw_id(*it, 0);
430 int m = m_trtid->phi_module(id);
431 int n = m_trtid->barrel_ec(id);
432 int l = m_trtid->layer_or_wheel(id);
433 int nStrawsInLayer = m_trtid->straw_max(*it);
434 int sl = m_trtid->straw_layer(id);
435 for (int i = 0; i <= nStrawsInLayer; i++)
436 {
437 id = m_trtid->straw_id(*it, i);
438 TRTCond::ExpandedIdentifier expid(n, l, m, sl, i, TRTCond::ExpandedIdentifier::STRAW);
439 strawstatuspermanent->setStatus(expid, TRTCond::StrawStatus::Good);
440 }
441 }
442 int bec, layer, sector, strawlayer, straw, status;
443 // txt file format : bec sector straw strawlayer layer dead/alive
444 int line = 0;
445 int nmodu = 0;
446 while (ifspermanent >> bec >> sector >> straw >> strawlayer >> layer >> status)
447 {
448 if ((status == 3) || (status == 4) || (status == 5))
449 status = 1;
450 if (status != 1)
451 {
452 ATH_MSG_FATAL(" The Status Permanent: " << status << " IS NOT ACCEPTED, Use 1 for dead ");
453 return StatusCode::FAILURE;
454 }
456 line += 1;
457
458 // Expect the line to ask for either an entire modules or an individual straw to be turned off
459 if (strawlayer < 0)
460 {
461 std::cout << " Read permanent dead module from txt: " << bec << " ,sector " << sector << " ,straw " << straw << " ,strawlayer " << strawlayer << " ,layer " << layer << " ,status " << status << std::endl;
462 for (std::vector<Identifier>::const_iterator it = m_trtid->straw_layer_begin(); it != m_trtid->straw_layer_end(); ++it)
463 {
464 Identifier id = m_trtid->straw_id(*it, 0);
465 int m = m_trtid->phi_module(id);
466 int n = m_trtid->barrel_ec(id);
467 int l = m_trtid->layer_or_wheel(id);
468 if (n != bec || m != sector || l != layer)
469 continue;
470
471 int nStrawsInLayer = m_trtid->straw_max(*it);
472 int sl = m_trtid->straw_layer(id);
473 for (int i = 0; i <= nStrawsInLayer; i++)
474 {
475 id = m_trtid->straw_id(*it, i);
476 TRTCond::ExpandedIdentifier expid(bec, layer, sector, sl, i, level);
477 strawstatuspermanent->setStatus(expid, TRTCond::StrawStatus::Dead);
478 }
479 }
480 nmodu++;
481 }
482 else
483 {
484 TRTCond::ExpandedIdentifier expid(bec, layer, sector, strawlayer, straw, level);
485 strawstatuspermanent->setStatus(expid, TRTCond::StrawStatus::Dead);
486 }
487
488 ATH_MSG_DEBUG("Permanent dead ids: bec: " << bec << " layer: " << layer << " phi: " << sector << " stl: " << strawlayer << " stw: " << straw);
489 } // end reading input text file
490
491 ATH_MSG_INFO(" Record Permanent Straw Status. Dead modules : " << nmodu << " Number of lines: " << line << " of dead identifiers ");
492 if ((detStore()->record(strawstatuspermanent, m_par_strawstatuspermanentcontainerkey)) != StatusCode::SUCCESS)
493 {
494 ATH_MSG_ERROR("Could not record StrawStatusPermanent Container for key " << m_par_strawstatuspermanentcontainerkey);
495 return StatusCode::FAILURE;
496 }
497 else
498 {
499 ATH_MSG_INFO("Recorded StrawStatusPermanent container " << m_par_strawstatuspermanentcontainerkey << " with DetStore ");
500 }
501 }
502 return StatusCode::SUCCESS;
503}
#define ATH_MSG_DEBUG(x)

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ set_status_permanent()

void TRTStrawStatusWrite::set_status_permanent ( StrawStatusContainer * ssc,
Identifier offlineID,
bool set )
virtual

Definition at line 96 of file TRTStrawStatusWrite.cxx.

97{
98
100 TRTCond::ExpandedIdentifier id = TRTCond::ExpandedIdentifier(m_trtid->barrel_ec(offlineID), m_trtid->layer_or_wheel(offlineID),
101 m_trtid->phi_module(offlineID), m_trtid->straw_layer(offlineID),
102 m_trtid->straw(offlineID), level);
103 unsigned int org_stat = int((*strawstatuspermanentcontainer).get(id).getstatus());
104 const unsigned int statusbitmask = 1 << 8; // 0000001 00000000
105
106 if (set)
107 {
108 (*strawstatuspermanentcontainer).set(id, (org_stat | statusbitmask));
109 }
110 else
111 {
112 (*strawstatuspermanentcontainer).set(id, (org_stat & (~statusbitmask)));
113 }
114}

◆ set_status_temp()

void TRTStrawStatusWrite::set_status_temp ( StrawStatusContainer * ssc,
Identifier offlineID,
bool set )
virtual

Definition at line 75 of file TRTStrawStatusWrite.cxx.

76{
78 TRTCond::ExpandedIdentifier id = TRTCond::ExpandedIdentifier(m_trtid->barrel_ec(offlineID), m_trtid->layer_or_wheel(offlineID),
79 m_trtid->phi_module(offlineID), m_trtid->straw_layer(offlineID),
80 m_trtid->straw(offlineID), level);
81
82 unsigned int org_stat = int((*strawstatuscontainer).get(id).getstatus());
83 const unsigned int statusbitmask = 1 << 8; // 0000001 00000000
84
85 if (set)
86 {
87 (*strawstatuscontainer).set(id, (org_stat | statusbitmask));
88 }
89 else
90 {
91 (*strawstatuscontainer).set(id, (org_stat & (~statusbitmask)));
92 }
93}

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_par_stattextfile

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_stattextfile {this, "StatusInputFile", "", "input text file"}
private

Definition at line 51 of file TRTStrawStatusWrite.h.

51{this, "StatusInputFile", "", "input text file"};

◆ m_par_stattextfileHT

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_stattextfileHT {this, "StatusInputFileHT", "", "input text file: HT"}
private

Definition at line 53 of file TRTStrawStatusWrite.h.

53{this, "StatusInputFileHT", "", "input text file: HT"};

◆ m_par_stattextfilepermanent

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_stattextfilepermanent {this, "StatusInputFilePermanent", "", "input text file: permanent"}
private

Definition at line 52 of file TRTStrawStatusWrite.h.

52{this, "StatusInputFilePermanent", "", "input text file: permanent"};

◆ m_par_strawstatuscontainerkey

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_strawstatuscontainerkey {this, "StrawStatusKey", "/TRT/Cond/Status", ""}
private

Definition at line 47 of file TRTStrawStatusWrite.h.

47{this, "StrawStatusKey", "/TRT/Cond/Status", ""};

◆ m_par_strawstatusHTcontainerkey

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_strawstatusHTcontainerkey {this, "StrawStatusHTKey", "/TRT/Cond/StatusHT", ""}
private

Definition at line 49 of file TRTStrawStatusWrite.h.

49{this, "StrawStatusHTKey", "/TRT/Cond/StatusHT", ""};

◆ m_par_strawstatuspermanentcontainerkey

Gaudi::Property<std::string> TRTStrawStatusWrite::m_par_strawstatuspermanentcontainerkey {this, "StrawStatusPermanentKey", "/TRT/Cond/StatusPermanent", ""}
private

Definition at line 48 of file TRTStrawStatusWrite.h.

48{this, "StrawStatusPermanentKey", "/TRT/Cond/StatusPermanent", ""};

◆ m_trtid

const TRT_ID* TRTStrawStatusWrite::m_trtid {}
private

Definition at line 55 of file TRTStrawStatusWrite.h.

55{}; // TRT id helper

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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