ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
LVL1TGC::BigWheelCoincidenceLUT Class Reference

#include <BigWheelCoincidenceLUT.h>

Collaboration diagram for LVL1TGC::BigWheelCoincidenceLUT:

Public Member Functions

 BigWheelCoincidenceLUT (LVL1TGCTrigger::TGCArguments *, const SG::ReadCondHandleKey< TGCTriggerLUTs > &readKey, const std::string &version)
 
virtual ~BigWheelCoincidenceLUT ()
 
 BigWheelCoincidenceLUT (const BigWheelCoincidenceLUT &right)=default
 
BigWheelCoincidenceLUToperator= (const BigWheelCoincidenceLUT &right)=delete
 
bool readMap ()
 
int8_t test (int sideId, int octantId, int moduleId, int subsector, int type, int dr, int dphi) const
 
int getMapType (int hlwire, int hlstrip) const
 
const std::string & getVersion () const
 
const LVL1TGCTrigger::TGCArgumentstgcArgs () const
 

Protected Member Functions

int getTYPE (int lDR, int hDR, int lDPhi, int hDPhi) const
 

Protected Attributes

std::map< char, int8_t > m_pTdef
 

Static Protected Attributes

static constexpr uint32_t N_COIN_TYPE = 4
 

Private Member Functions

 BigWheelCoincidenceLUT ()=delete
 

Private Attributes

std::unordered_map< uint32_t, char > m_lut
 
std::string m_verName
 
bool m_fullCW {false}
 
LVL1TGCTrigger::TGCArgumentsm_tgcArgs
 
const SG::ReadCondHandleKey< TGCTriggerLUTs > & m_readCondKey
 

Detailed Description

Contents of Run-3 BW-CW LUT

std::unordered_map<GLOBALADDR, PTCHAR> where GLOBALADDR | 27 bits | uint32_t | side, octant, type, phimod2, module, roi, | DR(0...0x1f for -15...15), DPhi(0...0xf for -7...7) PTCHAR | 5 bits | char | pT (4 bits) and charge

for GLOBALADDR | 29 |28|27|26|25|24|23| 22 |21|..|18|17|...|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0| |side| octant | 0|type |phimod2| module | RoI | 0| delta R | delta Phi | where side = 0x0 (A-side), 0x1 (C-side). octant = 0x(0...7) type = 0x0(HH), 0x1(HL), 0x2(LH), 0x3(LL): HL means 3-sta.-wire and 2-sta.-strip.

Definition at line 35 of file BigWheelCoincidenceLUT.h.

Constructor & Destructor Documentation

◆ BigWheelCoincidenceLUT() [1/3]

LVL1TGC::BigWheelCoincidenceLUT::BigWheelCoincidenceLUT ( LVL1TGCTrigger::TGCArguments tgcargs,
const SG::ReadCondHandleKey< TGCTriggerLUTs > &  readKey,
const std::string &  version 
)

Definition at line 68 of file BigWheelCoincidenceLUT.cxx.

72  m_tgcArgs(tgcargs),
73  m_readCondKey(readKey) {
74  IMessageSvc* msgSvc = 0;
75  ISvcLocator* svcLocator = Gaudi::svcLocator();
76  if (svcLocator->service("MessageSvc", msgSvc) == StatusCode::FAILURE) {
77  return;
78  }
79  MsgStream log(msgSvc, "LVL1TGC::BigWheelCoincidenceLUT");
80 
81  log << MSG::INFO
82  << " BigWheel LUT version of " << m_verName << " is selected." << endmsg;
83 
84  if (!tgcArgs()->USE_CONDDB()) {
85  // read LUT contents from local files
86  this->readMap();
87  }
88 }

◆ ~BigWheelCoincidenceLUT()

LVL1TGC::BigWheelCoincidenceLUT::~BigWheelCoincidenceLUT ( )
virtual

Definition at line 90 of file BigWheelCoincidenceLUT.cxx.

90  {
91 }

◆ BigWheelCoincidenceLUT() [2/3]

LVL1TGC::BigWheelCoincidenceLUT::BigWheelCoincidenceLUT ( const BigWheelCoincidenceLUT right)
default

◆ BigWheelCoincidenceLUT() [3/3]

LVL1TGC::BigWheelCoincidenceLUT::BigWheelCoincidenceLUT ( )
privatedelete

Member Function Documentation

◆ getMapType()

int LVL1TGC::BigWheelCoincidenceLUT::getMapType ( int  hlwire,
int  hlstrip 
) const
inline

