ATLAS Offline Software
Loading...
Searching...
No Matches
TGCTriggerBWCWReader.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
11 TGCTriggerLUTReader(lutType),
12 AthMessaging("TGCTriggerBWCWReader")
13{
14}
15
16
17
19 const CondAttrListCollection* readCdo) {
20
23
24 for(; itr!=itr_e; ++itr) {
25 const unsigned int channel = (*itr).first;
26 const coral::AttributeList& atr = (*itr).second;
27
28 ATH_MSG_DEBUG("channel: " << channel);
29 std::string file = *(static_cast<const std::string*>((atr["file"]).addressOfData()));
30 std::string data = *(static_cast<const std::string*>((atr["data"]).addressOfData()));
31 std::string version = *(static_cast<const std::string*>((atr["version"]).addressOfData()));
32 std::string type = *(static_cast<const std::string*>((atr["type"]).addressOfData()));
33
34 writeCdo->m_datamap[m_lutType][file] = data;
35 writeCdo->m_data[m_lutType].push_back(data);
36 writeCdo->m_file[m_lutType].push_back(file);
37 writeCdo->m_version[m_lutType].push_back(std::move(version));
38 writeCdo->m_type[m_lutType].push_back(std::move(type));
39
40 ATH_MSG_INFO("file: " <<file);
41 ATH_MSG_DEBUG("data: " << data);
42
43 }
44 return true;
45}
46
47
48
49
50
51
52
53
55
56 const int numberOfCoincidenceType = 4;
57
58 const int moduleNumber[TGCTriggerLUTs::N_MODULETYPE] =
59 { 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8 };
60 const std::string moduleName[TGCTriggerLUTs::N_MODULETYPE]=
61 {"0a","1a","2a","2b","3a","4a","5a","5b","6a","7a","8a","8b"};
62 const std::string sideName[TGCTriggerLUTs::N_SIDE] = {"a","c"};
63 const std::string octantName[TGCTriggerLUTs::N_OCTANT] =
64 { "0", "1", "2", "3", "4", "5", "6", "7"};
65 const std::string coincidenceTypeName[numberOfCoincidenceType] = {"HH","HL","LH","LL"};
66
67
68 // initialize
69 bool fullCW = (writeCdo->getType(TGCTriggerLUTs::CW_BW) == "full" );
70 // loop over all files...
71 for(int iSide = 0; iSide<TGCTriggerLUTs::N_SIDE; iSide++){
72 for(int iOctant = 0; iOctant < TGCTriggerLUTs::N_OCTANT; iOctant++) {
73
74 uint32_t octaddr = ((iSide & TGCTriggerLUTs::SIDE_MASK)<<TGCTriggerLUTs::SIDE_SHIFT) +
76
77 for(int iModule=0; iModule<TGCTriggerLUTs::N_MODULETYPE; iModule+=1) {
78
79 uint32_t phimod2 = moduleName[iModule].find('b') != std::string::npos ? 1 : 0;
80 uint32_t modaddr = ((moduleNumber[iModule] & TGCTriggerLUTs::MODULE_MASK)<<TGCTriggerLUTs::MODULE_SHIFT) +
82
83 for(int iCoinType=0; iCoinType!=numberOfCoincidenceType; iCoinType++){
84
85 std::string fn;
86 if (fullCW) {
87 fn = "RPhiCoincidenceMapRun3_" + sideName[iSide] + octantName[iOctant]
88 + moduleName[iModule] + coincidenceTypeName[iCoinType] + ".db";
89 } else{
90 fn = "RPhiCoincidenceMapRun3_" + moduleName[iModule] + coincidenceTypeName[iCoinType] + ".db";
91 }
92
93 bool Forward_type1=(moduleName[iModule]=="2b"||moduleName[iModule]=="5a"||moduleName[iModule]=="8b");
94 bool Forward_type2=(moduleName[iModule]=="2a"||moduleName[iModule]=="5b"||moduleName[iModule]=="8a");
95
96 if(iOctant%2==0 && Forward_type1){continue;}
97 if(iOctant%2==1 && Forward_type2){continue;}
98 int type = -1;
99 int lDR, hDR, lDPhi, hDPhi;
100
101 std::string data = writeCdo->getData(TGCTriggerLUTs::CW_BW, std::move(fn));
102 std::istringstream stream(data);
103
104 std::string buf,tag;
105 char delimiter = '\n';
106 int roi;
107
108 while(getline(stream,buf,delimiter)){
109 std::istringstream header(buf);
110 header>>tag;
111 if(tag=="#") { // read header part.
112 header >> roi >> lDR >> hDR >> lDPhi >> hDPhi;
113 type = getType( lDR, hDR, lDPhi, hDPhi );
114 if( type<0 ) {
115 break;
116 }
117
118 uint32_t cwaddr = ((uint8_t(type) & TGCTriggerLUTs::TYPE_MASK)<<TGCTriggerLUTs::TYPE_SHIFT) +
120
121 for(uint8_t ir=lDR+TGCTriggerLUTs::DR_HIGH_RANGE; ir <= hDR+TGCTriggerLUTs::DR_HIGH_RANGE; ir++) { // 0...31 or 7...23
122 uint32_t draddr = (ir & TGCTriggerLUTs::DR_MASK) << TGCTriggerLUTs::DR_SHIFT;
123
124 // get window data
125 getline(stream, buf, delimiter);
126
127 for(uint8_t iphi=lDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi <= hDPhi+TGCTriggerLUTs::DPHI_HIGH_RANGE; iphi++) {
128 uint32_t theaddr = octaddr + modaddr + cwaddr + draddr + iphi;
129 char pt = buf[iphi-lDPhi-TGCTriggerLUTs::DPHI_HIGH_RANGE];
130 if (pt == 'X') continue; // not opened
131 writeCdo->m_ptmap_bw[theaddr] = pt;
132 }
133 }
134
135 }
136 }
137
138 }// coincidence type
139 }// module
140 }// octant
141 }// side
142
143 return true;
144}
145
146
147
148
149int TGCTriggerBWCWReader::getType(int lDR, int hDR, int lDPhi, int hDPhi ) const {
150 int type = -1;
151 if ( (lDR==-15) && (hDR==15) && (lDPhi==-7) && (hDPhi==7)) type = TGCTriggerBWCWReader::TMap_HH;
152 else if ( (lDR==-15) && (hDR==15) && (lDPhi==-3) && (hDPhi==3)) type = TGCTriggerBWCWReader::TMap_HL;
153 else if ( (lDR==-7) && (hDR==7) && (lDPhi==-7) && (hDPhi==7)) type = TGCTriggerBWCWReader::TMap_LH;
154 else if ( (lDR==-7) && (hDR==7) && (lDPhi==-3) && (hDPhi==3)) type = TGCTriggerBWCWReader::TMap_LL;
155 return type;
156}
157
158int TGCTriggerBWCWReader::subSectorAdd(int ssid, int modid, int phimod2, int type) const {
159 return (ssid+(modid<<8)+(phimod2<<12) + (type<<16) );
160}
161
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator
bool loadParameters(TGCTriggerLUTs *writeCdo, const CondAttrListCollection *readKey) override
int getType(int lDR, int hDR, int lDPhi, int hDPhi) const
bool readLUT(TGCTriggerLUTs *writeCdo) override
int subSectorAdd(int ssid, int modid, int phimod2, int type) const
std::vector< std::string > m_version[LUT_NUM]
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.
std::map< std::string, std::string > m_datamap[LUT_NUM]
static constexpr uint8_t ROI_MASK
Mask for extracting the module number from the GLOBALADDR.
std::string getData(int cwtype, std::string file) const
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 SIDE_MASK
Mask for extracting the side from the GLOBALADDR.
std::vector< std::string > m_file[LUT_NUM]
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.
std::vector< std::string > m_type[LUT_NUM]
std::vector< std::string > m_data[LUT_NUM]
std::unordered_map< uint32_t, int8_t > m_ptmap_bw
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 ROI_SHIFT
Bit position of the module number bits in the GLOBALADDR.
int ir
counter of the current depth
Definition fastadd.cxx:49
TFile * file