8 #include "CLHEP/Random/RandGauss.h"
16 float value [4] = {value0, value0, value0, value0};
18 for (
int i = 0;
i < 4;
i++) {
19 value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i) / 100.);
20 while (value [
i] <= 0) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getWidth (
i));
24 value[0], value[1], value[2], value[3]
39 for (
int i = 0;
i < 4;
i++) {
41 for (
int j = 0;
j < 4;
j++) {
42 result.setSigma (
i,
j,
i ==
j ? width * width : 0);
56 float value [4] = {value0, value0, value0, value0};
57 if (fSmear)
for (
int i = 0;
i < 4;
i++) value [
i] = CLHEP::RandGauss::shoot (value0, width.
getValue (
i));
72 for (
unsigned range = 0; range < 4; range++) {
73 for (
unsigned capid = 0; capid < 4; capid++) {
74 result.setOffset (capid, range, offset);
75 result.setSlope (capid, range, slope);
84 for (
int i = 0;
i < 32;
i++) lowEdges[
i] = -1.5 +
i*0.35;
85 result.setMinCharges (lowEdges);
103 #define EMAP_NHBHECR 9
109 #define EMAP_NHSETS 4
110 #define EMAP_NTOPBOT 2
111 #define EMAP_NHTRSHO 4
112 #define EMAP_NHSETSHO 3
123 int fedhbhenum[
EMAP_NHBHECR][2]={{702,703},{704,705},{700,701},
124 {706,707},{716,717},{708,709},
125 {714,715},{710,711},{712,713}};
127 int fedhfnum[
EMAP_NHFCR][2]={{718,719},{720,721},{722,723}};
129 int fedhonum[
EMAP_NHOCR][2]={{724,725},{726,727},{728,729},{730,731}};
133 int ihslotho[
EMAP_NHSETSHO][
EMAP_NHTRSHO]={{2,3,4,5},{6,7,13,14},{15,16,17,18}};
135 int ihbhephis[
EMAP_NHBHECR]={11,19,3,27,67,35,59,43,51};
142 {{{{11,1},{ 7,1},{ 3,1}},
143 {{ 5,1},{ 1,1},{ 9,1}},
144 {{11,1},{ 7,1},{ 3,1}},
145 {{ 5,1},{ 1,1},{ 9,1}},
146 {{10,1},{ 6,1},{ 2,1}},
147 {{ 8,1},{ 4,1},{12,1}},
148 {{10,1},{ 6,1},{ 2,1}},
149 {{ 8,1},{ 4,1},{12,1}}},
150 {{{11,1},{ 7,1},{ 3,1}},
151 {{ 5,1},{ 1,1},{ 9,1}},
152 {{11,1},{ 7,1},{ 3,1}},
153 {{ 5,1},{ 1,1},{ 9,1}},
154 {{10,1},{ 6,1},{ 2,1}},
155 {{ 8,1},{ 4,1},{12,1}},
156 {{10,1},{ 6,1},{ 2,1}},
157 {{ 8,1},{ 4,1},{12,1}}}},
158 {{{{16,2},{15,2},{14,1}},
159 {{15,1},{13,1},{16,1}},
160 {{16,2},{15,2},{14,1}},
161 {{15,1},{13,1},{16,1}},
162 {{17,1},{16,3},{26,1}},
163 {{18,1},{18,2},{26,2}},
164 {{17,1},{16,3},{25,1}},
165 {{18,1},{18,2},{25,2}}},
166 {{{16,2},{15,2},{14,1}},
167 {{15,1},{13,1},{16,1}},
168 {{16,2},{15,2},{14,1}},
169 {{15,1},{13,1},{16,1}},
170 {{17,1},{16,3},{25,1}},
171 {{18,1},{18,2},{25,2}},
172 {{17,1},{16,3},{26,1}},
173 {{18,1},{18,2},{26,2}}}},
174 {{{{28,1},{28,2},{29,1}},
175 {{28,3},{24,2},{24,1}},
176 {{27,1},{27,2},{29,2}},
177 {{27,3},{23,2},{23,1}},
178 {{19,2},{20,1},{22,2}},
179 {{19,1},{20,2},{22,1}},
180 {{19,2},{20,1},{21,2}},
181 {{19,1},{20,2},{21,1}}},
182 {{{27,1},{27,2},{29,2}},
183 {{27,3},{23,2},{23,1}},
184 {{28,1},{28,2},{29,1}},
185 {{28,3},{24,2},{24,1}},
186 {{19,2},{20,1},{21,2}},
187 {{19,1},{20,2},{21,1}},
188 {{19,2},{20,1},{22,2}},
189 {{19,1},{20,2},{22,1}}}}
193 {{{33,1},{31,1},{29,1}},
194 {{32,1},{30,1},{34,1}},
195 {{33,2},{31,2},{29,2}},
196 {{32,2},{30,2},{34,2}},
197 {{34,2},{32,2},{30,2}},
198 {{31,2},{29,2},{33,2}},
199 {{34,1},{32,1},{30,1}},
200 {{31,1},{29,1},{33,1}}},
201 {{{41,1},{37,1},{35,1}},
202 {{38,1},{36,1},{39,1}},
203 {{41,2},{37,2},{35,2}},
204 {{38,2},{36,2},{39,2}},
205 {{40,2},{38,2},{36,2}},
206 {{37,2},{35,2},{39,2}},
207 {{40,1},{38,1},{36,1}},
208 {{37,1},{35,1},{39,1}}}
212 {{{{ 1,-1,0},{ 2,-1,0},{ 3,-1,0}},
213 {{ 1,-1,1},{ 2,-1,1},{ 3,-1,1}},
214 {{ 1,-1,2},{ 2,-1,2},{ 3,-1,2}},
215 {{ 1,-1,3},{ 2,-1,3},{ 3,-1,3}},
216 {{ 1,-1,4},{ 2,-1,4},{ 3,-1,4}},
217 {{ 1,-1,5},{ 2,-1,5},{ 3,-1,5}},
218 {{14, 1,0},{14, 1,1},{14, 1,2}},
219 {{14, 1,3},{14, 1,4},{14, 1,5}}},
220 {{{ 1, 1,0},{ 2, 1,0},{ 3, 1,0}},
221 {{ 1, 1,1},{ 2, 1,1},{ 3, 1,1}},
222 {{ 1, 1,2},{ 2, 1,2},{ 3, 1,2}},
223 {{ 1, 1,3},{ 2, 1,3},{ 3, 1,3}},
224 {{ 1, 1,4},{ 2, 1,4},{ 3, 1,4}},
225 {{ 1, 1,5},{ 2, 1,5},{ 3, 1,5}},
226 {{15, 1,0},{15, 1,1},{15, 1,2}},
227 {{15, 1,3},{15, 1,4},{15, 1,5}}}},
228 {{{{ 6, 1,0},{ 6, 1,1},{ 6, 1,2}},
229 {{ 6, 1,3},{ 6, 1,4},{ 6, 1,5}},
230 {{ 7, 1,0},{ 7, 1,1},{ 7, 1,2}},
231 {{ 7, 1,3},{ 7, 1,4},{ 7, 1,5}},
232 {{ 8, 1,0},{ 8, 1,1},{ 8, 1,2}},
233 {{ 8, 1,3},{ 8, 1,4},{ 8, 1,5}},
234 {{ 9, 1,0},{ 9, 1,1},{ 9, 1,2}},
235 {{ 9, 1,3},{ 9, 1,4},{ 9, 1,5}}},
236 {{{10, 1,0},{10, 1,1},{10, 1,2}},
237 {{10, 1,3},{10, 1,4},{10, 1,5}},
238 {{11, 1,0},{11, 1,1},{11, 1,2}},
239 {{11, 1,3},{11, 1,4},{11, 1,5}},
240 {{12, 1,0},{12, 1,1},{12, 1,2}},
241 {{12, 1,3},{12, 1,4},{12, 1,5}},
242 {{13, 1,0},{13, 1,1},{13, 1,2}},
243 {{13, 1,3},{13, 1,4},{13, 1,5}}}},
244 {{{{ 4,-1,0},{ 4,-1,1},{ 0, 0,0}},
245 {{ 4,-1,2},{ 4,-1,3},{ 0, 0,0}},
246 {{ 4,-1,4},{ 4,-1,5},{ 0, 0,0}},
247 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
248 {{ 5,-1,0},{ 5,-1,1},{ 5,-1,2}},
249 {{ 5,-1,3},{ 5,-1,4},{ 5,-1,5}},
250 {{14,-1,0},{14,-1,1},{14,-1,2}},
251 {{14,-1,3},{14,-1,4},{14,-1,5}}},
252 {{{ 4, 1,0},{ 4, 1,1},{ 0, 0,0}},
253 {{ 4, 1,2},{ 4, 1,3},{ 0, 0,0}},
254 {{ 4, 1,4},{ 4, 1,5},{ 0, 0,0}},
255 {{ 0, 0,0},{ 0, 0,0},{ 0, 0,0}},
256 {{ 5, 1,0},{ 5, 1,1},{ 5, 1,2}},
257 {{ 5, 1,3},{ 5, 1,4},{ 5, 1,5}},
258 {{15,-1,0},{15,-1,1},{15,-1,2}},
259 {{15,-1,3},{15,-1,4},{15,-1,5}}}},
260 {{{{ 6,-1,0},{ 6,-1,1},{ 6,-1,2}},
261 {{ 6,-1,3},{ 6,-1,4},{ 6,-1,5}},
262 {{ 7,-1,0},{ 7,-1,1},{ 7,-1,2}},
263 {{ 7,-1,3},{ 7,-1,4},{ 7,-1,5}},
264 {{ 8,-1,0},{ 8,-1,1},{ 8,-1,2}},
265 {{ 8,-1,3},{ 8,-1,4},{ 8,-1,5}},
266 {{ 9,-1,0},{ 9,-1,1},{ 9,-1,2}},
267 {{ 9,-1,3},{ 9,-1,4},{ 9,-1,5}}},
268 {{{10,-1,0},{10,-1,1},{10,-1,2}},
269 {{10,-1,3},{10,-1,4},{10,-1,5}},
270 {{11,-1,0},{11,-1,1},{11,-1,2}},
271 {{11,-1,3},{11,-1,4},{11,-1,5}},
272 {{12,-1,0},{12,-1,1},{12,-1,2}},
273 {{12,-1,3},{12,-1,4},{12,-1,5}},
274 {{13,-1,0},{13,-1,1},{13,-1,2}},
275 {{13,-1,3},{13,-1,4},{13,-1,5}}}}
277 int ic,is,ih,itb,ifb,ifc,ifwtb,iphi_loc;
278 int iside,ieta,iphi,idepth,icrate,ihtr,ihtr_fi,ifi_ch,ispigot,idcc,ifed;
294 icrate=hbhecrate[ic];
295 iside=is<EMAP_NHSETS/2?-1:1;
296 ifwtb=(is/2+itb+1)%2;
297 ieta=ihbheetadepth[ih][ifwtb][ifb][ifc][0];
298 idepth=ihbheetadepth[ih][ifwtb][ifb][ifc][1];
300 det=((ieta>16||idepth>2)?(
"HE"):(
"HB"));
301 fpga=((itb%2)==1)?(
"bot"):(
"top");
304 iphi=(ieta>20)?(ihbhephis[ic]+(is%2)*4+itb*2-1)%72+1:(ihbhephis[ic]+(is%2)*4+itb*2+(ifb/2+is/2+1)%2-1)%72+1;
305 ispigot=(is%2)*6+ih*2+itb;
306 idcc=is<EMAP_NHSETS/2?1:2;
308 ifed=fedhbhenum[ic][idcc-1];
311 elId.
setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
330 iside=is<EMAP_NHSETS/2?-1:1;
331 ieta=ihfetadepth[itb][ifb][ifc][0];
332 idepth=ihfetadepth[itb][ifb][ifc][1];
335 fpga=((itb%2)==1)?(
"bot"):(
"top");
338 iphi=(ieta>39)?(ihfphis[ic]+(is%2)*12+ih*4-3)%72+1:(ihfphis[ic]+(is%2)*12+ih*4+(ifb/4)*2-1)%72+1;
339 ispigot=(is%2)*6+ih*2+itb;
340 idcc=is<EMAP_NHSETS/2?1:2;
342 ifed=fedhfnum[ic][idcc-1];
344 elId.
setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
363 ieta=ihoetasidephi[ih][itb][ifb][ifc][0];
364 iside=ihoetasidephi[ih][itb][ifb][ifc][1];
365 iphi_loc=ihoetasidephi[ih][itb][ifb][ifc][2];
366 ihtr=ihslotho[is][ih];
368 fpga=((itb%2)==1)?(
"bot"):(
"top");
371 iphi=(ihophis[ic]+is*6+iphi_loc-1)%72+1;
372 ispigot=ihtr<9?(ihtr-2)*2+itb:(ihtr-13)*2+itb;
375 ifed=fedhonum[ic][idcc-1];
377 elId.
setHTR(icrate, ihtr, (fpga==
"top")?(1):(0));
CastorPedestalWidth makePedestalWidth(HcalGenericDetId fId)
static const HcalDetId Undefined
CastorQIECoder makeQIECoder(HcalGenericDetId fId)
void makeHardcodeMap(CastorElectronicsMap &emap)
static const double slope[3]
void setHTR(int crate, int slot, int tb)
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
float getValue(int fCapId) const
get value for capId = 0..3
uint32_t rawId() const
get the raw id
int depth() const
get the tower depth
CastorQIEShape makeQIEShape()
CastorRecoParam makeRecoParam(HcalGenericDetId fId)
CastorSaturationCorr makeSaturationCorr(HcalGenericDetId fId)
CastorGainWidth makeGainWidth(HcalGenericDetId fId)
CastorPedestal makePedestal(HcalGenericDetId fId, bool fSmear=false)
CastorGain makeGain(HcalGenericDetId fId, bool fSmear=false)
bool mapEId2chId(CastorElectronicsId fElectronicsId, DetId fId)
Readout chain identification for Castor Bits for the readout chain : some names need change! [31:26] ...
CastorCalibrationQIECoder makeCalibrationQIECoder(HcalGenericDetId fId)
HcalGenericSubdetector genericSubdet() const