Definition at line 99 of file BigWheelCoincidenceLUT.h.

99  {
100  return (TGCTriggerLUTs::COIN_LL - 2*hlwire - hlstrip);
101 }

◆ getTYPE()

int LVL1TGC::BigWheelCoincidenceLUT::getTYPE ( int  lDR,
int  hDR,
int  lDPhi,
int  hDPhi 
) const
inlineprotected

Definition at line 88 of file BigWheelCoincidenceLUT.h.

88  {
92  } else if((lDR == -TGCTriggerLUTs::DR_LOW_RANGE) && (hDR == TGCTriggerLUTs::DR_LOW_RANGE)) {
95  }
96  return -1;
97 }

◆ getVersion()

const std::string & LVL1TGC::BigWheelCoincidenceLUT::getVersion ( ) const
inline

Definition at line 84 of file BigWheelCoincidenceLUT.h.

84  {
85  return m_verName;
86 }

◆ operator=()

BigWheelCoincidenceLUT& LVL1TGC::BigWheelCoincidenceLUT::operator= ( const BigWheelCoincidenceLUT right)
delete

◆ readMap()

bool LVL1TGC::BigWheelCoincidenceLUT::readMap ( )

Definition at line 93 of file BigWheelCoincidenceLUT.cxx.

94 {
95  const uint8_t kNMODULETYPE = 12;
96  const uint8_t modulenumber[kNMODULETYPE] = {0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8};
97  const std::string modulename[kNMODULETYPE] = {"0a","1a","2a","2b","3a","4a","5a","5b","6a","7a","8a","8b"};
98  const std::string sidename[TGCSide::kNSide] = {"a","c"};
99  const std::string capitalsidename[TGCSide::kNSide] = {"A", "C"};
100 
101  const std::string octantName[kNOctant] =
102  { "0", "1", "2", "3", "4", "5", "6", "7"};
103  const std::string coincidenceTypeName[N_COIN_TYPE] = {"HH", "HL", "LH", "LL"};
104 
105  IMessageSvc* msgSvc = 0;
106  ISvcLocator* svcLocator = Gaudi::svcLocator();
107  if (svcLocator->service("MessageSvc", msgSvc) == StatusCode::FAILURE) {
108  return false;
109  }
110  MsgStream log(msgSvc, "LVL1TGC::BigWheelCoincidenceLUT");
111 
112  // Automatic identification of octant-symmetry or full-CW from version
113  std::string tryname = PathResolver::FindCalibDirectory("dev")+"/TrigT1TGC/BW/cm_a0aHH_Octant_" + m_verName + ".db";
114  std::ifstream tryfile(tryname.c_str(), std::ios::in);
115  if (tryfile) {
116  m_fullCW = false;
117  tryfile.close();
118  } else {
119  tryname = PathResolver::FindCalibDirectory("dev")+"/TrigT1TGC/BW/cm_mod0aHH_A0_" + m_verName + ".db";
120  tryfile = std::ifstream(tryname.c_str(), std::ios::in);
121  if (tryfile) {
122  m_fullCW = true;
123  tryfile.close();
124  } else {
125  log << MSG::ERROR << "Could not found the expected file!" << endmsg;
126  }
127  }
128 
129  const uint8_t num_sides = (m_fullCW) ? TGCSide::kNSide : 1;
130  const uint8_t num_octants = (m_fullCW) ? kNOctant : 1;
131 
132  for (uint8_t iside=0; iside < num_sides; iside++) {
133  for (uint8_t ioctant=0; ioctant < num_octants; ioctant++) {
134  uint32_t octaddr = (iside<<TGCTriggerLUTs::SIDE_SHIFT) +
136 
137  // loop over all files...
138  for (int iModule=0; iModule < kNMODULETYPE; iModule+=1) {
139  uint32_t phimod2 = (modulename[iModule].find("b") != std::string::npos) ? 1 : 0;
140 
141  if (m_fullCW && iModule%4 > 1) { // only forward sectors
142  if ((ioctant%2 == 0 && uint32_t(iModule/4)%2 != phimod2) || // A0, A2, A4, ...
143  (ioctant%2 == 1 && uint32_t(iModule/4)%2 == phimod2)) { // A1, A3, A5, ...
144  continue; // only one of phimod2 sectors should be used
145  }
146  }
147  uint32_t modaddr = ((modulenumber[iModule] & TGCTriggerLUTs::MODULE_MASK)<<TGCTriggerLUTs::MODULE_SHIFT) +
149 
150  for (int iCoinType=0; iCoinType != N_COIN_TYPE; iCoinType++) {
151  std::string fn = "/BW/cm_";
152  if (m_fullCW) {
153  fn += "mod" + modulename[iModule] + coincidenceTypeName[iCoinType] + "_" + capitalsidename[iside] + octantName[ioctant] + "_";
154  } else {
155  fn += sidename[iside] + modulename[iModule] + coincidenceTypeName[iCoinType] + "_Octant_";
156  }
157  fn += m_verName + ".db";
158 
159  int type = -1;
160  int lDR, hDR, lDPhi, hDPhi;
161  std::string fullName = PathResolver::FindCalibDirectory("dev")+"/TrigT1TGC"+fn;
162  if( fullName.length() == 0 ) {
163  log << MSG::ERROR << " Could not found " << fn.c_str() << endmsg;
164  continue;
165  }
166 
167  std::ifstream file(fullName.c_str(),std::ios::in);
168  if(!file){
169  log << MSG::ERROR << " Could not found " << fullName.c_str() << endmsg;
170  continue;
171  }
172 
173  std::string buf, tag;
174  char delimiter = '\n';
175  while (getline(file,buf,delimiter)){
176  std::istringstream header(buf);
177  header>>tag;
178 
179  if (tag == "#") { // read header part
180  int roi;
181  header >> roi >> lDR >> hDR >> lDPhi >> hDPhi;
182  type = getTYPE(lDR, hDR, lDPhi, hDPhi);
183  // check moduleNumber and ptLevel
184  if(type < 0) {
185  log << MSG::WARNING
186  << " illegal parameter in database header : " << header.str() << " in file " << fn << endmsg;
187  break;
188  }
189 
192 
195 
196  // get window data
197  getline(file, buf, delimiter);
198 
199  for(uint8_t iphi=lDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi <= hDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi++) {
200  uint32_t theaddr = octaddr + modaddr + cwaddr + draddr + iphi;
201  char pt = buf[iphi-lDPhi-TGCTriggerLUTs::DPHI_HIGH_RANGE];
202  if (pt == 'X') continue; // not opened
203  if(m_lut.count(theaddr)==0){
204  m_lut[theaddr] = pt;
205  }else{
206  log << MSG::ERROR
207  << " Problem with loading TGC BW Trigger LUT: duplicated entry at address=" << theaddr << " with pt=" << pt << endmsg;
208  }
209  }
210  }
211  } // if (tag == "#")
212  } // while (getline(...))
213  } // for (int iCoinType)
214  } // for (int iModule)
215  } // for (uint8_t ioctant)
216  } // for (uint8_t iside)
217 
218  return true;
219 }

