81 std::vector<ConvertedHit> ConvHits;
82 for(std::vector<L1TMuon::TriggerPrimitive>::iterator C1 = TriggPrim.begin();C1 != TriggPrim.end();C1++){
110 bool IsNeighbor =
neighbor(
endcap,sector,SectIndex,Id,sub,station);
112 if(
ring == 4){Id += 9;}
114 if( (SectIndex == (
endcap - 1)*6 + sector - 1 ) || IsNeighbor ) {
120 int ph_tmp = -999, th_tmp = -999;
121 int clctpatcor = -999, clctpatsign = -999;
122 int eightstrip = -999;
124 int factor = (station == 1 &&
ring == 4) ? 1707:
125 (station == 1 &&
ring == 3) ? 947:
126 (station == 1 &&
ring == 1) ? 1301:
129 bool ph_reverse = (
endcap == 1 && station >= 3) ? 1:
130 (
endcap == 2 && station < 3) ? 1: 0;
132 int ph_coverage = (station <= 1 && Id > 6 && Id < 10) ? 15 :
133 (station >= 2 && Id <= 3) ? 40 : 20;
135 int th_coverage = (station == 1 && Id <= 3) ? 45 :
136 (station == 1 && Id > 6 && Id < 10) ? 27 :
137 (station == 1 && Id > 3) ? 39 :
138 (station == 2 && Id <= 3) ? 43 :
139 (station == 2 && Id > 3) ? 56 :
140 (station == 3 && Id <= 3) ? 34 :
141 (station == 3 && Id > 3) ? 52 :
142 (station == 4 && Id <= 3) ? 28 :
143 (station == 4 && Id > 3) ? 50 : 0;
145 int ph_zone_bnd1 = (station <= 1 && (Id <= 3 || Id > 9)) ? 41 :
146 (station == 2 && Id <= 3) ? 41 :
147 (station == 2 && Id > 3) ? 87 :
148 (station == 3 && Id > 3) ? 49 :
149 (station == 4 && Id > 3) ? 49 : 127;
151 int ph_zone_bnd2 = (station == 3 && Id > 3) ? 87 : 127;
153 int zone_overlap = 2;
155 int fph = -999, th = -999, ph_hit = -999, phzvl = -999;
179 case 1: LUTi = nId - 1;
break;
180 case 2: LUTi = 15 + nId;
break;
184 case 2: LUTi = 27 + nId;
break;
185 case 3: LUTi = 38 + nId;
break;
186 case 4: LUTi = 49 + nId;
break;
189 if(IsNeighbor && station == 1){
192 case 1: LUTi = 15 + nId;
break;
193 case 2: LUTi = nId - 1;
break;
206 clctpatsign = ((
pattern%2) == 0);
207 if(
pattern >= 2) {clctpatcor = 5;}
208 if(
pattern >= 6) {clctpatcor = 2;}
209 if(
pattern == 10) {clctpatcor = 0;clctpatsign = 0;}
216 eightstrip = 8*
strip;
217 int patcor = clctpatcor;
219 if(station == 1 || Id > 3){
220 eightstrip = (eightstrip>>1);
221 patcor = (patcor>>1);
222 if(
ring == 4 &&
strip > 127) eightstrip -= 512;
225 if(clctpatsign) patcor = -patcor;
226 eightstrip += patcor;
232 ph_tmp = ((eightstrip*factor)>>10);
233 int phShift = (ph_tmp>>5);
242 int phInitIndex = Id;
245 int neighborId = C3.
Id()/3;
249 phInitIndex = 12 + neighborId;
256 int neighborId = Id/3;
257 if(neighborId > 2) neighborId = 2;
259 if(IsNeighbor) phInitIndex = 9 + neighborId;
264 if (station == 0 || nId == -1 || SectIndex < 0 || SectIndex > 11 || LUTi < 0 || LUTi > 60) {
265 LogDebug(
"L1TMuonEndCap") <<
"\n*********************************************************************" << std::endl;
268 <<
", ring " << Det.
ring() <<
", ID " << C3.
Id() <<
", chamber " << Det.
chamber()
271 LogDebug(
"L1TMuonEndCap") <<
"Produces: station " << station <<
", nId " << nId
272 <<
", SectIndex " << SectIndex <<
", LUTi " << LUTi << std::endl;
287 int neighborId = C3.
Id()/3;
291 idl = 12 + neighborId;
292 if(
ring == 4) idl = 16;
297 int neighborId = Id/3;
298 if(neighborId > 2) neighborId = 2;
299 if(IsNeighbor) idl = 9 + neighborId;
306 if(station == 1 && (
ring == 1 ||
ring == 4) ){
308 index = (wire>>4)*32 + (eightstrip>>4);
312 if(corrIndex > 3) corrIndex -= 9;
314 if(IsNeighbor &&
ring == 4){
321 if(ph_reverse) th_corr = -th_corr;
324 if(th_tmp < 0 || wire == 0) th_tmp = 0;
326 if(th_tmp > th_coverage)
327 th_tmp = th_coverage;
331 if (th_tmp <= th_coverage) th = th_tmp + Th_Init_Neighbor_[SectIndex][LUTi];
341 if (th <= (ph_zone_bnd1 + zone_overlap)) phzvl |= 1;
342 if (th > (ph_zone_bnd2 - zone_overlap)) phzvl |= 4;
343 if ((th > (ph_zone_bnd1 - zone_overlap)) && (th <= (ph_zone_bnd2 + zone_overlap))) phzvl |= 2;
358 int zoneword = 0, zhit = -99, zmask[4] = {1,2,4,8};
359 bool zoneConditions[4] {((phzvl & 1) && (Id < 4)),
360 (((phzvl & 2) && (Id < 4) && (station < 3)) || ((phzvl & 1) && (Id > 3) && (station > 2))),
361 (((phzvl & 1) && (Id > 3) && (Id < 7) && (station == 1)) || ((phzvl & 1) && (Id > 3) && (station == 2)) || ((phzvl & 2) && (Id > 3) && (station > 2))),
362 ( ((station == 1) && (Id > 6)) || ((phzvl & 2) && (Id > 3) && (station == 2)) || ((phzvl & 4) && (station == 3) && (Id > 3)) )};
364 for(
int z=0;
z<4;
z++){
365 if(zoneConditions[
z]) zoneword |= zmask[
z];
370 if(sub == 1) sindex--;
374 if(station == 1) cindex = Id/3 - 1;
375 else cindex = (station - 1)*2 + ((Id > 6) ? 2:1);
388 if(IsNeighbor) in = 1;
390 Hit.
SetValues(fph,th,ph_hit,phzvl,station,sub,Id,quality,
pattern,wire,
strip,
BX);
398 if(Hit.
Theta() != -999 && Hit.
Phi() > 0 ){
399 ConvHits.push_back(Hit);
402 LogDebug(
"L1TMuonEndCap") <<
"\n#####################################################################" << std::endl;
405 <<
", ring " << Det.
ring() <<
", ID " << C3.
Id() <<
", chamber " << Det.
chamber()
408 LogDebug(
"L1TMuonEndCap") <<
"Has fph " << fph <<
", th " << th <<
", ph_hit " << ph_hit
409 <<
", phzvl " << phzvl <<
", station " << station <<
", sub " << sub
410 <<
", Id " << Id <<
", quality " << quality <<
", pattern " <<
pattern 411 <<
", wire " << wire <<
", strip " <<
strip <<
", BX " <<
BX << std::endl;
unsigned int Th_Init_Neighbor_[12][61]
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
void SetNeighbor(int neighbor)
int Th_LUT_St234_Neighbor_[3][12][11][112]
void SetZoneWord(int zword)
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)