23 int type,
int dr,
int dphi)
const {
27 if (moduleId == 2 || moduleId == 5 || moduleId == 8) {
28 int sector = (moduleId-2) / 3 + octantId * 3;
29 phimod2 = (sector%2 == 1) ? 1 : 0;
53 std::unordered_map<uint32_t, char>::const_iterator it =
m_lut.find(addr);
54 if(it !=
m_lut.end()) {
55 char pt_char = it->second;
56 content =
m_pTdef.find(pt_char)->second;
66 const std::string& version)
73 <<
" BigWheel LUT version of " <<
m_verName <<
" is selected." <<
endmsg;
86 const uint8_t kNMODULETYPE = 12;
87 const uint8_t modulenumber[kNMODULETYPE] = {0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8};
88 const std::string modulename[kNMODULETYPE] = {
"0a",
"1a",
"2a",
"2b",
"3a",
"4a",
"5a",
"5b",
"6a",
"7a",
"8a",
"8b"};
92 const std::string octantName[
kNOctant] =
93 {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7"};
94 const std::string coincidenceTypeName[
N_COIN_TYPE] = {
"HH",
"HL",
"LH",
"LL"};
100 std::ifstream tryfile(tryname.c_str(), std::ios::in);
106 tryfile = std::ifstream(tryname.c_str(), std::ios::in);
111 log << MSG::ERROR <<
"Could not found the expected file!" <<
endmsg;
118 for (uint8_t iside=0; iside < num_sides; iside++) {
119 for (uint8_t ioctant=0; ioctant < num_octants; ioctant++) {
124 for (
int iModule=0; iModule < kNMODULETYPE; iModule+=1) {
125 uint32_t phimod2 = (modulename[iModule].find(
"b") != std::string::npos) ? 1 : 0;
128 if ((ioctant%2 == 0 && uint32_t(iModule/4)%2 != phimod2) ||
129 (ioctant%2 == 1 && uint32_t(iModule/4)%2 == phimod2)) {
136 for (
int iCoinType=0; iCoinType !=
N_COIN_TYPE; iCoinType++) {
137 std::string fn =
"/BW/cm_";
139 fn +=
"mod" + modulename[iModule] + coincidenceTypeName[iCoinType] +
"_" + capitalsidename[iside] + octantName[ioctant] +
"_";
141 fn += sidename[iside] + modulename[iModule] + coincidenceTypeName[iCoinType] +
"_Octant_";
146 int lDR, hDR, lDPhi, hDPhi;
148 if( fullName.length() == 0 ) {
149 log << MSG::ERROR <<
" Could not found " << fn.c_str() <<
endmsg;
153 std::ifstream
file(fullName.c_str(),std::ios::in);
155 log << MSG::ERROR <<
" Could not found " << fullName.c_str() <<
endmsg;
159 std::string buf, tag;
160 char delimiter =
'\n';
161 while (getline(
file,buf,delimiter)){
162 std::istringstream
header(buf);
167 header >> roi >> lDR >> hDR >> lDPhi >> hDPhi;
172 <<
" illegal parameter in database header : " <<
header.str() <<
" in file " << fn <<
endmsg;
183 getline(
file, buf, delimiter);
186 uint32_t theaddr = octaddr + modaddr + cwaddr + draddr + iphi;
188 if (pt ==
'X')
continue;
189 if(
m_lut.count(theaddr)==0){
193 <<
" Problem with loading TGC BW Trigger LUT: duplicated entry at address=" << theaddr <<
" with pt=" << pt <<
endmsg;
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LVL1TGCTrigger::TGCArguments * m_tgcArgs
virtual ~BigWheelCoincidenceLUT()
const LVL1TGCTrigger::TGCArguments * tgcArgs() const
std::map< char, int8_t > m_pTdef
static constexpr uint32_t N_COIN_TYPE
BigWheelCoincidenceLUT()=delete
int getTYPE(int lDR, int hDR, int lDPhi, int hDPhi) const
int8_t test(int sideId, int octantId, int moduleId, int subsector, int type, int dr, int dphi) const
std::unordered_map< uint32_t, char > m_lut
const SG::ReadCondHandleKey< TGCTriggerLUTs > & m_readCondKey
static std::string FindCalibDirectory(const std::string &logical_file_name)
int8_t getBigWheelPt(const uint32_t addr) const
static constexpr uint8_t SIDE_SHIFT
Bit position of the side bit in the GLOBALADDR.
static constexpr uint8_t DR_MASK
Mask for extracting the deltaR from the GLOBALADDR.
static constexpr uint8_t DPHI_HIGH_RANGE
Range of DPhi in the BW coincidence window for 3-station.
static constexpr uint8_t DPHI_SHIFT
Bit position of the deltaPhi bits in the GLOBALADDR.
static constexpr uint8_t ROI_MASK
Mask for extracting the module number from the GLOBALADDR.
static constexpr uint8_t PHIMOD2_SHIFT
Bit position of the module number bits in the GLOBALADDR.
static constexpr uint8_t TYPE_MASK
Mask for extracting the octant from the GLOBALADDR.
static constexpr uint8_t DR_SHIFT
Bit position of the deltaR bits in the GLOBALADDR.
static constexpr uint8_t OCTANT_SHIFT
Bit position of the octant bits in the GLOBALADDR.
static constexpr uint8_t DR_HIGH_RANGE
Range of DR in the BW coincidence window for 3-station.
std::string getType(int cwtype, int channel=0) const
static constexpr uint8_t MODULE_MASK
Mask for extracting the module number from the GLOBALADDR.
static constexpr uint8_t OCTANT_MASK
Mask for extracting the octant from the GLOBALADDR.
static constexpr uint8_t TYPE_SHIFT
Bit position of the octant bits in the GLOBALADDR.
static constexpr uint8_t MODULE_SHIFT
Bit position of the module number bits in the GLOBALADDR.
static constexpr uint8_t PHIMOD2_MASK
Mask for extracting the phi(F or B) from the GLOBALADDR.
static constexpr uint8_t DPHI_MASK
Mask for extracting the deltaPhi from the GLOBALADDR.
static constexpr uint8_t ROI_SHIFT
Bit position of the module number bits in the GLOBALADDR.
int ir
counter of the current depth
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
static constexpr unsigned int kNOctant
The number of octants per side.