◆ test()

int8_t LVL1TGC::BigWheelCoincidenceLUT::test ( int  sideId,
int  octantId,
int  moduleId,
int  subsector,
int  type,
int  dr,
int  dphi 
) const

Definition at line 26 of file BigWheelCoincidenceLUT.cxx.

27  {
28  if (type < TGCTriggerLUTs::COIN_HH || type > TGCTriggerLUTs::COIN_LL) return 0; // no candidate
29 
30  int phimod2 = 0;
31  if (moduleId == 2 || moduleId == 5 || moduleId == 8) { // forward sectors
32  int sector = (moduleId-2) / 3 + octantId * 3; // sector number assuming the forward sector
33  phimod2 = (sector%2 == 1) ? 1 : 0;
34  }
35 
42 
43  int8_t content = 0x0; // outside from defined window, i.e. pT=0
44 
45  if(tgcArgs()->USE_CONDDB()) {
47  const TGCTriggerLUTs* readCdo{*readHandle};
48  bool fullCW = (readCdo->getType(TGCTriggerLUTs::CW_BW) == "full");
49  if(fullCW) addr += (sideId<<TGCTriggerLUTs::SIDE_SHIFT) +
51 
52  content = readCdo->getBigWheelPt(addr);
53  } else {
54  if(m_fullCW) addr += (sideId<<TGCTriggerLUTs::SIDE_SHIFT) +
56 
57  std::unordered_map<uint32_t, char>::const_iterator it = m_lut.find(addr);
58  if(it != m_lut.end()) {
59  char pt_char = it->second;
60  content = m_pTdef.find(pt_char)->second;
61  }
62  }
63 
64  return content;
65 }

◆ tgcArgs()

const LVL1TGCTrigger::TGCArguments * LVL1TGC::BigWheelCoincidenceLUT::tgcArgs ( ) const
inline

