CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1RCTORCAMap.cc
Go to the documentation of this file.
2 
3 #include <vector>
4 using std::vector;
5 
7  rawEMET = std::vector<unsigned short>(56*72);
8  rawHDET = std::vector<unsigned short>(56*72);
9  rawEMFG = std::vector<unsigned short>(56*72);
10  rawHDFG = std::vector<unsigned short>(56*72);
11  rawHFET = std::vector<unsigned short>(8*18);
12  combEM = std::vector<unsigned short>(56*72);
13  combHD = std::vector<unsigned short>(56*72);
14 
15  barrelData = std::vector<std::vector<std::vector<unsigned short> > >(18,std::vector<std::vector<unsigned short> >(7,
16  std::vector<unsigned short>(64)));
17  hfData = std::vector<std::vector<unsigned short> >(18,std::vector<unsigned short>(8));
18 
19 }
20 vector<std::vector<std::vector<unsigned short> > > L1RCTORCAMap::giveBarrel(){
21  return barrelData;
22 }
23 
24 vector<std::vector<unsigned short> > L1RCTORCAMap::giveHF(){
25  return hfData;
26 }
28  std::vector<unsigned short> crate(16);
29  for(int i = 0; i< 9; i++){
30  for(int j = 0; j<16; j++){
31  crate.at(j) = rawHFET.at(16*i+j);
32  }
33  hfData.at(i) = crate;
34  }
35 }
36 
38  std::vector<int> indices;
39  for(int phi = 0; phi<72;phi++){
40  for(int eta = 0; eta<56;eta++){
41  indices = orcamap(eta,phi);
42  (barrelData.at(indices.at(0))).at(indices.at(1)).at(indices.at(2)) = combEM.at(phi*56 + eta);
43  (barrelData.at(indices.at(0))).at(indices.at(1)).at(indices.at(2)+32) = combHD.at(phi*56 + eta);
44  }
45  }
46 }
47 
48 void L1RCTORCAMap::readData(std::vector<unsigned> emet, std::vector<unsigned> hdet,
49  std::vector<bool> emfg, std::vector<bool> hdfg,
50  std::vector<unsigned> hfet){
51  for(int i = 0; i<4032; i++){
52  rawEMET.at(i) = emet.at(i);
53  rawHDET.at(i) = hdet.at(i);
54  rawEMFG.at(i) = emfg.at(i);
55  rawHDFG.at(i) = hdfg.at(i);
56  }
57  for(int i = 0; i<144; i++)
58  rawHFET.at(i) = hfet.at(i);
59 
62 
64  makeHFData();
65 }
66 
67 unsigned short L1RCTORCAMap::combine(unsigned short et, unsigned short fg){
68  unsigned short newfg = fg << 8;
69  return newfg + et;
70 }
71 
72 vector<unsigned short> L1RCTORCAMap::combVec(std::vector<unsigned short> et,
73  std::vector<unsigned short> fg){
74  std::vector<unsigned short> comb(56*72);
75  for(int i = 0; i<(int)et.size(); i++)
76  comb.at(i) = combine(et.at(i),fg.at(i));
77  return comb;
78 }
79 
80 vector<int> L1RCTORCAMap::orcamap(int eta, int phi){
81  int crateNum(20);
82  std::vector<int> cardTower(2,0);
83  std::vector<int> returnVec(3,0);
84  int modEta = eta%28;
85  int modPhi = phi%8;
86  if(phi < 8)
87  crateNum = 0;
88  else if( phi < 16)
89  crateNum = 1;
90  else if( phi < 24)
91  crateNum = 2;
92  else if( phi < 32)
93  crateNum = 3;
94  else if( phi < 40)
95  crateNum = 4;
96  else if( phi < 48)
97  crateNum = 5;
98  else if( phi < 56)
99  crateNum = 6;
100  else if( phi < 64)
101  crateNum = 7;
102  else if( phi < 72)
103  crateNum = 8;
104 
105  if(eta < 28)
106  cardTower = lowEtaMap(modEta,modPhi);
107  else {
108  cardTower = highEtaMap(modEta,modPhi);
109  crateNum = crateNum + 9;
110  }
111 
112  returnVec.at(0) = crateNum;
113  for(int i =0; i<2; i++){
114  returnVec.at(i+1) = cardTower.at(i);
115  }
116  return returnVec;
117 }
118 
119 
120 vector<int> L1RCTORCAMap::lowEtaMap(int eta, int phi){
121  int cardnum = 0;
122  int towernum = 0;
123  std::vector<int> returnVec(2);
124  if(eta < 4){
125  cardnum = 6;
126  if(phi < 4)
127  towernum = (3-eta)*4 + phi;
128  else
129  towernum = eta*4 + phi + 12;
130  }
131  else if(eta <12){
132  if(phi < 4){
133  cardnum = 4;
134  if(eta < 8)
135  towernum = (7-eta)*4+phi+16;
136  else
137  towernum = (11-eta)*4+phi;
138  }
139  else{
140  cardnum = 5;
141  if(eta < 8)
142  towernum = (7-eta)*4+(phi-4)+16;
143  else
144  towernum = (11-eta)*4+(phi-4);
145  }
146  }
147  else if(eta < 20){
148  if(phi < 4){
149  cardnum = 2;
150  if(eta < 16)
151  towernum = (15-eta)*4+phi+16;
152  else
153  towernum = (19-eta)*4+phi;
154  }
155  else{
156  cardnum = 3;
157  if(eta < 16)
158  towernum = (15-eta)*4+(phi-4)+16;
159  else
160  towernum = (19-eta)*4+(phi-4);
161  }
162  }
163  else if(eta < 28){
164  if(phi < 4){
165  cardnum = 0;
166  if(eta < 24)
167  towernum = (23-eta)*4+phi+16;
168  else
169  towernum = (27-eta)*4+phi;
170  }
171  else{
172  cardnum = 1;
173  if(eta < 24)
174  towernum = (23-eta)*4+(phi-4)+16;
175  else
176  towernum = (27-eta)*4+(phi-4);
177  }
178  }
179 
180  returnVec.at(0) = cardnum;
181  returnVec.at(1) = towernum;
182  return returnVec;
183 }
184 
185 
186 vector<int> L1RCTORCAMap::highEtaMap(int eta, int phi){
187  int cardnum;
188  int towernum;
189  std::vector<int> returnVec(2);
190  if(eta < 8){
191  if(phi < 4){
192  cardnum = 0;
193  towernum = eta*4+phi;
194  }
195  else{
196  cardnum = 1;
197  towernum = eta*4+(phi-4);
198  }
199  }
200  else if(eta < 16){
201  if(phi < 4){
202  cardnum = 2;
203  towernum = (eta-8)*4+phi;
204  }
205  else{
206  cardnum = 3;
207  towernum = (eta-8)*4+(phi-4);
208  }
209  }
210  else if(eta < 24){
211  if(phi < 4){
212  cardnum = 4;
213  towernum = (eta-16)*4+phi;
214  }
215  else{
216  cardnum = 5;
217  towernum = (eta-16)*4+(phi-4);
218  }
219  }
220  else{
221  cardnum = 6;
222  if(phi < 4)
223  towernum = (27-eta)*4+phi;
224  else
225  towernum = (27-eta)*4+phi+12;
226  }
227 
228  returnVec.at(0)=cardnum;
229  returnVec.at(1)=towernum;
230  return returnVec;
231 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< std::vector< unsigned short > > > barrelData
Definition: L1RCTORCAMap.h:30
std::vector< unsigned short > combVec(std::vector< unsigned short > et, std::vector< unsigned short > fg)
Definition: L1RCTORCAMap.cc:72
std::vector< std::vector< unsigned short > > giveHF()
Definition: L1RCTORCAMap.cc:24
void readData(std::vector< unsigned > emet, std::vector< unsigned > hdet, std::vector< bool > emfg, std::vector< bool > hdfg, std::vector< unsigned > hfet)
Definition: L1RCTORCAMap.cc:48
std::vector< unsigned short > combHD
Definition: L1RCTORCAMap.h:47
std::vector< int > highEtaMap(int eta, int phi)
T eta() const
unsigned short combine(unsigned short et, unsigned short fg)
Definition: L1RCTORCAMap.cc:67
void makeBarrelData()
Definition: L1RCTORCAMap.cc:37
dictionary comb
std::vector< unsigned short > rawHDFG
Definition: L1RCTORCAMap.h:44
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< unsigned short > > hfData
Definition: L1RCTORCAMap.h:31
std::vector< int > orcamap(int eta, int phi)
Definition: L1RCTORCAMap.cc:80
std::vector< unsigned short > combEM
Definition: L1RCTORCAMap.h:46
std::vector< int > lowEtaMap(int eta, int phi)
std::vector< unsigned short > rawEMFG
Definition: L1RCTORCAMap.h:42
std::vector< unsigned short > rawHFET
Definition: L1RCTORCAMap.h:45
std::vector< unsigned short > rawEMET
Definition: L1RCTORCAMap.h:41
std::vector< unsigned short > rawHDET
Definition: L1RCTORCAMap.h:43
std::vector< std::vector< std::vector< unsigned short > > > giveBarrel()
Definition: L1RCTORCAMap.cc:20
void makeHFData()
Definition: L1RCTORCAMap.cc:27
list at
Definition: asciidump.py:428
Definition: DDAxes.h:10