90 {
91
94
96
97
98
99
100
101
102
103
104
105 auto genintstr = [] (
int col, std::string
str )
106 {return std::make_pair(col , str );};
107 auto genintint = [] (int col,int intstr)
108 {return std::make_pair(col , std::to_string(intstr) );};
109 using searchpairs = std::vector<std::pair<int,std::string>>;
110
111
112
113
114 auto tab4search = searchpairs();
115 tab4search.push_back(genintstr(0,efexcords));
116 tab4search.push_back(genintint(1,fpga));
117 tab4search.push_back(genintint(2,quad));
118 tab4search.push_back(genintint(3,mgtchannel));
119 auto tab4line =
m_tables.GetTable(4)->FindLine(tab4search);
120 if ( tab4line->size() == 0 )
121 return;
122
123
124
125
126
127 std::string mpod = tab4line->at(4);
128 auto tab3search = searchpairs();
129 tab3search.push_back(genintstr(0,efexcords));
130 tab3search.push_back(genintstr(1,mpod));
131 auto tab3line =
m_tables.GetTable(3)->FindLine(tab3search);
132 if ( tab3line->size() == 0 )
133 return;
134
135
136
139
140
143
144 auto tab2search = searchpairs();
145 tab2search.push_back(genintstr(0,efexcords));
148 tab2search.push_back(genintint(3,dataword ));
149 auto tab2line =
m_tables.GetTable(2)->FindLine(tab2search);
150 if ( tab2line->size() == 0 )
151 return;
152
153 int globaleta = std::stoi( tab2line->at(4) );
154 int globalphi = std::stoi( tab2line->at(5) );
155
156 int layer = std::stoi( tab2line->at(6),
nullptr ,16 );
158
159
160
161
163
164 double supercelletawidth(0);
165 double supercellphiwidth(0.09817477);
166 int supercelletaoffset(0);
167 if(layer == 0){
168 supercelletawidth = 0.1;
169 }
170 else if(1 <= layer && layer <= 4){
171 supercelletawidth = 0.025;
172 supercelletaoffset = (
layer - 1 )%4;
173 }
174 else if(5 <= layer && layer <= 8){
175 supercelletawidth = 0.025;
176 supercelletaoffset = (
layer - 1 )%4;
177 }
178 else if(layer == 9 || layer == 10){
179 supercelletawidth = 0.1;
180 }
181 double toweretalowside = (
double)globaleta/10;
182 double towerphilowside = (
double)globalphi*0.09817477;
183 double supercelletacoord = toweretalowside + 0.025*(
double)supercelletaoffset +
184 0.5*supercelletawidth ;
185 double supercellphicoord = towerphilowside + 0.5*supercellphiwidth;
186 if(layer == 0){
187 m_region = L1CaloDetectorRegion( efexlabel,
189 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
190 }
191 else if(1 <= layer && layer <= 4){
192 m_region = L1CaloDetectorRegion( efexlabel,
194 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
195 }
196 else if(5 <= layer && layer <= 8){
197 m_region = L1CaloDetectorRegion( efexlabel,
199 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
200 }
201 else if(layer == 9){
202 m_region = L1CaloDetectorRegion( efexlabel,
204 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
205 }
206 else if(layer == 10){
207 m_region = L1CaloDetectorRegion( efexlabel,
209 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
210 }
211 int globalEta =
m_region.getEtaIndex();
213 std::string miniPodLabel =
m_hwinfo.getMpodLabel();
214 int moduleCBA = 2 - ( efexcords.at(0) - 'A' );
215 int octantNum = ( efexcords.at(1) - '0' ) - 1;
216 int moduleBaseEta = -24 + (moduleCBA * 16);
217 int fpgaBaseEta = moduleBaseEta + (fpga * 4);
218 int fpgaLowerEta = fpgaBaseEta;
219 int fpgaUpperEta = fpgaBaseEta + 4;
220 if (moduleCBA == 0 && fpga == 0) { fpgaLowerEta--; }
221 else if (moduleCBA == 2 && fpga == 3) { fpgaUpperEta++; }
223 int lowerShiftedPhi = octantNum * 8;
224 int upperShiftedPhi = lowerShiftedPhi + 8;
225 int fpgaOverlap = 0;
226 if (shiftedPhi >= upperShiftedPhi || shiftedPhi < lowerShiftedPhi) {
227
228
229 if (octantNum == 0 || octantNum == 7) {
230 fpgaOverlap |= (shiftedPhi > 32) ? 1 : 2;
231 }
232 else {
233 fpgaOverlap |= (shiftedPhi < lowerShiftedPhi) ? 1 : 2;
234 }
235 }
236 if (globalEta >= fpgaUpperEta || globalEta < fpgaLowerEta) {
237 fpgaOverlap |= (globalEta < fpgaLowerEta) ? 4 : 8;
238 }
240
241}
std::string findModuleCords(int crate, int efexnumber) const