ATLAS Offline Software
TRTDigiHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TRTDigiHelper.h"
6 #include <iostream>
7 #include "GaudiKernel/MsgStream.h"
8 
9 namespace TRTDigiHelper {
10  // The straw's gas mix: 1=Xe, 2=Kr, 3=Ar
11  int StrawGasType(int statusHT, int useGasMix, MsgStream* log) {
12 
13  // TRT/Cond/StatusHT provides:
14  // enum { Undefined, Dead(Ar), Good(Xe), Xenon(Xe), Argon(Ar), Krypton(Kr) , EmulatedArgon(Xe, see below) }
15  // The useGasMix default behaviour (0) is to use TRT/Cond/StatusHT, other values can be set to force
16  // the whole detector to (1)Xenon, (2)Krypton, (3)Argon:
17 
18  int strawGasType=99;
19 
20  if (useGasMix==0) { // use StatusHT
21 
22  if ( statusHT==2 || statusHT==3 ) { strawGasType = 0; } // Xe
23  else if ( statusHT==5 ) { strawGasType = 1; } // Kr
24  else if ( statusHT==1 || statusHT==4 ) { strawGasType = 2; } // Ar
25  else if ( statusHT==6 ) { strawGasType = 0; } // Xe
26  else if ( statusHT==7 ) { strawGasType = 0; } // Xe
27  // statusHT==6 is emulate argon, make it xenon here,
28  // and emulate argon later with reduced TR eff.
29  else {
30  if (log) { *log << MSG::FATAL << "StrawGasType: StrawStatus = " << statusHT
31  << ", must be 'Good(2)||Xenon(3)' or 'Dead(1)||Argon(4)' or 'Krypton(5)!'"
32  << ", or 'EmulateArgon(6)' or 'EmulateKrypton(7)'" << endmsg; }
33  }
34  }
35  else if (useGasMix==1) { strawGasType = 0; } // force whole detector to Xe
36  else if (useGasMix==2) { strawGasType = 1; } // force whole detector to Kr
37  else if (useGasMix==3) { strawGasType = 2; } // force whole detector to Ar
38 
39  if ( strawGasType<0 || strawGasType>2 ) {
40  if (log) { *log << MSG::FATAL << "StrawGasType: strawGasType value (" << strawGasType << ") must be 0(Xe), 1(Kr) or 2(Ar)!" << endmsg; }
41  throw std::exception();
42  }
43 
44  return strawGasType;
45 
46  }
47 
48  unsigned int getRegion(int hitID) {
49 
50  // 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
51  const int mask(0x0000001F);
52  const int word_shift(5);
53  int layerID, ringID, wheelID;
54  unsigned int region(0);
55 
56  if ( !(hitID & 0x00200000) ) { // barrel
57 
58  hitID >>= word_shift;
59  layerID = hitID & mask;
60  hitID >>= word_shift;
61  hitID >>= word_shift;
62  ringID = hitID & mask;
63  region = ( (layerID < 9) && (ringID == 0) ) ? 1 : 2;
64 
65  } else { // endcap
66 
67  hitID >>= word_shift;
68  hitID >>= word_shift;
69  hitID >>= word_shift;
70  wheelID = hitID & mask;
71  region = wheelID < 8 ? 3 : 4;
72 
73  }
74 
75  return region;
76 
77  }
78 }
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
TRTDigiHelper::getRegion
unsigned int getRegion(int hitID)
Definition: TRTDigiHelper.cxx:48
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
TRTDigiHelper
Definition: TRTDigiHelper.cxx:9
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
calibdata.exception
exception
Definition: calibdata.py:496
TRTDigiHelper.h
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TRTDigiHelper::StrawGasType
int StrawGasType(int statusHT, int useGasMix, MsgStream *log)
Definition: TRTDigiHelper.cxx:11