CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
PrimitiveConverter.h File Reference
#include "L1Trigger/L1TMuonEndCap/interface/EmulatorClasses.h"
#include "L1Trigger/L1TMuonEndCap/interface/PhThLUTs.h"

Go to the source code of this file.

Functions

std::vector< ConvertedHitPrimConv (std::vector< TriggerPrimitive > TriggPrim, int SectIndex)
 

Variables

int ph_offsetss [5][9][3]
 

Function Documentation

std::vector<ConvertedHit> PrimConv ( std::vector< TriggerPrimitive TriggPrim,
int  SectIndex 
)
Define Subsector ///

/// ME1 only ////////

Define look-up index ///

Definition at line 21 of file PrimitiveConverter.h.

References rpcdqm::BX, L1TMuon::TriggerPrimitive::CSCData::bx, CSCDetId::chamber(), L1TMuon::TriggerPrimitive::detId(), Reference_intrackfit_cff::endcap, CSCDetId::endcap(), L1TMuon::TriggerPrimitive::getCSCData(), L1TMuon::TriggerPrimitive::getPattern(), L1TMuon::TriggerPrimitive::Id(), cmsHarvester::index, L1TMuon::TriggerPrimitive::CSCData::keywire, listBenchmarks::pattern, ph_offsetss, PhDisp, ConvertedHit::Phi(), PhInit, L1TMuon::TriggerPrimitive::CSCData::quality, HLT_FULL_cff::quality, relativeConstraints::ring, CSCDetId::ring(), ConvertedHit::SetTP(), ConvertedHit::SetValues(), ConvertedHit::SetZhit(), ConvertedHit::SetZoneContribution(), St1ThLUT, relativeConstraints::station, CSCDetId::station(), L1TMuon::TriggerPrimitive::CSCData::strip, THCORR, ConvertedHit::Theta(), ThInit, ThLUT, and CSCDetId::triggerSector().

Referenced by L1TMuonEndCapTrackProducer::produce().

