ATLAS Offline Software
TRTStrawStatusWrite.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 //
15 #include <fstream>
16 #include <iostream>
17 #include <iomanip>
18 #include <sstream>
19 #include <stdio.h>
22 
23 
24 TRTStrawStatusWrite::TRTStrawStatusWrite( const std::string &name, ISvcLocator *pSvcLocator) :
25  AthAlgorithm( name, pSvcLocator ),
26  m_detStore("DetectorStore",name),
27  m_par_strawstatuscontainerkey("/TRT/Cond/Status"),
28  m_par_strawstatuspermanentcontainerkey("/TRT/Cond/StatusPermanent"),
29  m_par_strawstatusHTcontainerkey("/TRT/Cond/StatusHT"),
30  m_par_stattextfile(""),
31  m_par_stattextfilepermanent(""),
32  m_par_stattextfileHT(""),
33  m_trtid(0),
34  m_status("TRT_StrawStatusSummaryTool",this)
35 {
36 
37  declareProperty("StatusInputFile",m_par_stattextfile);
38  declareProperty("StatusInputFilePermanent",m_par_stattextfilepermanent);
39  declareProperty("StatusInputFileHT",m_par_stattextfileHT);
40  declareProperty("SummaryTool",m_status);
41 }
42 
44 {
45 
46  ATH_MSG_INFO( " Initializing TRTStrawStatusWrite " );
47  // Retrieve the DetectorStore
48  if (StatusCode::SUCCESS!=m_detStore.retrieve()) {
49  ATH_MSG_FATAL( "Unable to retrieve " << m_detStore.name());
50  return StatusCode::FAILURE;
51  }
52 
53  // Get the TRT ID helper
54  if (StatusCode::SUCCESS!=m_detStore->retrieve(m_trtid,"TRT_ID")) {
55  ATH_MSG_FATAL( "Problem retrieving TRTID helper" );
56  return StatusCode::FAILURE;
57  }
58 
59  StatusCode sc;
60  if (!m_par_stattextfile.empty()) {
61  ATH_MSG_INFO( "Recording StrawStatusContainer for key " << m_par_strawstatuscontainerkey );
63  if(sc!=StatusCode::SUCCESS) {
64  ATH_MSG_ERROR(" Could not read TRT StrawStatus objects ");
65  return StatusCode::FAILURE;
66  } else {
67  ATH_MSG_INFO(" Filled " << m_par_strawstatuscontainerkey << " using input file " << m_par_stattextfile );
68  }
69 
70  }
71 
72 
73  if (!m_par_stattextfilepermanent.empty()) {
74  ATH_MSG_INFO( "Recording StrawStatusPermanent Container for key " << m_par_strawstatuspermanentcontainerkey );
76  if(sc!=StatusCode::SUCCESS) {
77  ATH_MSG_ERROR(" Could not read TRT StrawStatus permanent objects ");
78  return StatusCode::FAILURE;
79  } else {
80  ATH_MSG_INFO(" Filled " << m_par_strawstatuspermanentcontainerkey << " using input file " << m_par_stattextfilepermanent );
81  }
82 
83  }
84 
85 
86  if (!m_par_stattextfileHT.empty()) {
87  ATH_MSG_INFO( "Recording StrawStatusHTContainer for key " << m_par_strawstatusHTcontainerkey );
89  if(sc!=StatusCode::SUCCESS) {
90  ATH_MSG_ERROR(" Could not read TRT StrawStatus HT objects ");
91  return StatusCode::FAILURE;
92  } else {
93  ATH_MSG_INFO(" Filled " << m_par_strawstatusHTcontainerkey << " using input file " << m_par_stattextfileHT );
94  }
95 
96  }
97 
98  return StatusCode::SUCCESS;
99 }
100 
102 {
103  return StatusCode::SUCCESS;
104 }
105 
107 {
108  return StatusCode::SUCCESS;
109 }
110 
111 
112 //set special bits//////////////////////////////////////////////////
113 void TRTStrawStatusWrite::set_status_temp(StrawStatusContainer* strawstatuscontainer, Identifier offlineID, bool set){
116  m_trtid->phi_module(offlineID),m_trtid->straw_layer(offlineID),
117  m_trtid->straw(offlineID),level );
118 
119  unsigned int org_stat = int((*strawstatuscontainer).get(id).getstatus());
120  const unsigned int statusbitmask = 1 << 8;// 0000001 00000000
121 
122 
123  if (set) { (*strawstatuscontainer).set(id, (org_stat|statusbitmask)); }else{ (*strawstatuscontainer).set(id, (org_stat & (~statusbitmask) )); }
124 }
125 
126 
127 //set special bits////////////////////////////////////////////////
128 void TRTStrawStatusWrite::set_status_permanent(StrawStatusContainer* strawstatuspermanentcontainer, Identifier offlineID, bool set){
129 
132  m_trtid->phi_module(offlineID),m_trtid->straw_layer(offlineID),
133  m_trtid->straw(offlineID),level );
134  unsigned int org_stat = int((*strawstatuspermanentcontainer).get(id).getstatus());
135  const unsigned int statusbitmask = 1 << 8;// 0000001 00000000
136 
137  if (set) { (*strawstatuspermanentcontainer).set(id, (org_stat|statusbitmask)); }else{ (*strawstatuspermanentcontainer).set(id, (org_stat & (~statusbitmask) )); }
138 
139 }
140 
143 {
144 
146 
147  strawstatus->clear();
148  ATH_MSG_INFO( " ***************** TRTStrawStatusWrite ************************ ");
149  ATH_MSG_INFO( " readStatFromTextFile called with file name " << filename );
150 
151  const InDetDD::TRT_DetectorManager* TRTDetectorManager ;
152  if ((m_detStore->retrieve(TRTDetectorManager)).isFailure()) {
153  ATH_MSG_FATAL( "Problem retrieving TRT_DetectorManager" );
154  }
155 
156  int deadba0[32];
157  int deadba1[32];
158  int deadba2[32];
159  int deadbc0[32];
160  int deadbc1[32];
161  int deadbc2[32];
162  int deadea[14];
163  int deadec[14];
164  for(int i=0;i<32;i++){
165  deadba0[i]=0;
166  deadba1[i]=0;
167  deadba2[i]=0;
168  deadbc0[i]=0;
169  deadbc1[i]=0;
170  deadbc2[i]=0;
171  }
172  for(int i=0;i<14;i++){
173  deadea[i]=0;
174  deadec[i]=0;
175  }
176  // initialize detector layers with status 'good'
177  for(int l=0;l<3;l++) {
179  strawstatus->setStatus(idbc,TRTCond::StrawStatus::Good);
181  strawstatus->setStatus(idba,TRTCond::StrawStatus::Good);
182  }
183  for(int l=0;l<14;l++) {
185  strawstatus->setStatus(idec,TRTCond::StrawStatus::Good);
187  strawstatus->setStatus(idea,TRTCond::StrawStatus::Good);
188  }
189 
190 
191 
192  if(filename.empty()) {
193  ATH_MSG_FATAL( " Empty input file! " );
194  return StatusCode::FAILURE;
195  }
196  std::ifstream ifs(filename.c_str()) ;
197  int bec, layer, sector, strawlayer, straw, status ;
198  //txt file format : bec sector straw strawlayer layer dead/alive
199  int line =0 ;
200  ATH_MSG_INFO( "StrawStatus levels: strawlayer: " << TRTCond::ExpandedIdentifier::STRAWLAYER << " module: " << TRTCond::ExpandedIdentifier::MODULE << " layer: " << TRTCond::ExpandedIdentifier::LAYERWHEEL );
201  while( ifs >> bec >> sector>> straw >> strawlayer >> layer >> status ) {
202  if ( (status == 3) || (status == 4) || (status == 5) ) status = 1;
203  if (status!=1){
204  ATH_MSG_FATAL( " The Status Temp : " << status << " IS NOT ACCEPTED, Use 1 for dead " );
205  return StatusCode::FAILURE;
206  }
208  line +=1;
209 
211  if( strawlayer<0 ) { level = TRTCond::ExpandedIdentifier::MODULE ; strawlayer = 0 ; }
212  if( sector<0 ) { level = TRTCond::ExpandedIdentifier::LAYERWHEEL ; sector = 0 ; }
214  if( bec<-2 ) { level = TRTCond::ExpandedIdentifier::DETECTOR ; bec = -2 ; }
215 
217  if(bec==-1 && sector>=0 && sector <32) {
218  if(layer==0) deadbc0[sector]++;
219  if(layer==1) deadbc1[sector]++;
220  if(layer==2) deadbc2[sector]++;
221  }
222  if(bec==1 && sector>=0 && sector <32) {
223  if(layer==0) deadba0[sector]++;
224  if(layer==1) deadba1[sector]++;
225  if(layer==2) deadba2[sector]++;
226  }
227  if(bec==-2 && layer>=0 && layer <14) deadec[layer]++;
228  if(bec==2 && layer>=0 && layer <14) deadea[layer]++;
229  } else {
230  ATH_MSG_INFO( "Entire Module dead: bec: " << bec << " layer: " << layer << " phi: " << sector << " stl: " << strawlayer << " stw: " << straw << " level " << level);
231  }
232 
233  TRTCond::ExpandedIdentifier id( bec,layer,sector,strawlayer,straw,level);
234  // 1 means BAD
235  strawstatus->setStatus(id,1) ;
236 
237  // I don't know why to set this extra bit 8 here for dead straws. Been always like that. (PH)
238  strawstatus->set(id,1);
239  Identifier ID = m_trtid->straw_id(bec,sector,layer,strawlayer,straw);
240  set_status_temp(strawstatus, ID,status==1?true:false);
241 
242  }
243 
244  ATH_MSG_INFO ( " Dead straws BA layer 0" );
245  ATH_MSG_INFO ( "deadba0[] = { " << deadba0[0] << ", " << deadba0[1] << ", " << deadba0[2] << ", " << deadba0[3] << ", " <<
246  deadba0[4] << ", " << deadba0[5] << ", " << deadba0[6] << ", " << deadba0[7] << ", " <<
247  deadba0[8] << ", " << deadba0[9] << ", " << deadba0[10] << ", " << deadba0[11] << ", " <<
248  deadba0[12] << ", " << deadba0[13] << ", " << deadba0[14] << ", " << deadba0[15] << ", " <<
249  deadba0[16] << ", " << deadba0[17] << ", " << deadba0[18] << ", " << deadba0[19] << ", " <<
250  deadba0[20] << ", " << deadba0[21] << ", " << deadba0[22] << ", " << deadba0[23] << ", " <<
251  deadba0[24] << ", " << deadba0[25] << ", " << deadba0[26] << ", " << deadba0[27] << ", " <<
252  deadba0[28] << ", " << deadba0[29] << ", " << deadba0[30] << ", " << deadba0[31] << "}; " );
253  ATH_MSG_INFO ( " Dead straws BA layer 1 ");
254  ATH_MSG_INFO ( "deadba1[] = { " << deadba1[0] << ", " << deadba1[1] << ", " << deadba1[2] << ", " << deadba1[3] << ", " <<
255  deadba1[4] << ", " << deadba1[5] << ", " << deadba1[6] << ", " << deadba1[7] << ", " <<
256  deadba1[8] << ", " << deadba1[9] << ", " << deadba1[10] << ", " << deadba1[11] << ", " <<
257  deadba1[12] << ", " << deadba1[13] << ", " << deadba1[14] << ", " << deadba1[15] << ", " <<
258  deadba1[16] << ", " << deadba1[17] << ", " << deadba1[18] << ", " << deadba1[19] << ", " <<
259  deadba1[20] << ", " << deadba1[21] << ", " << deadba1[22] << ", " << deadba1[23] << ", " <<
260  deadba1[24] << ", " << deadba1[25] << ", " << deadba1[26] << ", " << deadba1[27] << ", " <<
261  deadba1[28] << ", " << deadba1[29] << ", " << deadba1[30] << ", " << deadba1[31] << "};");
262  ATH_MSG_INFO (" Dead straws BA layer 2");
263  ATH_MSG_INFO ( "deadba2[]= { " << deadba2[0] << ", " << deadba2[1] << ", " << deadba2[2] << ", " << deadba2[3] << ", " <<
264  deadba2[4] << ", " << deadba2[5] << ", " << deadba2[6] << ", " << deadba2[7] << ", " <<
265  deadba2[8] << ", " << deadba2[9] << ", " << deadba2[10] << ", " << deadba2[11] << ", " <<
266  deadba2[12] << ", " << deadba2[13] << ", " << deadba2[14] << ", " << deadba2[15] << ", " <<
267  deadba2[16] << ", " << deadba2[17] << ", " << deadba2[18] << ", " << deadba2[19] << ", " <<
268  deadba2[20] << ", " << deadba2[21] << ", " << deadba2[22] << ", " << deadba2[23] << ", " <<
269  deadba2[24] << ", " << deadba2[25] << ", " << deadba2[26] << ", " << deadba2[27] << ", " <<
270  deadba2[28] << ", " << deadba2[29] << ", " << deadba2[30] << ", " << deadba2[31] << "}; ");
271 
272  ATH_MSG_INFO ( " Dead straws BC layer 0" );
273  ATH_MSG_INFO ( "deadbc0[] = { " << deadbc0[0] << ", " << deadbc0[1] << ", " << deadbc0[2] << ", " << deadbc0[3] << ", " <<
274  deadbc0[4] << ", " << deadbc0[5] << ", " << deadbc0[6] << ", " << deadbc0[7] << ", " <<
275  deadbc0[8] << ", " << deadbc0[9] << ", " << deadbc0[10] << ", " << deadbc0[11] << ", " <<
276  deadbc0[12] << ", " << deadbc0[13] << ", " << deadbc0[14] << ", " << deadbc0[15] << ", " <<
277  deadbc0[16] << ", " << deadbc0[17] << ", " << deadbc0[18] << ", " << deadbc0[19] << ", " <<
278  deadbc0[20] << ", " << deadbc0[21] << ", " << deadbc0[22] << ", " << deadbc0[23] << ", " <<
279  deadbc0[24] << ", " << deadbc0[25] << ", " << deadbc0[26] << ", " << deadbc0[27] << ", " <<
280  deadbc0[28] << ", " << deadbc0[29] << ", " << deadbc0[30] << ", " << deadbc0[31] << "}; " );
281  ATH_MSG_INFO ( " Dead straws BC layer 1 ");
282  ATH_MSG_INFO ( "deadbc1[] = { " << deadbc1[0] << ", " << deadbc1[1] << ", " << deadbc1[2] << ", " << deadbc1[3] << ", " <<
283  deadbc1[4] << ", " << deadbc1[5] << ", " << deadbc1[6] << ", " << deadbc1[7] << ", " <<
284  deadbc1[8] << ", " << deadbc1[9] << ", " << deadbc1[10] << ", " << deadbc1[11] << ", " <<
285  deadbc1[12] << ", " << deadbc1[13] << ", " << deadbc1[14] << ", " << deadbc1[15] << ", " <<
286  deadbc1[16] << ", " << deadbc1[17] << ", " << deadbc1[18] << ", " << deadbc1[19] << ", " <<
287  deadbc1[20] << ", " << deadbc1[21] << ", " << deadbc1[22] << ", " << deadbc1[23] << ", " <<
288  deadbc1[24] << ", " << deadbc1[25] << ", " << deadbc1[26] << ", " << deadbc1[27] << ", " <<
289  deadbc1[28] << ", " << deadbc1[29] << ", " << deadbc1[30] << ", " << deadbc1[31] << "};");
290  ATH_MSG_INFO (" Dead straws BC leayer 2");
291  ATH_MSG_INFO ( "deadbc2[]= { " << deadbc2[0] << ", " << deadbc2[1] << ", " << deadbc2[2] << ", " << deadbc2[3] << ", " <<
292  deadbc2[4] << ", " << deadbc2[5] << ", " << deadbc2[6] << ", " << deadbc2[7] << ", " <<
293  deadbc2[8] << ", " << deadbc2[9] << ", " << deadbc2[10] << ", " << deadbc2[11] << ", " <<
294  deadbc2[12] << ", " << deadbc2[13] << ", " << deadbc2[14] << ", " << deadbc2[15] << ", " <<
295  deadbc2[16] << ", " << deadbc2[17] << ", " << deadbc2[18] << ", " << deadbc2[19] << ", " <<
296  deadbc2[20] << ", " << deadbc2[21] << ", " << deadbc2[22] << ", " << deadbc2[23] << ", " <<
297  deadbc2[24] << ", " << deadbc2[25] << ", " << deadbc2[26] << ", " << deadbc2[27] << ", " <<
298  deadbc2[28] << ", " << deadbc2[29] << ", " << deadbc2[30] << ", " << deadbc2[31] << "}; ");
299 
300  ATH_MSG_INFO (" Dead straws EA" );
301  ATH_MSG_INFO ("deadea[] = { " << deadea[0] << ", " << deadea[1] << ", " << deadea[2] << ", " << deadea[3] << ", " <<
302  deadea[4] << ", " << deadea[5] << ", " << deadea[6] << ", " << deadea[7] << ", " <<
303  deadea[8] << ", " << deadea[9] << ", " << deadea[10] << ", " << deadea[11] << ", " <<
304  deadea[12] << ", " << deadea[13] << "}; ");
305  ATH_MSG_INFO (" Dead straws EC" );
306  ATH_MSG_INFO ("deadec[] = { " << deadec[0] << ", " << deadec[1] << ", " << deadec[2] << ", " << deadec[3] << ", " <<
307  deadec[4] << ", " << deadec[5] << ", " << deadec[6] << ", " << deadec[7] << ", " <<
308  deadec[8] << ", " << deadec[9] << ", " << deadec[10] << ", " << deadec[11] << ", " <<
309  deadec[12] << ", " << deadec[13] << "}; " );
310 
311  ATH_MSG_INFO( "Recording StrawStatus Container. Number of dead straws " << line << " straws" );
312  if( (m_detStore->record(strawstatus,m_par_strawstatuscontainerkey))!=StatusCode::SUCCESS ) {
313  ATH_MSG_ERROR( "Could not record StrawStatus Container for key " << m_par_strawstatuscontainerkey );
314  return StatusCode::FAILURE;
315  } else {
316  ATH_MSG_INFO("Recorded StrawStatus container " << m_par_strawstatuscontainerkey << " with DetStore ");
317  }
318 
319 
320  return StatusCode::SUCCESS;
321 }
322 
323 
325 {
326 
328 
329  strawstatusHT->clear();
330 
331  ATH_MSG_INFO( " ***************** TRTStrawStatusWrite ************************ ");
332  ATH_MSG_INFO( " readStatHTFromTextFile called with file name " << filename );
333 
334 
335  std::ifstream ifsHT(filename.c_str()) ;
336  if(ifsHT) {
337 
338  const InDetDD::TRT_DetectorManager* TRTDetectorManager ;
339  if ((m_detStore->retrieve(TRTDetectorManager)).isFailure()) {
340  ATH_MSG_FATAL( "Problem retrieving TRT_DetectorManager");
341  }
342 
343  // initialize detector layers with Good like in rel21 (PH: Good and Xenon is treated as the same)
344  int lineXe=0;
346  strawstatusHT->setStatus(iddet,TRTCond::StrawStatus::Good);
347 
348  for(int l=0;l<3;l++) {
349 
351  strawstatusHT->setStatus(idbc,TRTCond::StrawStatus::Good);
353  strawstatusHT->setStatus(idba,TRTCond::StrawStatus::Good);
354  lineXe+=2;
355  }
356  for(int l=0;l<14;l++) {
358  strawstatusHT->setStatus(idec,TRTCond::StrawStatus::Good);
360  strawstatusHT->setStatus(idea,TRTCond::StrawStatus::Good);
361  lineXe+=2;
362  }
363 
364  int bec, layer, sector, strawlayer, straw, status ;
365  //txt file format : bec sector straw strawlayer layer dead/alive
366  int line = 0;
367  int lineAr = 0;
368  int lineKr = 0;
369  int lineEAr = 0;
370  int lineEKr = 0;
371 
372  while( ifsHT >> bec >> sector >> strawlayer >> straw >> layer >> status ) {
374 
375  line +=1;
377  if( strawlayer<0 ) { level = TRTCond::ExpandedIdentifier::MODULE ; strawlayer = 0 ; }
378  if( sector<0 ) { level = TRTCond::ExpandedIdentifier::LAYERWHEEL ; sector = 0 ; }
380  if( bec<-2 ) { level = TRTCond::ExpandedIdentifier::DETECTOR ; bec = -2 ; }
381 
382  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);
383  TRTCond::ExpandedIdentifier id( bec,layer,sector,strawlayer,straw,level);
384  if (status == 4){ // Argon
385  strawstatusHT->setStatus(id,TRTCond::StrawStatus::Argon) ;
386  lineAr+=1;
387  lineXe-=1;
388  }
389  else if (status == 5){ // Krypton
390  strawstatusHT->setStatus(id,TRTCond::StrawStatus::Krypton) ;
391  lineKr+=1;
392  lineXe-=1;
393  }
394  else if (status == 6){ // EmulateArgon
395  strawstatusHT->setStatus(id,TRTCond::StrawStatus::EmulateArgon) ;
396  lineEAr+=1;
397  }
398  else if (status == 7){ // EmulateKrypton
400  lineEKr+=1;
401  lineXe-=1;
402  }
403  else{
404  ATH_MSG_FATAL( " The HT Status: " << status << " IS NOT ACCEPTED, 4 for Argon, 5 for Krypton!! "
405  << " Or 6 or 7 for emulated types!" );
406  return StatusCode::FAILURE;
407  }
408 
409  }
410  ATH_MSG_INFO( "All the rest is running Xenon");
411  ATH_MSG_INFO( "HT Status. Read " << line << " layers. " << " Xenon: " << lineXe << " Argon: "<< lineAr << " Krypton: " << lineKr << " EmulateArgon: " << lineEAr << " EmulateKrypton: " << lineEKr );
412 
413  if( (m_detStore->record(strawstatusHT,m_par_strawstatusHTcontainerkey))!=StatusCode::SUCCESS ) {
414  ATH_MSG_ERROR( "Could not record StrawStatusHT Container for key " << m_par_strawstatusHTcontainerkey );
415  return StatusCode::FAILURE;
416  } else {
417  ATH_MSG_INFO("Recorded StrawStatusHT container " << m_par_strawstatusHTcontainerkey << " with DetStore ");
418  }
419 
420 
421  } else {
422  ATH_MSG_WARNING( " The HT Status input file not found ");
423  }
424 
425 
426  return StatusCode::SUCCESS;
427 }
428 
430 {
431 
432  StrawStatusContainer* strawstatuspermanent = new TRTCond::StrawStatusMultChanContainer() ;
433 
434  strawstatuspermanent->clear();
435 
436 
437  ATH_MSG_INFO( " readStatPermFromTextFile called with file name " << filename );
438 
439 
440  std::ifstream ifspermanent(filename.c_str()) ;
441 
442  if (ifspermanent) {
443 
444  // initialize all straws with status 'Good'
445  for(std::vector<Identifier>::const_iterator it=m_trtid->straw_layer_begin();it!=m_trtid->straw_layer_end();++it) {
446  Identifier id = m_trtid->straw_id(*it,0);
447  int m = m_trtid->phi_module(id);
448  int n = m_trtid->barrel_ec(id);
449  int l = m_trtid->layer_or_wheel(id);
450  int nStrawsInLayer = m_trtid->straw_max(*it);
451  int sl = m_trtid->straw_layer(id);
452  for (int i=0; i<=nStrawsInLayer; i++) {
453  id = m_trtid->straw_id(*it,i);
455  strawstatuspermanent->setStatus(expid,TRTCond::StrawStatus::Good) ;
456  }
457  }
458  int bec, layer, sector, strawlayer, straw, status;
459  //txt file format : bec sector straw strawlayer layer dead/alive
460  int line = 0;
461  int nmodu= 0;
462  while( ifspermanent >> bec >> sector>> straw >> strawlayer >> layer >> status ) {
463  if ( (status == 3) || (status == 4) || (status == 5) ) status = 1;
464  if (status!=1){
465  ATH_MSG_FATAL( " The Status Permanent: " << status << " IS NOT ACCEPTED, Use 1 for dead " );
466  return StatusCode::FAILURE;
467  }
469  line +=1;
470 
471 
472  // Expect the line to ask for either an entire modules or an individual straw to be turned off
473  if( strawlayer<0 ) {
474  std::cout << " Read permanent dead module from txt: " << bec << " ,sector " << sector << " ,straw " << straw << " ,strawlayer " << strawlayer << " ,layer " << layer << " ,status " << status << std::endl;
475  for(std::vector<Identifier>::const_iterator it=m_trtid->straw_layer_begin();it!=m_trtid->straw_layer_end();++it) {
476  Identifier id = m_trtid->straw_id(*it,0);
477  int m = m_trtid->phi_module(id);
478  int n = m_trtid->barrel_ec(id);
479  int l = m_trtid->layer_or_wheel(id);
480  if(n!=bec || m!=sector || l!=layer) continue;
481 
482  int nStrawsInLayer = m_trtid->straw_max(*it);
483  int sl = m_trtid->straw_layer(id);
484  for (int i=0; i<=nStrawsInLayer; i++) {
485  id = m_trtid->straw_id(*it,i);
486  TRTCond::ExpandedIdentifier expid( bec,layer,sector,sl,i,level);
487  strawstatuspermanent->setStatus(expid,TRTCond::StrawStatus::Dead) ;
488  }
489  }
490  nmodu++ ;
491  } else {
492  TRTCond::ExpandedIdentifier expid( bec,layer,sector,strawlayer,straw,level);
493  strawstatuspermanent->setStatus(expid,TRTCond::StrawStatus::Dead) ;
494  }
495 
496  ATH_MSG_DEBUG( "Permanent dead ids: bec: " << bec << " layer: " << layer << " phi: " << sector << " stl: " << strawlayer << " stw: " << straw );
497  } // end reading input text file
498 
499 
500 
501  ATH_MSG_INFO( " Record Permanent Straw Status. Dead modules : " << nmodu << " Number of lines: " << line << " of dead identifiers " );
502  if( (m_detStore->record(strawstatuspermanent,m_par_strawstatuspermanentcontainerkey))!=StatusCode::SUCCESS ) {
503  ATH_MSG_ERROR( "Could not record StrawStatusPermanent Container for key " << m_par_strawstatuspermanentcontainerkey );
504  return StatusCode::FAILURE;
505  } else {
506  ATH_MSG_INFO("Recorded StrawStatusPermanent container " << m_par_strawstatuspermanentcontainerkey << " with DetStore ");
507  }
508 
509  }
510  return StatusCode::SUCCESS ;
511 }
512 
514 
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
checkFileSG.line
line
Definition: checkFileSG.py:75
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TRT_ID::straw_max
int straw_max(const Identifier &id) const
Definition: TRT_ID.cxx:996
TRTStrawStatusWrite::m_par_strawstatusHTcontainerkey
std::string m_par_strawstatusHTcontainerkey
Definition: TRTStrawStatusWrite.h:59
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
TRT_DetectorManager.h
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TRTCond::StrawStatusMultChanContainer::setStatus
void setStatus(const ExpandedIdentifier &id, unsigned int status)
set t0
Definition: StrawStatusMultChanContainer.h:33
TRTCond::StrawStatusMultChanContainer
Definition: StrawStatusMultChanContainer.h:19
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
TRTCond::MultChanContainer::set
void set(const ExpandedIdentifier &id, const typename DaughterContainer::value_type &t)
set a value
Definition: MultChanContainer.h:219
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TRTStrawStatusWrite::readStatFromTextFile
virtual StatusCode readStatFromTextFile(const std::string &filename)
Definition: TRTStrawStatusWrite.cxx:142
TRTCond::ExpandedIdentifier::BARRELEC
@ BARRELEC
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTStrawStatusWrite::m_par_strawstatuspermanentcontainerkey
std::string m_par_strawstatuspermanentcontainerkey
Definition: TRTStrawStatusWrite.h:58
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TRTCond::MultChanContainer::clear
void clear()
clear all layercontainers
Definition: MultChanContainer.h:303
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TRTStrawStatusWrite::TRTStrawStatusWrite
TRTStrawStatusWrite(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TRTStrawStatusWrite.cxx:24
TRTStrawStatusWrite::m_par_strawstatuscontainerkey
std::string m_par_strawstatuscontainerkey
Definition: TRTStrawStatusWrite.h:57
TRTCond::StrawStatus::Dead
@ Dead
Definition: StrawStatus.h:18
TRT_ID::straw_layer_end
const_id_iterator straw_layer_end(void) const
Definition: TRT_ID.h:961
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TRTCond::StrawStatus::EmulateKrypton
@ EmulateKrypton
Definition: StrawStatus.h:18
TRTStrawStatusWrite::m_par_stattextfileHT
std::string m_par_stattextfileHT
Definition: TRTStrawStatusWrite.h:62
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
TRTStrawStatusWrite::m_trtid
const TRT_ID * m_trtid
Definition: TRTStrawStatusWrite.h:65
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRTCond::ExpandedIdentifier::STRAWLAYER
@ STRAWLAYER
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TRTStrawStatusWrite::set_status_temp
virtual void set_status_temp(StrawStatusContainer *ssc, Identifier offlineID, bool set)
Definition: TRTStrawStatusWrite.cxx:113
TRTCond::ExpandedIdentifier::DETECTOR
@ DETECTOR
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTStrawStatusWrite::m_par_stattextfile
std::string m_par_stattextfile
Definition: TRTStrawStatusWrite.h:60
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
TRTStrawStatusWrite::readStatPermFromTextFile
virtual StatusCode readStatPermFromTextFile(const std::string &filename)
Definition: TRTStrawStatusWrite.cxx:429
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
AthAlgorithm
Definition: AthAlgorithm.h:47
TRTCond::StrawStatus::EmulateArgon
@ EmulateArgon
Definition: StrawStatus.h:18
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TRTCond::StrawStatus::Good
@ Good
Definition: StrawStatus.h:18
TRTStrawStatusWrite::m_status
ToolHandle< ITRT_StrawStatusSummaryTool > m_status
Definition: TRTStrawStatusWrite.h:66
TRT_BaseElement.h
TRTStrawStatusWrite.h
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TRTStrawStatusWrite::set_status_permanent
virtual void set_status_permanent(StrawStatusContainer *ssc, Identifier offlineID, bool set)
Definition: TRTStrawStatusWrite.cxx:128
TRTCond::ExpandedIdentifier::STRAW
@ STRAW
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
TRTStrawStatusWrite::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: TRTStrawStatusWrite.h:56
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TRTStrawStatusWrite::readStatHTFromTextFile
virtual StatusCode readStatHTFromTextFile(const std::string &filename)
Definition: TRTStrawStatusWrite.cxx:324
TRTCond::ExpandedIdentifier::LAYERWHEEL
@ LAYERWHEEL
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
TRTStrawStatusWrite::finalize
virtual StatusCode finalize() override
Definition: TRTStrawStatusWrite.cxx:106
merge.status
status
Definition: merge.py:17
TRT_ID::straw_layer_begin
const_id_iterator straw_layer_begin(void) const
Iterators over full set of straw_layer ids. Straw_layer ids are sorted.
Definition: TRT_ID.h:953
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
TRTStrawStatusWrite::initialize
virtual StatusCode initialize() override
Definition: TRTStrawStatusWrite.cxx:43
TRTCond::ExpandedIdentifier::MODULE
@ MODULE
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::StrawStatus::Argon
@ Argon
Definition: StrawStatus.h:18
TRTStrawStatusWrite::m_par_stattextfilepermanent
std::string m_par_stattextfilepermanent
Definition: TRTStrawStatusWrite.h:61
TRTCond::StrawStatus::Krypton
@ Krypton
Definition: StrawStatus.h:18
TRTStrawStatusWrite::execute
virtual StatusCode execute() override
Definition: TRTStrawStatusWrite.cxx:101
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
Identifier
Definition: IdentifierFieldParser.cxx:14