Definition at line 80 of file BigWheelCoincidenceLUT.h.

80  {
81  return m_tgcArgs;
82 }

Member Data Documentation

◆ m_fullCW

bool LVL1TGC::BigWheelCoincidenceLUT::m_fullCW {false}
private

Definition at line 73 of file BigWheelCoincidenceLUT.h.

◆ m_lut

std::unordered_map<uint32_t, char> LVL1TGC::BigWheelCoincidenceLUT::m_lut
private

Definition at line 70 of file BigWheelCoincidenceLUT.h.

◆ m_pTdef

std::map<char, int8_t> LVL1TGC::BigWheelCoincidenceLUT::m_pTdef
protected
Initial value:
={{'X',0},
{'A',1},{'B',2},{'C',3},{'D',4},{'E',5},{'F',6},{'G',7},{'H',8},{'I',9},{'J',10},{'K',11},{'L',12},{'M',13},{'N',14},{'O',15},
{'a',-1},{'b',-2},{'c',-3},{'d',-4},{'e',-5},{'f',-6},{'g',-7},{'h',-8},{'i',-9},{'j',-10},{'k',-11},{'l',-12},{'m',-13},{'n',-14},{'o',-15} }

Definition at line 65 of file BigWheelCoincidenceLUT.h.

◆ m_readCondKey

const SG::ReadCondHandleKey<TGCTriggerLUTs>& LVL1TGC::BigWheelCoincidenceLUT::m_readCondKey
private

Definition at line 77 of file BigWheelCoincidenceLUT.h.

◆ m_tgcArgs

LVL1TGCTrigger::TGCArguments* LVL1TGC::BigWheelCoincidenceLUT::m_tgcArgs
private

Definition at line 75 of file BigWheelCoincidenceLUT.h.

◆ m_verName

std::string LVL1TGC::BigWheelCoincidenceLUT::m_verName
private

Definition at line 72 of file BigWheelCoincidenceLUT.h.

◆ N_COIN_TYPE

constexpr uint32_t LVL1TGC::BigWheelCoincidenceLUT::N_COIN_TYPE = 4
staticconstexprprotected

Definition at line 62 of file BigWheelCoincidenceLUT.h.


