11 int fpga,
int mgtchannelout ,
int dataword)
13 auto genintint = [] (
int col,
int intstr)
15 using searchpairs = std::vector<std::pair<int,std::string>>;
18 auto tab6search = searchpairs();
19 tab6search.push_back(genintint(0,fpga));
20 tab6search.push_back(genintint(3,mgtchannelout));
22 int quad = std::stoi( tab6line->at(1) );
23 int mgtin = std::stoi( tab6line->at(2) );
24 this->
init(crate,efexnumber, fpga,
quad, mgtin, dataword);
28 int fpga,
int eta,
int phi )
30 if ( (crate<0) || (crate>1) || (efexnumber<0) || (efexnumber>11) )
35 int etaIndex = (efexnumber%3)*16 + fpga*4 +
eta - 25;
36 int phiIndex = crate*32 +(efexnumber/3)*8 +
phi + 2;
38 double etaWidth = 0.1;
40 double etaCoord = (etaIndex+0.5)*etaWidth;
51 int fpga,
int eta,
int phi,
int seed )
53 if ( (crate<0) || (crate>1) || (efexnumber<0) || (efexnumber>11) )
57 if ( (seed<0) || (seed>3) )
60 int etaIndex = (efexnumber%3)*64 + fpga*16 +
eta*4 + seed - 100;
61 int phiIndex = crate*32 +(efexnumber/3)*8 +
phi + 2;
63 double etaWidth = 0.025;
65 double etaCoord = (etaIndex+0.5)*etaWidth;
90 int fpga,
int quad,
int mgtchannel ,
int dataword){
105 auto genintstr = [] (
int col, std::string
str )
106 {
return std::make_pair(col ,
str );};
107 auto genintint = [] (
int col,
int intstr)
109 using searchpairs = std::vector<std::pair<int,std::string>>;
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));
120 if ( tab4line->size() == 0 )
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));
132 if ( tab3line->size() == 0 )
144 auto tab2search = searchpairs();
145 tab2search.push_back(genintstr(0,efexcords));
148 tab2search.push_back(genintint(3,dataword ));
150 if ( tab2line->size() == 0 )
153 int globaleta = std::stoi( tab2line->at(4) );
154 int globalphi = std::stoi( tab2line->at(5) );
156 int layer = std::stoi( tab2line->at(6),
nullptr ,16 );
164 double supercelletawidth(0);
165 double supercellphiwidth(0.09817477);
166 int supercelletaoffset(0);
168 supercelletawidth = 0.1;
171 supercelletawidth = 0.025;
172 supercelletaoffset = (
layer - 1 )%4;
175 supercelletawidth = 0.025;
176 supercelletaoffset = (
layer - 1 )%4;
179 supercelletawidth = 0.1;
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;
189 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
194 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
199 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
204 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
206 else if(
layer == 10){
209 supercelletawidth, supercellphiwidth , supercelletacoord, supercellphicoord);
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;
226 if (shiftedPhi >= upperShiftedPhi || shiftedPhi < lowerShiftedPhi) {
229 if (octantNum == 0 || octantNum == 7) {
230 fpgaOverlap |= (shiftedPhi > 32) ? 1 : 2;
233 fpgaOverlap |= (shiftedPhi < lowerShiftedPhi) ? 1 : 2;
236 if (globalEta >= fpgaUpperEta || globalEta < fpgaLowerEta) {
237 fpgaOverlap |= (globalEta < fpgaLowerEta) ? 4 : 8;
245 if ( (crate<0 || crate>1) ){
246 throw std::out_of_range(
"Invalid Crate # created within eFEX mapping");
248 if ( efexnumber<0 || efexnumber>11 ){
249 throw std::out_of_range(
"Invalid Module # created within eFEX mapping");
256 int octant = 4*crate + efexnumber/3 + 1;
257 int etaslicenum = 3 - efexnumber%3;
258 static constexpr
const char*
letters =
"ABC";
259 char etaslice =
letters[etaslicenum - 1];