CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Mapper.cc
Go to the documentation of this file.
1 
3 
4 namespace hcaldqm
5 {
6  namespace mapper
7  {
8  using namespace constants;
9  unsigned int generate_fSubDet(Input const& i)
10  {
11  int subdetector = i.i1;
12  if (subdetector>=1)
13  return subdetector-1;
14 
15  return 0;
16  }
17 
18  unsigned int generate_fiphi(Input const& i)
19  {
20  int iphi = i.i1;
21  unsigned int index = (iphi - IPHI_MIN)/IPHI_DELTA;
22  return index;
23  }
24 
25  // negative ietas go first always
26  unsigned int generate_fieta(Input const &i)
27  {
28  int ieta = i.i1;
29  unsigned int index;
30  if (ieta<0)
31  index = (abs(ieta) - IETA_MIN)/IETA_DELTA;
32  else
33  index = (ieta - IETA_MIN)/IETA_DELTA + IETA_NUM/2;
34 
35  return index;
36  }
37 
38  unsigned int generate_fdepth(Input const& i)
39  {
40  int depth = i.i1;
41  unsigned int index = depth-1;
42  return index;
43  }
44 
45  // packaging goes like this:
46  // all HB iphis, then HE, then HO, then HF
47  unsigned int generate_fSubDet_iphi(Input const& i)
48  {
49  int subdetector = i.i1;
50  int iphi = i.i2;
51  int totalHB = IPHI_NUM;
52  int totalHE = IPHI_NUM;
53  int totalHO = IPHI_NUM;
54  unsigned int index = 0;
55 
56  if (subdetector==HB)
57  index = (iphi-IPHI_MIN)/IPHI_DELTA;
58  else if (subdetector==HE)
59  index = totalHB + (iphi-IPHI_MIN)/IPHI_DELTA;
60  else if (subdetector==HO)
61  index = totalHB+totalHE + (iphi-IPHI_MIN)/IPHI_DELTA;
62  else // if HF
63  index = totalHB+totalHE+totalHO + (iphi-IPHI_MIN)/IPHI_DELTA_HF;
64 
65  return index;
66  }
67 
68  // packaging goes like this:
69  // all HB-, then HB+, then ...
70  unsigned int generate_fSubDet_ieta(Input const& i)
71  {
72  int subdetector = i.i1;
73  int ieta = i.i2;
74  int totalHB = IETA_MAX_HB-IETA_MIN_HB+1;
75  int totalHE = IETA_MAX_HE-IETA_MIN_HE+1;
76  int totalHO = IETA_MAX_HO-IETA_MIN_HO+1;
77  int totalHF = IETA_MAX_HF-IETA_MIN_HF+1;
78  unsigned int index = 0;
79 
80  if (subdetector==HB)
81  if (ieta<0)
82  index = (abs(ieta)-IETA_MIN_HB);
83  else
84  index = totalHB + (ieta-IETA_MIN_HB);
85  else if (subdetector==HE)
86  if (ieta<0)
87  index = 2*totalHB + (abs(ieta)-IETA_MIN_HE);
88  else
89  index = 2*totalHB + totalHE + ieta-IETA_MIN_HE;
90  else if (subdetector==HO)
91  if (ieta<0)
92  index = 2*totalHB + 2*totalHE + (abs(ieta)-IETA_MIN_HO);
93  else
94  index = 2*totalHB + 2*totalHE + totalHO +
95  ieta-IETA_MIN_HO;
96  else // if HF
97  if (ieta<0)
98  index = 2*totalHB + 2*totalHE + 2*totalHO +
99  (abs(ieta)-IETA_MIN_HF);
100  else
101  index = 2*totalHB + 2*totalHE + 2*totalHO + totalHF +
102  ieta-IETA_MIN_HF;
103 
104  return index;
105  }
106 
107  unsigned int generate_fFED(Input const& i)
108  {
109  int fed = i.i1;
110  unsigned int index = 0;
111  if (fed<=FED_VME_MAX)
112  index = (fed-FED_VME_MIN)/FED_VME_DELTA;
113  else if (fed>=FED_uTCA_MIN)
114  index = FED_VME_NUM + (fed-FED_uTCA_MIN)/FED_uTCA_DELTA;
115 
116  return index;
117  }
118 
119  unsigned int generate_fCrate(Input const& i)
120  {
121  int crate = i.i1;
122  unsigned int index = 0;
123 
124  if (crate<=CRATE_VME_MAX)
125  index = (crate - CRATE_VME_MIN)/CRATE_VME_DELTA;
126  else if(crate>=CRATE_uTCA_MIN)
127  index = CRATE_VME_NUM + (crate - CRATE_uTCA_MIN)/CRATE_uTCA_DELTA;
128 
129  return index;
130  }
131 
132  /*
133  * Off at the moment. 2 Crates FEDs per 1 VME FED
134  */
135  unsigned int generate_fFED_Slot(Input const &i)
136  {
137  return 0;
138  }
139 
140  unsigned int generate_fCrate_Slot(Input const&i)
141  {
142  int crate = i.i1;
143  int slot = i.i2;
144  unsigned int index = 0;
145 
146  if (crate<=CRATE_VME_MAX)
147  {
148  int icrate = (crate-CRATE_VME_MIN)/CRATE_VME_DELTA;
149  int sslot = slot<=SLOT_VME_MIN1 ? (slot-SLOT_VME_MIN) :
151  index = icrate*SLOT_VME_NUM + sslot;
152  }
153  else
154  index = CRATE_VME_NUM*SLOT_VME_NUM +
155  (crate-CRATE_uTCA_MIN)*SLOT_uTCA_NUM +
156  (slot-SLOT_uTCA_MIN);
157 
158  return index;
159  }
160 
161  unsigned int generate_fTPSubDet(Input const&i)
162  {
163  return i.i1<29 ? 0 : 1;
164  }
165 
166  unsigned int generate_fTPSubDet_iphi(Input const&i)
167  {
168  unsigned int index = 0;
169  if (i.i1<29)
170  index = i.i2-IPHI_MIN;
171  else
172  index = IPHI_NUM + (i.i2 - IPHI_MIN)/IPHI_DELTA_TPHF;
173 
174  return index;
175  }
176 
177  unsigned int generate_fTPSubDet_ieta(Input const&i)
178  {
179  unsigned int index = 0;
180  if (i.i1>=29)
181  index = 2*(IETA_MAX_TPHBHE-IETA_MIN+1)+
183  else if (i.i1<=-29)
184  index = 2*(IETA_MAX_TPHBHE-IETA_MIN+1) - (i.i1+IETA_MIN_HF);
185  else if (i.i1>0)
186  index = IETA_MAX_TPHBHE-IETA_MIN+1 + i.i1-IETA_MIN;
187  else
188  index = -(i.i1+IETA_MIN);
189 
190  return index;
191  }
192 
193  unsigned int generate_fSubDetPM(Input const&i)
194  {
195  return 2*(i.i1-1)+i.i2;
196  }
197 
198  unsigned int generate_fSubDetPM_iphi(Input const&i)
199  {
200  unsigned int index = 0;
201  int subdetector = 2*(i.i1-1)+i.i3;
202  int iphi = i.i2;
203 
204  if (subdetector==2*(HB-1)) // HBM
205  index = (iphi-IPHI_MIN)/IPHI_DELTA;
206  else if (subdetector==2*(HB-1)+1) // HBP
207  index = IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA;
208  else if (subdetector==2*(HE-1)) // HEM
209  index = 2*IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA;
210  else if (subdetector==2*(HE-1)+1) // HEP
211  index = 3*IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA;
212  else if (subdetector==2*(HO-1)) // HOM
213  index = 4*IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA;
214  else if (subdetector==2*(HO-1)+1) // HOP
215  index = 5*IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA;
216  else if (subdetector==2*(HF-1)) // HFM
217  index = 6*IPHI_NUM+(iphi-IPHI_MIN)/IPHI_DELTA_HF;
218  else
219  index = 6*IPHI_NUM+IPHI_NUM/IPHI_DELTA_HF +
220  (iphi-IPHI_MIN)/IPHI_DELTA_HF;
221 
222  return index;
223  }
224 
225  unsigned int generate_fTPSubDetPM(Input const&i)
226  {
227  unsigned int index = 0;
228  if (i.i1>0 && i.i1<29)
229  index = 1;
230  else if (i.i1<0 && i.i1>-29)
231  index = 0;
232  else if (i.i1<=-29)
233  index = 2;
234  else index = 3;
235 
236  return index;
237  }
238 
239  unsigned int generate_fTPSubDetPM_iphi(Input const& i)
240  {
241  unsigned int index = 0;
242  int ieta = i.i1;
243  int iphi = i.i2;
244  if (ieta<0 && ieta>-29) // HBHEM
245  index = iphi-IPHI_MIN;
246  else if (ieta>0 && ieta<29) // HBHEP
247  index = IPHI_NUM+iphi-IPHI_MIN;
248  else if (ieta<=-29)
249  index = IPHI_NUM*2 + (iphi-IPHI_MIN)/IPHI_DELTA_TPHF;
250  else
251  index = IPHI_NUM*2+IPHI_NUM_TPHF +
252  (iphi-IPHI_MIN)/IPHI_DELTA_TPHF;
253 
254  return index;
255  }
256 
257  unsigned int generate_fHFPM_iphi(Input const& i)
258  {
259  return IPHI_NUM_HF*i.i2 +
261  }
262 
263  unsigned int generate_fHBHEPartition(Input const& i)
264  {
265  unsigned int index = 0;
266  if (i.i1>=3 && i.i1<=26)
267  index = 0;
268  else if (i.i1>=27 && i.i1<=50)
269  index = 1;
270  else
271  index = 2;
272 
273  return index;
274  }
275  }
276 }
277 
int const IETA_MAX_HF
Definition: Constants.h:119
int const IETA_MIN_HO
Definition: Constants.h:116
int i
Definition: DBlmapReader.cc:9
int const IPHI_NUM
Definition: Constants.h:100
int const CRATE_VME_MIN
Definition: Constants.h:38
int const IETA_MAX_HB
Definition: Constants.h:113
unsigned int generate_fCrate(Input const &)
Definition: Mapper.cc:119
int const IETA_NUM
Definition: Constants.h:111
int const IETA_MIN_HE
Definition: Constants.h:114
unsigned int generate_fieta(Input const &)
Definition: Mapper.cc:26
int const IETA_MIN
Definition: Constants.h:108
unsigned int generate_fCrate_Slot(Input const &)
Definition: Mapper.cc:140
int const IPHI_MIN
Definition: Constants.h:98
int const SLOT_VME_NUM
Definition: Constants.h:60
int const FED_uTCA_MIN
Definition: Constants.h:31
int const SLOT_VME_MIN1
Definition: Constants.h:55
int const SLOT_VME_MIN2
Definition: Constants.h:56
int const IETA_MIN_HB
Definition: Constants.h:112
int const HF
Definition: Constants.h:86
unsigned int generate_fTPSubDet(Input const &)
Definition: Mapper.cc:161
unsigned int generate_fSubDetPM_iphi(Input const &)
Definition: Mapper.cc:198
unsigned int generate_fiphi(Input const &)
Definition: Mapper.cc:18
unsigned int generate_fdepth(Input const &)
Definition: Mapper.cc:38
int const FED_VME_MIN
Definition: Constants.h:26
int const FED_uTCA_DELTA
Definition: Constants.h:34
unsigned int generate_fSubDet(Input const &)
Definition: Mapper.cc:9
int const IPHI_NUM_HF
Definition: Constants.h:101
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int generate_fTPSubDet_ieta(Input const &)
Definition: Mapper.cc:177
int const IETA_MAX_TPHF
Definition: Constants.h:122
int const IPHI_DELTA_HF
Definition: Constants.h:104
int const SLOT_VME_MIN
Definition: Constants.h:54
int const IETA_MAX_HO
Definition: Constants.h:117
int const IETA_MAX_TPHBHE
Definition: Constants.h:121
int const CRATE_uTCA_MIN
Definition: Constants.h:43
int const SLOT_VME_NUM1
Definition: Constants.h:58
int const FED_VME_DELTA
Definition: Constants.h:28
int const CRATE_VME_DELTA
Definition: Constants.h:40
unsigned int generate_fFED_Slot(Input const &)
Definition: Mapper.cc:135
unsigned int generate_fHBHEPartition(Input const &)
Definition: Mapper.cc:263
int const FED_VME_NUM
Definition: Constants.h:29
int const IPHI_NUM_TPHF
Definition: Constants.h:102
int const CRATE_VME_NUM
Definition: Constants.h:41
unsigned int generate_fTPSubDet_iphi(Input const &)
Definition: Mapper.cc:166
int const IETA_MIN_HF
Definition: Constants.h:118
if(dp >Float(M_PI)) dp-
unsigned int generate_fSubDet_ieta(Input const &)
Definition: Mapper.cc:70
int const SLOT_uTCA_NUM
Definition: Constants.h:52
int const IETA_MAX_HE
Definition: Constants.h:115
unsigned int generate_fSubDetPM(Input const &)
Definition: Mapper.cc:193
unsigned int generate_fSubDet_iphi(Input const &)
Definition: Mapper.cc:47
int const HO
Definition: Constants.h:85
unsigned int generate_fFED(Input const &)
Definition: Mapper.cc:107
int const FED_VME_MAX
Definition: Constants.h:27
int const CRATE_uTCA_DELTA
Definition: Constants.h:45
int const IPHI_DELTA_TPHF
Definition: Constants.h:105
unsigned int generate_fHFPM_iphi(Input const &)
Definition: Mapper.cc:257
int const CRATE_VME_MAX
Definition: Constants.h:39
int const IETA_DELTA
Definition: Constants.h:109
int const SLOT_uTCA_MIN
Definition: Constants.h:49
unsigned int generate_fTPSubDetPM(Input const &)
Definition: Mapper.cc:225
int const IPHI_DELTA
Definition: Constants.h:103
unsigned int generate_fTPSubDetPM_iphi(Input const &)
Definition: Mapper.cc:239