79 std::vector<ConvertedHit> ConvHits;
80 for(std::vector<L1TMuon::TriggerPrimitive>::iterator C1 = TriggPrim.begin();C1 != TriggPrim.end();C1++){
92 if (station == 1 &&
ring == 1 && strip > 127)
ring = 4;
108 bool IsNeighbor =
neighbor(
endcap,sector,SectIndex,Id,sub,station);
110 if(
ring == 4){Id += 9;}
112 if( (SectIndex == (
endcap - 1)*6 + sector - 1 ) || IsNeighbor ) {
118 int ph_tmp = -999, th_tmp = -999;
119 int clctpatcor = -999, clctpatsign = -999;
120 int eightstrip = -999;
122 int factor = (station == 1 &&
ring == 4) ? 1707:
123 (station == 1 &&
ring == 3) ? 947:
124 (station == 1 &&
ring == 1) ? 1301:
127 bool ph_reverse = (
endcap == 1 && station >= 3) ? 1:
128 (
endcap == 2 && station < 3) ? 1: 0;
130 int ph_coverage = (station <= 1 && Id > 6 && Id < 10) ? 15 :
131 (station >= 2 && Id <= 3) ? 40 : 20;
133 int th_coverage = (station == 1 && Id <= 3) ? 45 :
134 (station == 1 && Id > 6 && Id < 10) ? 27 :
135 (station == 1 && Id > 3) ? 39 :
136 (station == 2 && Id <= 3) ? 43 :
137 (station == 2 && Id > 3) ? 56 :
138 (station == 3 && Id <= 3) ? 34 :
139 (station == 3 && Id > 3) ? 52 :
140 (station == 4 && Id <= 3) ? 28 :
141 (station == 4 && Id > 3) ? 50 : 0;
143 int ph_zone_bnd1 = (station <= 1 && (Id <= 3 || Id > 9)) ? 41 :
144 (station == 2 && Id <= 3) ? 41 :
145 (station == 2 && Id > 3) ? 87 :
146 (station == 3 && Id > 3) ? 49 :
147 (station == 4 && Id > 3) ? 49 : 127;
149 int ph_zone_bnd2 = (station == 3 && Id > 3) ? 87 : 127;
151 int zone_overlap = 2;
153 int fph = -999, th = -999, ph_hit = -999, phzvl = -999;
177 case 1: LUTi = nId - 1;
break;
178 case 2: LUTi = 15 + nId;
break;
182 case 2: LUTi = 27 + nId;
break;
183 case 3: LUTi = 38 + nId;
break;
184 case 4: LUTi = 49 + nId;
break;
187 if(IsNeighbor && station == 1){
190 case 1: LUTi = 15 + nId;
break;
191 case 2: LUTi = nId - 1;
break;
204 clctpatsign = ((
pattern%2) == 0);
205 if(
pattern >= 2) {clctpatcor = 5;}
206 if(
pattern >= 6) {clctpatcor = 2;}
207 if(
pattern == 10) {clctpatcor = 0;clctpatsign = 0;}
214 eightstrip = 8*strip;
215 int patcor = clctpatcor;
217 if(station == 1 || Id > 3){
218 eightstrip = (eightstrip>>1);
219 patcor = (patcor>>1);
220 if(
ring == 4 && strip > 127) eightstrip -= 512;
223 if(clctpatsign) patcor = -patcor;
224 eightstrip += patcor;
230 ph_tmp = ((eightstrip*
factor)>>10);
231 int phShift = (ph_tmp>>5);
240 int phInitIndex = Id;
243 int neighborId = C3.
Id()/3;
247 phInitIndex = 12 + neighborId;
254 int neighborId = Id/3;
255 if(neighborId > 2) neighborId = 2;
257 if(IsNeighbor) phInitIndex = 9 + neighborId;
262 if (station == 0 || nId == -1 || SectIndex < 0 || SectIndex > 11 || LUTi < 0 || LUTi > 60) {
263 std::cout <<
"\n*********************************************************************" << std::endl;
266 <<
", ring " << Det.
ring() <<
", ID " << C3.
Id() <<
", chamber " << Det.
chamber()
269 std::cout <<
"Produces: station " << station <<
", nId " << nId
270 <<
", SectIndex " << SectIndex <<
", LUTi " << LUTi << std::endl;
285 int neighborId = C3.
Id()/3;
289 idl = 12 + neighborId;
290 if(
ring == 4) idl = 16;
295 int neighborId = Id/3;
296 if(neighborId > 2) neighborId = 2;
297 if(IsNeighbor) idl = 9 + neighborId;
304 if(station == 1 && (
ring == 1 ||
ring == 4) ){
306 index = (wire>>4)*32 + (eightstrip>>4);
310 if(corrIndex > 3) corrIndex -= 9;
312 if(IsNeighbor &&
ring == 4){
319 if(ph_reverse) th_corr = -th_corr;
322 if(th_tmp < 0 || wire == 0) th_tmp = 0;
324 if(th_tmp > th_coverage)
325 th_tmp = th_coverage;
329 if (th_tmp <= th_coverage) th = th_tmp + Th_Init_Neighbor_[SectIndex][LUTi];
339 if (th <= (ph_zone_bnd1 + zone_overlap)) phzvl |= 1;
340 if (th > (ph_zone_bnd2 - zone_overlap)) phzvl |= 4;
341 if ((th > (ph_zone_bnd1 - zone_overlap)) && (th <= (ph_zone_bnd2 + zone_overlap))) phzvl |= 2;
352 if(strip < 128) strip += 128;
356 int zoneword = 0, zhit = -99, zmask[4] = {1,2,4,8};
357 bool zoneConditions[4] {((phzvl & 1) && (Id < 4)),
358 (((phzvl & 2) && (Id < 4) && (station < 3)) || ((phzvl & 1) && (Id > 3) && (station > 2))),
359 (((phzvl & 1) && (Id > 3) && (Id < 7) && (station == 1)) || ((phzvl & 1) && (Id > 3) && (station == 2)) || ((phzvl & 2) && (Id > 3) && (station > 2))),
360 ( ((station == 1) && (Id > 6)) || ((phzvl & 2) && (Id > 3) && (station == 2)) || ((phzvl & 4) && (station == 3) && (Id > 3)) )};
362 for(
int z=0;
z<4;
z++){
363 if(zoneConditions[
z]) zoneword |= zmask[
z];
368 if(sub == 1) sindex--;
372 if(station == 1) cindex = Id/3 - 1;
373 else cindex = (station - 1)*2 + ((Id > 6) ? 2:1);
386 if(IsNeighbor) in = 1;
388 Hit.
SetValues(fph,th,ph_hit,phzvl,station,sub,Id,quality,
pattern,wire,strip,
BX);
396 if(Hit.
Theta() != -999 && Hit.
Phi() > 0 ){
397 ConvHits.push_back(Hit);
400 std::cout <<
"\n#####################################################################" << std::endl;
403 <<
", ring " << Det.
ring() <<
", ID " << C3.
Id() <<
", chamber " << Det.
chamber()
406 std::cout <<
"Has fph " << fph <<
", th " << th <<
", ph_hit " << ph_hit
407 <<
", phzvl " << phzvl <<
", station " << station <<
", sub " << sub
408 <<
", Id " << Id <<
", quality " << quality <<
", pattern " <<
pattern
409 <<
", wire " << wire <<
", strip " << strip <<
", BX " <<
BX << std::endl;
unsigned int Th_Init_Neighbor_[12][61]
void SetNeighbor(int neighbor)
int Th_LUT_St234_Neighbor_[3][12][11][112]
void SetZoneWord(int zword)
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
const CSCData getCSCData() const
void SetTP(L1TMuon::TriggerPrimitive tp)
const int getPattern() const
SeedingHitSet::ConstRecHitPointer Hit
int Th_Corr_Neighbor_[2][12][4][96]
int Th_LUT_St1_Neighbor_[2][12][16][64]
int triggerSector() const
unsigned int Ph_Disp_Neighbor_[12][61]
void SetValues(int phi, int theta, int ph_hit, int phzvl, int station, int sub, int id, int quality, int pattern, int wire, int strip, int BX)
int Ph_Init_Neighbor_[12][5][16]
void SetSectorIndex(int sectorIndex)