CMS 3D CMS Logo

PtAddress.h
Go to the documentation of this file.
1 
9 
10 ptadd getAddress(std::vector<std::vector<int>> TP){
11 
12 
13 
14 
15 
16  int hits[3][3];
17  int count = 0,station = 0;
18  for(std::vector<std::vector<int>>::iterator i = TP.begin();i != TP.end();i++){
19 
20  station += (*i)[0];
21  hits[count][0] = (*i)[0];
22  hits[count][1] = (*i)[1];
23  hits[count][2] = (*i)[2];
24  count++;
25  }
26 
27  // In this example dphi12, dphi23, and eta are free parameters looped over below. You could fix any of these,
28  // and allow other parameters to run free as well.
29 
30  // Mode, FR, and Sign are fixed.
31 
32  // "dPhi12" in phi-units, generally the range is 0 - 511 units
33  int dphi12 = 0; // this is just a placeholder
34 
35  // "dPhi23" in phi-units, generally the range is 0 - 255 units
36  int dphi23 = 0; // this is just a placeholder
37 
38  // track-eta, from 0.9 - 2.4
39  //float eta = 1.5; // this is just a placeholder
40 
41  // Fixed Values //
42 
44  // 3-Station Modes
45  // mode = 2 => ME1-2-3
46  // mode = 3 => ME1-2-4
47  // mode = 4 => ME1-3-4
48  // mode = 5 => ME2-3-4
49  // Just use 3-station modes for now. Some additional changes have to be made to
50  // the code below to work with 2-station modes.
51  // Also note, the Pt scaling by +20% has been disabled for the purposes of this excercise.
52 
53  unsigned track_mode = 0;
54  switch(station){
55 
56  case 5: track_mode = 2;break;
57  case 6: track_mode = 3;break;
58  case 8: track_mode = 4;break;
59  case 9: track_mode = 5;break;
60  default: std::cout<<"station is out of range"<<std::endl;
61  }
62  dphi12 = fabs(hits[1][1] - hits[0][1]);
63  dphi23 = fabs(hits[2][1] - hits[1][1]);
64 
66  unsigned track_fr = 0;
67 
69  // sign = 1 => dphi12 and dphi23 have same sign
70  // sign = 0 => dphi12 and dphi23 have opposite sign
71  unsigned delta_phi_sign = 1;
72 
73 
74 
75  // Array that maps the 5-bit integer dPhi --> dPhi-units. It is assumed that this is used for dPhi23,
76  // which has a maximum value of 3.83 degrees (255 units) in the extrapolation units.
77  int dPhiNLBMap_5bit[32] =
78  {0,1,2,4,5,7,9,11,13,15,18,21,24,28,32,37,41,47,53,60,67,75,84,94,105,117,131,145,162,180,200,222};
79 
80  // Array that maps the 7-bit integer dPhi --> dPhi-units. It is assumed that this is used for dPhi12,
81  // which has a maximum value of 7.67 degrees (511 units) in the extrapolation units.
82  int dPhiNLBMap_7bit[128] =
83  {0,1,2,3,4,5,6,8,9,10,11,12,14,15,16,17,19,20,21,23,24,26,27,29,30,32,33,35,37,38,40,42,44,45,47,49,51,53,55,57,59,61,63,65,67,70,72,74,77,79,81,84,86,89,92,94,97,100,103,105,108,111,114,117,121,124,127,130,134,137,141,144,148,151,155,159,163,167,171,175,179,183,188,192,197,201,206,210,215,220,225,230,235,241,246,251,257,263,268,274,280,286,292,299,305,312,318,325,332,339,346,353,361,368,376,383,391,399,408,416,425,433,442,451,460,469,479,489};
84 
85 
86 
88  unsigned delta_phi_12 = 0;
89  int Nbins = 128;
90  for(int iPHI = 0; iPHI < Nbins-1; iPHI++)
91  if(fabs(dphi12) >= dPhiNLBMap_7bit[iPHI] && fabs(dphi12) < dPhiNLBMap_7bit[iPHI+1] )
92  {
93  delta_phi_12 = iPHI;
94  break;
95  }
96 
98  unsigned delta_phi_23 = 0;
99  Nbins = 32;
100  for(int iPHI = 0; iPHI < Nbins-1; iPHI++)
101  if(fabs(dphi23) >= dPhiNLBMap_5bit[iPHI] && fabs(dphi23) < dPhiNLBMap_5bit[iPHI+1] )
102  {
103  delta_phi_23 = iPHI;
104  break;
105  }
106 
107  int track_eta = hits[1][2];
108 
109  // Now make the full PTLUT Address
110  ptadd address;
111  // reform "dphi" portion of PTLUT due to using 7 bits + 5 bits rather than the old 8 bits + 4 bits.
112  unsigned merged = ((delta_phi_12 & ((1<<7)-1)) | ((delta_phi_23 & ((1<<5)-1)) << 7 ) );
113  address.delta_phi_12 = ((1<<8)-1) & merged;
114  address.delta_phi_23 = ((1<<4)-1) & (merged >> 8);
115  address.track_eta = track_eta;
116  address.track_mode = track_mode;
117  address.track_fr = track_fr;
118  address.delta_phi_sign = delta_phi_sign;
119 
120 
121 
122 
123 
124 
125 
126 
127  return address;
128 
129 
130 
131 }
ptadd getAddress(std::vector< std::vector< int >> TP)
Definition: PtAddress.h:10
class pt_address ptadd
static const int dPhiNLBMap_5bit[32]
static const int dPhiNLBMap_7bit[128]