21  {
22 
23  //bool verbose = false;
24 
25  std::vector<ConvertedHit> ConvHits;
26  for(std::vector<TriggerPrimitive>::iterator C1 = TriggPrim.begin();C1 != TriggPrim.end();C1++){
27 
31  TriggerPrimitive C3 = *C1;
32  CSCDetId Det = C3.detId<CSCDetId>();
33 
34  int station = Det.station(), chamber = Det.chamber(), ring = Det.ring(), wire = C3.getCSCData().keywire, sector = Det.triggerSector(), strip = C3.getCSCData().strip;
35  int pattern = C3.getPattern(), Id = C3.Id(), quality = C3.getCSCData().quality, BX = C3.getCSCData().bx, endcap = Det.endcap();
36 
37  if(ring == 4){Id += 9;}
38 
39  //if(endcap == 1 && sector == 1)//
40  if(SectIndex == (endcap - 1)*6 + sector - 1)
41  {
42 
43  //if(verbose){
44  // std::cout<<"\n\nSECTOR "<<SectIndex<<"\n\n";
45  // std::cout<<"\n\nRING = "<<ring<<"\n\n";
46  //}
47 
51 
52  int ph_tmp = -999, th_tmp = -999;
53  int clctpatcor = -999, clctpatsign = -999;
54  int eightstrip = -999;
55 
56  int factor = (station == 1 && ring == 4) ? 1707://ME1/1a1707?
57  (station == 1 && ring == 3) ? 947: //ME1/3//changed Id > 6 to ring == 3.
58  (station == 1 && ring == 1) ? 1301://ME1/1b
59  1024;//all other chambers
60 
61  //std::cout<<"factor = "<<factor<<std::endl;
62 
63  bool ph_reverse = (endcap == 1 && station >= 3) ? 1:
64  (endcap == 2 && station < 3) ? 1: 0;
65 
66  int ph_coverage = (station <= 1 && Id > 6 && Id < 10) ? 15 : //30 :
67  (station >= 2 && Id <= 3) ? 40 : 20; //80 : 40;
68 
69  int th_coverage = (station == 1 && Id <= 3) ? 45 :
70  (station == 1 && Id > 6 && Id < 10) ? 27 :
71  (station == 1 && Id > 3) ? 39 :
72  (station == 2 && Id <= 3) ? 43 :
73  (station == 2 && Id > 3) ? 56 :
74  (station == 3 && Id <= 3) ? 34 :
75  (station == 3 && Id > 3) ? 52 :
76  (station == 4 && Id <= 3) ? 28 :
77  (station == 4 && Id > 3) ? 50 : 0;
78 
79  int ph_zone_bnd1 = (station <= 1 && (Id <= 3 || Id > 9)) ? 41 :
80  (station == 2 && Id <= 3) ? 41 :
81  (station == 2 && Id > 3) ? 87 :
82  (station == 3 && Id > 3) ? 49 :
83  (station == 4 && Id > 3) ? 49 : 127;
84 
85  int ph_zone_bnd2 = (station == 3 && Id > 3) ? 87 : 127;
86 
87  int zone_overlap = 2;
88 
89  int fph = -999, th = -999, ph_hit = -999, phzvl = -999;// th_hit = -999, ////
90 
91  int sub = 0;
92 
97 
98  if(station == 1)
99  {
100 
101  if(chamber%6 > 2)
102  sub = 1;
103  else
104  sub = 2;
105 
106  }
107 
108  //if(sub && verbose)
109  // std::cout<<"\nsub = "<<sub<<"\n";
110 
114 
115  int LUTi = -999;
116  switch(station)
117  {
118  case 1:
119  switch(sub)
120  {
121  case 1: LUTi = Id - 1;break;
122  case 2: LUTi = 11 + Id;break;
123  default:;//std::cout<<"Sub is out of range"<<std::endl;
124  }
125  break;
126  case 2: LUTi = 23 + Id;break;
127  case 3: LUTi = 32 + Id;break;
128  case 4: LUTi = 41 + Id;break;
129  default:;//std::cout<<"station is out of range"<<std::endl;
130  }
131 
135 
136  clctpatcor = 0;
137  clctpatsign = 0;
138 
139  if(pattern > 0 && pattern < 11){
140 
141  clctpatsign = ((pattern%2) == 0);
142 
143  if(pattern >= 2) {clctpatcor = 5;}
144  if(pattern >= 6) {clctpatcor = 2;}
145  if(pattern == 10) {clctpatcor = 0;clctpatsign = 0;}
146  }
147 
148 
149 
153 
154  eightstrip = 8*strip;
155  int patcor = clctpatcor;
156 
157  if(station == 1 || Id > 3){//10 Degree Chambers
158 
159  eightstrip = (eightstrip>>1);
160  patcor = (patcor>>1);
161  //if(ring == 4) eightstrip -= 512;
162  }
163 
164  if(clctpatsign) patcor = -patcor;
165  eightstrip += patcor;
166 
170 
171  ph_tmp = ((eightstrip*factor)>>10);
172  int phShift = (ph_tmp>>5);
173  int phLow = 0;
174 
175  if(ph_reverse){
176 
177  ph_tmp = -ph_tmp;
178  phShift = -phShift;
179  phLow = ph_coverage;
180  }
181 
182 
183  if(station == 1){
184 
185  fph = PhInit[SectIndex][sub-1][Id - 1] + ph_tmp;
186  }
187  else{
188 
189  fph = PhInit[SectIndex][station][Id - 1] + ph_tmp;
190  }
191 
192 
193  ph_hit = phLow + phShift + (PhDisp[SectIndex][LUTi]>>1);
194 
198 
199  int index = -999;
200  int th_corr = -999;
201 
202  if(station == 1){
203 
204  int idl = Id;
205  if(Id < 4)//
206  idl += 9;
207 
208  th_tmp = St1ThLUT[sub-1][SectIndex][idl -1][wire];
209  //if(verbose) std::cout<<"\n\nth_tmpr = "<<th_tmp<<"\n\n";
210  }
211  else{
212  th_tmp = ThLUT[station-2][SectIndex][Id-1][wire];
213  //if(verbose) std::cout<<"\n\nth_tmpr = "<<th_tmp<<"\n\n";
214  }
215 
216 
217  th = th_tmp + ThInit[SectIndex][LUTi];
218  //if(verbose) std::cout<<"ThInit = "<<ThInit[SectIndex][LUTi]<<"\n";
219 
220  if(station == 1 && (ring == 1 || ring == 4) /*&& endcap == 1*/){
221 
222  index = (wire>>4)*32 + (eightstrip>>4);
223 
224  if(Id > 3){
225  th_corr = THCORR[sub-1][SectIndex][Id-10][index];
226  //if(verbose) std::cout<<"\n\nth_corr = "<<th_corr<<"\n\n";
227  }
228  else{
229  th_corr = THCORR[sub-1][SectIndex][Id-1][index];
230  //if(verbose) std::cout<<"\n\nth_corr = "<<th_corr<<"\n\n";
231  }
232 
233 
234  if(ph_reverse) th_corr = -th_corr;
235 
236 
237  th_tmp += th_corr; //add correction to th_tmp
238  th_tmp &= 0x3f; //keep only lowest 6 bits
239 
240 
241  if(th_tmp < th_coverage){
242 
243  if(ring == 1){LUTi += 9;} //change because new Verilog3 sp_tf treats ME11b with LUT's of ME11a
244 
245  th = th_tmp + ThInit[SectIndex][LUTi];
246  }
247  else{th = -999;}
248 
249  }
250 
254 
255  if(th != -999){
256 
257  phzvl = 0;
258 
259  if(th <= (ph_zone_bnd1 + zone_overlap))
260  {phzvl |= 1;}
261 
262  if(th > (ph_zone_bnd2 - zone_overlap))
263  {phzvl |= 4;}
264 
265  if((th > (ph_zone_bnd1 - zone_overlap)) && (th <= (ph_zone_bnd2 + zone_overlap)))
266  {phzvl |= 2;}
267  }
268 
269 
270 
276 
277 
278  if(Id > 9){
279  Id -= 9;strip += 128;
280  }
281 
282 
283  int zhit = -99, pz = -99;
284  std::vector<int> zonecontribution; //Each hit could go in more than one zone so we make a vector which stores all the zones for which this hit will contribute
285 
286 
287  //determination of zone contribution
288  if((phzvl & 1) && (Id < 4)){pz=0;zonecontribution.push_back(0);}
289  if((phzvl & 2) && (Id < 4)){pz=1;zonecontribution.push_back(1);}
290  if((phzvl & 1) && (Id > 3) && (station > 2)){pz=0;zonecontribution.push_back(1);}
291  if((phzvl & 1) && (Id > 3) && (Id < 7) && (station == 1)){pz=0;zonecontribution.push_back(2);}
292  if((phzvl & 1) && (Id > 3) && (station == 2)){pz=0;zonecontribution.push_back(2);}
293  if((phzvl & 2) && (Id > 3) && (station > 2)){pz=1;zonecontribution.push_back(2);}
294  if((phzvl & 1) && (Id > 4) && (station < 2)){pz=0;zonecontribution.push_back(3);}
295  if(phzvl & 4){pz=2;zonecontribution.push_back(3);}
296  if((phzvl & 2) && (Id > 3) && (station < 3)){pz=1;zonecontribution.push_back(3);}
297 
298 
299  //applying ph_offsets
300  if(sub == 1)
301  zhit = ph_hit + ph_offsetss[station-1][Id-1][pz];
302  else
303  zhit = ph_hit + ph_offsetss[station][Id-1][pz];
304 
305 
306 
307 
312 
313  //if(verbose) std::cout<<"Phi = "<<fph<<" and Theta = "<<th<<std::endl;
314 
316 
317  Hit.SetValues(fph,th,ph_hit,phzvl,station,sub,Id,quality,pattern,wire,strip,BX);
318  Hit.SetTP(C3);
319  Hit.SetZhit(zhit);
320  Hit.SetZoneContribution(zonecontribution);
321 
322  if(Hit.Theta() != -999 && Hit.Phi() > 0){//if theta is valid
323  ConvHits.push_back(Hit);
324  /*if(verbose){
325  std::cout<<"Phzvl() = "<<Hit.Phzvl()<<", ph_hit = "<<Hit.Ph_hit()<<", station = "<<Hit.Station()<<" and id = "<<Hit.Id()<<std::endl;
326  std::cout<<"strip = "<<strip<<", wire = "<<wire<<" and zhit = "<<zhit<<std::endl;
327  std::cout<<"\n\nIn Zones: ";
328  for(std::vector<int>::iterator in = zonecontribution.begin();in!=zonecontribution.end();in++){
329  std::cout<<" "<<*in<<" ";
330  }
331  }*/
332  }
333 
334 
335  }//if sector == sectIndex
336 
337  }
338  return ConvHits;
339 
340 }
int St1ThLUT[2][12][12][64]
Definition: PhThLUTs.h:513
int chamber() const
Definition: CSCDetId.h:68
void SetZoneContribution(std::vector< int > zonecontribution)
int THCORR[2][12][3][98]
Definition: PhThLUTs.h:9135
int ph_offsetss[5][9][3]
const CSCData getCSCData() const
int endcap() const
Definition: CSCDetId.h:93
unsigned int ThInit[12][51]
Definition: PhThLUTs.h:10253
unsigned int PhDisp[12][51]
Definition: PhThLUTs.h:411
SeedingHitSet::ConstRecHitPointer Hit
int ring() const
Definition: CSCDetId.h:75
int triggerSector() const
Definition: CSCDetId.cc:3
void SetZhit(int zhit)
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 ThLUT[3][12][9][112]
Definition: PhThLUTs.h:3791
int station() const
Definition: CSCDetId.h:86
void SetTP(TriggerPrimitive tp)
int PhInit[12][5][12]
Definition: PhThLUTs.h:1

Variable Documentation

int ph_offsetss[5][9][3]
Initial value:
= {{{2,2,-99},{20,20,-99},{39,39,-99},{2,-99,-99},{21,-99,-99},{39,-99,-99},{4,-99,-99},{23,-99,-99},{42,-99,-99}},
{{58,58,-99},{77,77,-99},{95,95,-99},{58,-99,-99},{77,-99,-99},{96,-99,-99},{61,-99,-99},{79,-99,-99},{98,-99,-99}},
{{1,1,-99},{39,39,-99},{76,76,-99},{2,2,-99},{21,21,-99},{39,39,-99},{58,58,-99},{77,77,-99},{95,95,-99}},
{{1,-99,-99},{39,-99,-99},{76,-99,-99},{2,2,2},{21,21,21},{39,39,39},{58,58,58},{77,77,77},{95,95,95}},
{{1,-99,-99},{39,-99,-99},{76,-99,-99},{2,1,-99},{21,20,-99},{39,39,-99},{58,58,-99},{77,76,-99},{95,95,-99}}}

Definition at line 14 of file PrimitiveConverter.h.

Referenced by PrimConv().