18 #include "L1Trigger/CSCTrackFinder/test/src/RefTrack.h"
24 int ph_offsets_neighbor[5][10][3] = {{{39,39,-99} ,{57,57,-99} ,{76,76,-99} ,{39,-99,-99} ,{58,-99,-99} ,{76,-99,-99} ,{41,-99,-99} ,{60,-99,-99} ,{79,-99,-99} ,{21,21,23} },
25 {{95,95,-99} ,{114,114,-99} ,{132,132,-99} ,{95,-99,-99} ,{114,-99,-99} ,{133,-99,-99} ,{98,-99,-99} ,{116,-99,-99} ,{135,-99,-99} ,{21,21,23} },
26 {{38,38,-99} ,{76,76,-99} ,{113,113,-99} ,{39,39,-99} ,{58,58,-99} ,{76,76,-99} ,{95,95,-99} ,{114,114,-99} ,{132,132,-99} ,{1,21,21} },
27 {{38,-99,-99} ,{76,-99,-99} ,{113,-99,-99} ,{39,39,39} ,{58,58,58} ,{76,76,76} ,{95,95,95} ,{114,114,114} ,{132,132,132} ,{1,21,21} },
28 {{38,-99,-99} ,{76,-99,-99} ,{113,-99,-99} ,{38,38,-99} ,{57,57,-99} ,{76,76,-99} ,{95,95,-99} ,{113,113,-99} ,{132,132,-99} ,{1,20,20} }};
37 int CompIndex = (endcap - 1)*6 + sector - 1;
38 bool AdSector =
false;
39 if((SectIndex == 0 && CompIndex == 5) ||
40 (SectIndex == 1 && CompIndex == 0) ||
41 (SectIndex == 2 && CompIndex == 1) ||
42 (SectIndex == 3 && CompIndex == 2) ||
43 (SectIndex == 4 && CompIndex == 3) ||
44 (SectIndex == 5 && CompIndex == 4) ||
45 (SectIndex == 6 && CompIndex == 11) ||
46 (SectIndex == 7 && CompIndex == 6) ||
47 (SectIndex == 8 && CompIndex == 7) ||
48 (SectIndex == 9 && CompIndex == 8) ||
49 (SectIndex == 10 && CompIndex == 9) ||
50 (SectIndex == 11 && CompIndex == 10) ){AdSector =
true;}
52 if(AdSector && sub == 2 && station == 1 && (
id == 3 ||
id == 6 ||
id == 9) )
55 if(AdSector && station > 1 && (
id == 3 ||
id == 9) )
65 for (
unsigned i=0;
i<
size;
i++){
72 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/ph_disp_neighbor.txt", &Ph_Disp_Neighbor_[0][0], 12*61);
73 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/ph_init_neighbor.txt", &Ph_Init_Neighbor_[0][0][0], 12*5*16);
74 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/th_corr_neighbor.txt", &Th_Corr_Neighbor_[0][0][0][0], 2*12*4*96);
75 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/th_init_neighbor.txt", &Th_Init_Neighbor_[0][0], 12*61);
76 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/th_lut_st1_neighbor.txt", &Th_LUT_St1_Neighbor_[0][0][0][0], 2*12*16*64);
77 read_buf(
"L1Trigger/L1TMuon/data/emtf_luts/ph_lut_v1/th_lut_st234_neighbor.txt", &Th_LUT_St234_Neighbor_[0][0][0][0], 3*12*11*112);
86 std::vector<ConvertedHit> ConvHits;
87 for(std::vector<TriggerPrimitive>::iterator C1 = TriggPrim.begin();C1 != TriggPrim.end();C1++){
98 if(station == 1 &&
ring == 1 && strip > 127){
119 bool IsNeighbor =
neighbor(
endcap,sector,SectIndex,Id,sub,station);
122 if(
ring == 4){Id += 9;}
125 if( (SectIndex == (
endcap - 1)*6 + sector - 1 ) || IsNeighbor )
138 int ph_tmp = -999, th_tmp = -999;
139 int clctpatcor = -999, clctpatsign = -999;
140 int eightstrip = -999;
142 int factor = (station == 1 &&
ring == 4) ? 1707:
143 (station == 1 &&
ring == 3) ? 947:
144 (station == 1 &&
ring == 1) ? 1301:
149 bool ph_reverse = (
endcap == 1 && station >= 3) ? 1:
150 (
endcap == 2 && station < 3) ? 1: 0;
152 int ph_coverage = (station <= 1 && Id > 6 && Id < 10) ? 15 :
153 (station >= 2 && Id <= 3) ? 40 : 20;
155 int th_coverage = (station == 1 && Id <= 3) ? 45 :
156 (station == 1 && Id > 6 && Id < 10) ? 27 :
157 (station == 1 && Id > 3) ? 39 :
158 (station == 2 && Id <= 3) ? 43 :
159 (station == 2 && Id > 3) ? 56 :
160 (station == 3 && Id <= 3) ? 34 :
161 (station == 3 && Id > 3) ? 52 :
162 (station == 4 && Id <= 3) ? 28 :
163 (station == 4 && Id > 3) ? 50 : 0;
165 int ph_zone_bnd1 = (station <= 1 && (Id <= 3 || Id > 9)) ? 41 :
166 (station == 2 && Id <= 3) ? 41 :
167 (station == 2 && Id > 3) ? 87 :
168 (station == 3 && Id > 3) ? 49 :
169 (station == 4 && Id > 3) ? 49 : 127;
171 int ph_zone_bnd2 = (station == 3 && Id > 3) ? 87 : 127;
173 int zone_overlap = 2;
175 int fph = -999, th = -999, ph_hit = -999, phzvl = -999;
212 case 1: LUTi = nId - 1;
break;
213 case 2: LUTi = 15 + nId;
break;
217 case 2: LUTi = 27 + nId;
break;
218 case 3: LUTi = 38 + nId;
break;
219 case 4: LUTi = 49 + nId;
break;
223 if(IsNeighbor && station == 1){
227 case 1: LUTi = 15 + nId;
break;
228 case 2: LUTi = nId - 1;
break;
243 if(pattern > 0 && pattern < 11){
245 clctpatsign = ((pattern%2) == 0);
247 if(pattern >= 2) {clctpatcor = 5;}
248 if(pattern >= 6) {clctpatcor = 2;}
249 if(pattern == 10) {clctpatcor = 0;clctpatsign = 0;}
258 eightstrip = 8*strip;
259 int patcor = clctpatcor;
263 if(station == 1 || Id > 3){
265 eightstrip = (eightstrip>>1);
266 patcor = (patcor>>1);
267 if(
ring == 4 && strip > 127) eightstrip -= 512;
272 if(clctpatsign) patcor = -patcor;
273 eightstrip += patcor;
279 ph_tmp = ((eightstrip*factor)>>10);
280 int phShift = (ph_tmp>>5);
290 int phInitIndex = Id;
295 int neighborId = C3.
Id()/3;
300 phInitIndex = 12 + neighborId;
307 fph = Ph_Init_Neighbor_[SectIndex][subId-1][phInitIndex - 1] + ph_tmp;
312 int neighborId = Id/3;
317 phInitIndex = 9 + neighborId;
319 fph = Ph_Init_Neighbor_[SectIndex][
station][phInitIndex - 1] + ph_tmp;
323 ph_hit = phLow + phShift + (Ph_Disp_Neighbor_[SectIndex][LUTi]>>1);
337 int neighborId = C3.
Id()/3;
342 idl = 12 + neighborId;
350 th_tmp = Th_LUT_St1_Neighbor_[subId-1][SectIndex][idl -1][wire];
356 int neighborId = Id/3;
361 idl = 9 + neighborId;
363 th_tmp = Th_LUT_St234_Neighbor_[station-2][SectIndex][idl-1][wire];
368 th = th_tmp + Th_Init_Neighbor_[SectIndex][LUTi];
372 if(station == 1 && (
ring == 1 ||
ring == 4) ){
374 index = (wire>>4)*32 + (eightstrip>>4);
384 if(IsNeighbor &&
ring == 4){
396 th_corr = Th_Corr_Neighbor_[subId-1][SectIndex][corrIndex-1][
index];
401 if(ph_reverse) th_corr = -th_corr;
413 if(th_tmp < th_coverage){
417 th = th_tmp + Th_Init_Neighbor_[SectIndex][LUTi];
432 if(th <= (ph_zone_bnd1 + zone_overlap))
435 if(th > (ph_zone_bnd2 - zone_overlap))
438 if((th > (ph_zone_bnd1 - zone_overlap)) && (th <= (ph_zone_bnd2 + zone_overlap)))
452 int zhit = -99, pz = -99;
453 std::vector<int> zonecontribution;
464 if((phzvl & 1) && (Id < 4 || Id > 9)){pz=0;zonecontribution.push_back(0);}
465 if((phzvl & 2) && (Id < 4)){pz=1;zonecontribution.push_back(1);}
466 if((phzvl & 1) && (Id > 3) && (station > 2)){pz=0;zonecontribution.push_back(1);}
467 if((phzvl & 1) && (Id > 3) && (Id < 7) && (station == 1)){pz=0;zonecontribution.push_back(2);}
468 if((phzvl & 1) && (Id > 3) && (station == 2)){pz=0;zonecontribution.push_back(2);}
469 if((phzvl & 2) && (Id > 3) && (station > 2)){pz=1;zonecontribution.push_back(2);}
470 if((phzvl & 1) && (Id > 4) && (station < 2)){pz=0;zonecontribution.push_back(3);}
471 if(phzvl & 4){pz=2;zonecontribution.push_back(3);}
472 if((phzvl & 2) && (Id > 3) && (station < 3)){pz=1;zonecontribution.push_back(3);}
519 Hit.
SetValues(fph,th,ph_hit,phzvl,station,sub,Id,
quality,pattern,wire,strip,
BX);
526 if(Hit.
Theta() != -999 && Hit.
Phi() > 0){
527 ConvHits.push_back(Hit);
bool neighbor(int endcap, int sector, int SectIndex, int id, int sub, int station)
static void read_buf(const char *name, T *buf, unsigned size)
void SetZoneContribution(std::vector< int > zonecontribution)
void SetNeighbor(int neighbor)
const CSCData getCSCData() const
static std::string const input
const int getPattern() const
SeedingHitSet::ConstRecHitPointer Hit
int triggerSector() const
std::vector< ConvertedHit > convert(std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
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)
void SetTP(TriggerPrimitive tp)
tuple size
Write out results.
int ph_offsets_neighbor[5][10][3]
void SetSectorIndex(int sectorIndex)