The documentation for this class was generated from the following files:
TGCTriggerLUTs::PHIMOD2_MASK
static constexpr uint8_t PHIMOD2_MASK
Mask for extracting the phi(F or B) from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:36
LVL1TGC::BigWheelCoincidenceLUT::readMap
bool readMap()
Definition: BigWheelCoincidenceLUT.cxx:93
header
Definition: hcg.cxx:526
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
TGCTriggerLUTs::DPHI_SHIFT
static constexpr uint8_t DPHI_SHIFT
Bit position of the deltaPhi bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:54
skel.it
it
Definition: skel.GENtoEVGEN.py:423
test_pyathena.pt
pt
Definition: test_pyathena.py:11
TGCTriggerLUTs::DPHI_LOW_RANGE
static constexpr uint8_t DPHI_LOW_RANGE
Range of DPhi in the BW coincidence window for 2-station.
Definition: TGCTriggerLUTs.h:63
LVL1TGC::BigWheelCoincidenceLUT::tgcArgs
const LVL1TGCTrigger::TGCArguments * tgcArgs() const
Definition: BigWheelCoincidenceLUT.h:80
LVL1TGC::BigWheelCoincidenceLUT::m_pTdef
std::map< char, int8_t > m_pTdef
Definition: BigWheelCoincidenceLUT.h:65
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
PathResolver::FindCalibDirectory
static std::string FindCalibDirectory(const std::string &logical_file_name)
Definition: PathResolver.h:109
TGCTriggerLUTs::ROI_SHIFT
static constexpr uint8_t ROI_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:46
LVL1TGC::BigWheelCoincidenceLUT::N_COIN_TYPE
static constexpr uint32_t N_COIN_TYPE
Definition: BigWheelCoincidenceLUT.h:62
TGCTriggerLUTs::TYPE_SHIFT
static constexpr uint8_t TYPE_SHIFT
Bit position of the octant bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:34
TGCTriggerLUTs::DPHI_MASK
static constexpr uint8_t DPHI_MASK
Mask for extracting the deltaPhi from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:52
LVL1TGC::BigWheelCoincidenceLUT::getTYPE
int getTYPE(int lDR, int hDR, int lDPhi, int hDPhi) const
Definition: BigWheelCoincidenceLUT.h:88
TGCTriggerLUTs::COIN_HL
@ COIN_HL
Definition: TGCTriggerLUTs.h:65
LVL1TGC::BigWheelCoincidenceLUT::m_readCondKey
const SG::ReadCondHandleKey< TGCTriggerLUTs > & m_readCondKey
Definition: BigWheelCoincidenceLUT.h:77
TGCTriggerLUTs::DR_MASK
static constexpr uint8_t DR_MASK
Mask for extracting the deltaR from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:48
grepfile.content
string content
Definition: grepfile.py:56
PlotCalibFromCool.modulename
modulename
Definition: PlotCalibFromCool.py:81
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
TGCTriggerLUTs::DPHI_HIGH_RANGE
static constexpr uint8_t DPHI_HIGH_RANGE
Range of DPhi in the BW coincidence window for 3-station.
Definition: TGCTriggerLUTs.h:61
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
TGCTriggerLUTs
Definition: TGCTriggerLUTs.h:16
TGCTriggerLUTs::OCTANT_MASK
static constexpr uint8_t OCTANT_MASK
Mask for extracting the octant from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:28
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
file
TFile * file
Definition: tile_monitor.h:29
TGCTriggerLUTs::DR_HIGH_RANGE
static constexpr uint8_t DR_HIGH_RANGE
Range of DR in the BW coincidence window for 3-station.
Definition: TGCTriggerLUTs.h:57
TGCTriggerLUTs::DR_SHIFT
static constexpr uint8_t DR_SHIFT
Bit position of the deltaR bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:50
TGCTriggerLUTs::OCTANT_SHIFT
static constexpr uint8_t OCTANT_SHIFT
Bit position of the octant bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:30
TGCTriggerLUTs::COIN_LL
@ COIN_LL
Definition: TGCTriggerLUTs.h:65
TGCTriggerLUTs::MODULE_MASK
static constexpr uint8_t MODULE_MASK
Mask for extracting the module number from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:40
TGCTriggerLUTs::SIDE_SHIFT
static constexpr uint8_t SIDE_SHIFT
Bit position of the side bit in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:26
LVL1TGCTrigger::TGCArguments::USE_CONDDB
bool USE_CONDDB() const
Definition: TGCArguments.cxx:45
ir
int ir
counter of the current depth
Definition: fastadd.cxx:49
get_generator_info.version
version
Definition: get_generator_info.py:33
LVL1TGC::BigWheelCoincidenceLUT::m_lut
std::unordered_map< uint32_t, char > m_lut
Definition: BigWheelCoincidenceLUT.h:70
TGCTriggerLUTs::COIN_HH
@ COIN_HH
Definition: TGCTriggerLUTs.h:65
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TGCTriggerLUTs::TYPE_MASK
static constexpr uint8_t TYPE_MASK
Mask for extracting the octant from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:32
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LVL1TGC::kNSide
@ kNSide
Definition: TGCNumbering.h:16
LVL1TGC::BigWheelCoincidenceLUT::m_fullCW
bool m_fullCW
Definition: BigWheelCoincidenceLUT.h:73
TGCTriggerLUTs::DR_LOW_RANGE
static constexpr uint8_t DR_LOW_RANGE
Range of DR in the BW coincidence window for 2-station.
Definition: TGCTriggerLUTs.h:59
LVL1TGC::BigWheelCoincidenceLUT::m_tgcArgs
LVL1TGCTrigger::TGCArguments * m_tgcArgs
Definition: BigWheelCoincidenceLUT.h:75
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
makeTOC.header
header
Definition: makeTOC.py:28
TGCTriggerLUTs::COIN_LH
@ COIN_LH
Definition: TGCTriggerLUTs.h:65
TGCTriggerLUTs::MODULE_SHIFT
static constexpr uint8_t MODULE_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:42
TGCTriggerLUTs::CW_BW
@ CW_BW
Definition: TGCTriggerLUTs.h:66
LVL1TGC::BigWheelCoincidenceLUT::m_verName
std::string m_verName
Definition: BigWheelCoincidenceLUT.h:72
TGCTriggerLUTs::ROI_MASK
static constexpr uint8_t ROI_MASK
Mask for extracting the module number from the GLOBALADDR.
Definition: TGCTriggerLUTs.h:44
TGCTriggerLUTs::PHIMOD2_SHIFT
static constexpr uint8_t PHIMOD2_SHIFT
Bit position of the module number bits in the GLOBALADDR.
Definition: TGCTriggerLUTs.h:38