7 #ifndef ADD_PrimitiveConverter_Neighbor
8 #define ADD_PrimitiveConverter_Neighbor
18 int CompIndex = (endcap - 1)*6 + sector - 1;
19 bool AdSector =
false;
20 if((SectIndex == 0 && CompIndex == 5) ||
21 (SectIndex == 1 && CompIndex == 0) ||
22 (SectIndex == 2 && CompIndex == 1) ||
23 (SectIndex == 3 && CompIndex == 2) ||
24 (SectIndex == 4 && CompIndex == 3) ||
25 (SectIndex == 5 && CompIndex == 4) ||
26 (SectIndex == 6 && CompIndex == 11) ||
27 (SectIndex == 7 && CompIndex == 6) ||
28 (SectIndex == 8 && CompIndex == 7) ||
29 (SectIndex == 9 && CompIndex == 8) ||
30 (SectIndex == 10 && CompIndex == 9) ||
31 (SectIndex == 11 && CompIndex == 10) ){AdSector =
true;}
33 if(AdSector && sub == 2 && station == 1 && (
id == 3 ||
id == 6 ||
id == 9) )
36 if(AdSector && station > 1 && (
id == 3 ||
id == 9) )
46 {{{39,39,-99}, {57,57,-99}, {76,76,-99}, {39,-99,-99}, {58,-99,-99},
47 {76,-99,-99}, {41,-99,-99}, {60,-99,-99}, {79,-99,-99}, {21,21,23}},
48 {{95,95,-99}, {114,114,-99}, {132,132,-99}, {95,-99,-99}, {114,-99,-99},
49 {133,-99,-99}, {98,-99,-99}, {116,-99,-99}, {135,-99,-99}, {21,21,23}},
50 {{38,38,-99}, {76,76,-99}, {113,113,-99}, {39,39,-99}, {58,58,-99},
51 {76,76,-99}, {95,95,-99}, {114,114,-99}, {132,132,-99}, {1,21,21}},
52 {{38,-99,-99}, {76,-99,-99}, {113,-99,-99}, {39,39,39}, {58,58,58},
53 {76,76,76}, {95,95,95}, {114,114,114}, {132,132,132}, {1,21,21}},
54 {{38,-99,-99}, {76,-99,-99}, {113,-99,-99}, {38,38,-99}, {57,57,-99},
55 {76,76,-99}, {95,95,-99}, {113,113,-99}, {132,132,-99}, {1,20,20}}};
57 std::vector<ConvertedHit>
PrimConv(std::vector<TriggerPrimitive> TriggPrim,
int SectIndex){
61 std::vector<ConvertedHit> ConvHits;
62 for(std::vector<TriggerPrimitive>::iterator C1 = TriggPrim.begin();C1 != TriggPrim.end();C1++){
67 TriggerPrimitive C3 = *C1;
71 int sector = Det.
triggerSector(), strip = C3.getCSCData().strip,
pattern = C3.getPattern(), Id = C3.Id();
74 if(station == 1 &&
ring == 1 && strip > 127){
93 bool IsNeighbor =
neighbor(
endcap,sector,SectIndex,Id,sub,station);
95 if(
ring == 4){Id += 9;}
98 if( (SectIndex == (
endcap - 1)*6 + sector - 1 ) || IsNeighbor )
111 int ph_tmp = -999, th_tmp = -999;
112 int clctpatcor = -999, clctpatsign = -999;
113 int eightstrip = -999;
116 (station == 1 &&
ring == 4) ? 1707:
117 (station == 1 &&
ring == 3) ? 947:
118 (station == 1 &&
ring == 1) ? 1301:
124 (
endcap == 1 && station >= 3) ? 1:
125 (
endcap == 2 && station < 3) ? 1: 0;
128 (station <= 1 && Id > 6 && Id < 10) ? 15 :
129 (station >= 2 && Id <= 3) ? 40 : 20;
132 (station == 1 && Id <= 3) ? 45 :
133 (station == 1 && Id > 6 && Id < 10) ? 27 :
134 (station == 1 && Id > 3) ? 39 :
135 (station == 2 && Id <= 3) ? 43 :
136 (station == 2 && Id > 3) ? 56 :
137 (station == 3 && Id <= 3) ? 34 :
138 (station == 3 && Id > 3) ? 52 :
139 (station == 4 && Id <= 3) ? 28 :
140 (station == 4 && Id > 3) ? 50 : 0;
143 (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;
188 case 1: LUTi = nId - 1;
break;
189 case 2: LUTi = 15 + nId;
break;
193 case 2: LUTi = 27 + nId;
break;
194 case 3: LUTi = 38 + nId;
break;
195 case 4: LUTi = 49 + nId;
break;
199 if(IsNeighbor && station == 1){
203 case 1: LUTi = 15 + nId;
break;
204 case 2: LUTi = nId - 1;
break;
219 clctpatsign = ((
pattern%2) == 0);
221 if(
pattern >= 2) {clctpatcor = 5;}
222 if(
pattern >= 6) {clctpatcor = 2;}
223 if(
pattern == 10) {clctpatcor = 0;clctpatsign = 0;}
230 eightstrip = 8*strip;
231 int patcor = clctpatcor;
235 if(station == 1 || Id > 3){
237 eightstrip = (eightstrip>>1);
238 patcor = (patcor>>1);
239 if(
ring == 4 && strip > 127) eightstrip -= 512;
244 if(clctpatsign) patcor = -patcor;
245 eightstrip += patcor;
251 ph_tmp = ((eightstrip*
factor)>>10);
252 int phShift = (ph_tmp>>5);
262 int phInitIndex = Id;
267 int neighborId = C3.Id()/3;
272 phInitIndex = 12 + neighborId;
283 int neighborId = Id/3;
288 phInitIndex = 9 + neighborId;
307 int neighborId = C3.Id()/3;
312 idl = 12 + neighborId;
324 int neighborId = Id/3;
329 idl = 9 + neighborId;
339 if(station == 1 && (
ring == 1 ||
ring == 4) ){
341 index = (wire>>4)*32 + (eightstrip>>4);
351 if(IsNeighbor &&
ring == 4){
361 if(ph_reverse) th_corr = -th_corr;
366 if(th_tmp < 0 || wire == 0)
369 if(th_tmp > th_coverage)
370 th_tmp = th_coverage;
376 if(th_tmp <= th_coverage){
380 th = th_tmp + Th_Init_Neighbor[SectIndex][LUTi];
395 if(th <= (ph_zone_bnd1 + zone_overlap))
398 if(th > (ph_zone_bnd2 - zone_overlap))
401 if((th > (ph_zone_bnd1 - zone_overlap)) && (th <= (ph_zone_bnd2 + zone_overlap)))
411 int zhit = -99, pz = -99;
413 std::vector<int> zonecontribution;
423 if((phzvl & 1) && (Id < 4 || Id > 9)){pz=0;zonecontribution.push_back(0);}
424 if((phzvl & 2) && (Id < 4)){pz=1;zonecontribution.push_back(1);}
425 if((phzvl & 1) && (Id > 3) && (station > 2)){pz=0;zonecontribution.push_back(1);}
426 if((phzvl & 1) && (Id > 3) && (Id < 7) && (station == 1)){pz=0;zonecontribution.push_back(2);}
427 if((phzvl & 1) && (Id > 3) && (station == 2)){pz=0;zonecontribution.push_back(2);}
428 if((phzvl & 2) && (Id > 3) && (station > 2)){pz=1;zonecontribution.push_back(2);}
429 if((phzvl & 1) && (Id > 4) && (station < 2)){pz=0;zonecontribution.push_back(3);}
430 if(phzvl & 4){pz=2;zonecontribution.push_back(3);}
431 if((phzvl & 2) && (Id > 3) && (station < 3)){pz=1;zonecontribution.push_back(3);}
472 Hit.
SetValues(fph,th,ph_hit,phzvl,station,sub,Id,quality,
pattern,wire,strip,
BX);
475 Hit.SetZoneContribution(zonecontribution);
479 if(Hit.
Theta() != -999 && Hit.
Phi() > 0){
480 ConvHits.push_back(Hit);
int Th_LUT_St234_Neighbor[3][12][11][112]
void SetNeighbor(int neighbor)
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
std::vector< ConvertedHit > PrimConv(std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
int Th_LUT_St1_Neighbor[2][12][16][64]
int ph_offsets_neighbor[5][10][3]
void SetTP(L1TMuon::TriggerPrimitive tp)
SeedingHitSet::ConstRecHitPointer Hit
int Th_Corr_Neighbor[2][12][4][96]
int triggerSector() const
unsigned int Ph_Disp_Neighbor[12][61]
unsigned int Th_Init_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)