25 RespPar[
HCAL][0][0] =
pset.getParameter<
double>(
"HadronBarrelResolution_Stochastic");
26 RespPar[
HCAL][0][1] =
pset.getParameter<
double>(
"HadronBarrelResolution_Constant");
27 RespPar[
HCAL][0][2] =
pset.getParameter<
double>(
"HadronBarrelResolution_Noise");
29 RespPar[
HCAL][1][0] =
pset.getParameter<
double>(
"HadronEndcapResolution_Stochastic");
30 RespPar[
HCAL][1][1] =
pset.getParameter<
double>(
"HadronEndcapResolution_Constant");
31 RespPar[
HCAL][1][2] =
pset.getParameter<
double>(
"HadronEndcapResolution_Noise");
33 RespPar[
VFCAL][0][0] =
pset.getParameter<
double>(
"HadronForwardResolution_Stochastic");
34 RespPar[
VFCAL][0][1] =
pset.getParameter<
double>(
"HadronForwardResolution_Constant");
35 RespPar[
VFCAL][0][2] =
pset.getParameter<
double>(
"HadronForwardResolution_Noise");
37 RespPar[
VFCAL][1][0] =
pset.getParameter<
double>(
"ElectronForwardResolution_Stochastic");
38 RespPar[
VFCAL][1][1] =
pset.getParameter<
double>(
"ElectronForwardResolution_Constant");
39 RespPar[
VFCAL][1][2] =
pset.getParameter<
double>(
"ElectronForwardResolution_Noise");
41 eResponseScale[0] =
pset.getParameter<
double>(
"eResponseScaleHB");
42 eResponseScale[1] =
pset.getParameter<
double>(
"eResponseScaleHE");
43 eResponseScale[2] =
pset.getParameter<
double>(
"eResponseScaleHF");
45 eResponsePlateau[0] =
pset.getParameter<
double>(
"eResponsePlateauHB");
46 eResponsePlateau[1] =
pset.getParameter<
double>(
"eResponsePlateauHE");
47 eResponsePlateau[2] =
pset.getParameter<
double>(
"eResponsePlateauHF");
55 maxHDe[0] =
pset.getParameter<
int>(
"maxHBe");
56 maxHDe[1] =
pset.getParameter<
int>(
"maxHEe");
57 maxHDe[2] =
pset.getParameter<
int>(
"maxHFe");
58 maxHDe[3] =
pset.getParameter<
int>(
"maxHFlowe");
60 eGridHD[0] =
pset.getParameter<
vec1>(
"eGridHB");
61 eGridHD[1] =
pset.getParameter<
vec1>(
"eGridHE");
62 eGridHD[2] =
pset.getParameter<
vec1>(
"eGridHF");
63 eGridHD[3] =
pset.getParameter<
vec1>(
"loweGridHF");
68 HDeta[0] =
abs((
int)(
pset.getParameter<
double>(
"HBeta") /
etaStep));
69 HDeta[1] =
abs((
int)(
pset.getParameter<
double>(
"HEeta") /
etaStep));
70 HDeta[2] =
abs((
int)(
pset.getParameter<
double>(
"HFeta") /
etaStep));
71 HDeta[3] =
abs((
int)(
pset.getParameter<
double>(
"maxHDeta") /
etaStep));
73 maxHDetas[0] = HDeta[1] - HDeta[0];
74 maxHDetas[1] = HDeta[2] - HDeta[1];
75 maxHDetas[2] = HDeta[3] - HDeta[2];
78 nPar =
pset.getParameter<
int>(
"nPar");
79 parNames =
pset.getParameter<std::vector<std::string> >(
"parNames");
85 for (
int p = 0;
p <
nPar;
p++) {
86 for (
int m = 0;
m < 3;
m++) {
87 for (
int d = 0;
d < 3;
d++) {
95 for (
int i = 0;
i < maxHDe[
d];
i++) {
99 for (
int j = 0;
j < maxHDetas[
d];
j++) {
109 PoissonParameters =
vec3(4);
110 std::string PoissonParName[] = {
"mean_overall",
"shift_overall",
"mean_between",
"shift_between"};
111 for (
int d = 0;
d < 4;
d++) {
113 for (
int i = 0;
i < maxHDe[3];
i++) {
114 PoissonParameters[
d].resize(maxHDe[3]);
115 for (
int j = 0;
j < maxHDetas[2];
j++) {
116 PoissonParameters[
d][
i].resize(maxHDetas[2]);
117 PoissonParameters[
d][
i][
j] = tmp1[
i * maxHDetas[2] +
j];
124 mipfraction =
vec3(3);
125 for (
int d = 0;
d < 3;
d++) {
129 mipfraction[
d].resize(maxHDe[
d]);
130 for (
int i = 0;
i < maxHDe[
d];
i++) {
132 mipfraction[
d][
i].resize(maxHDetas[
d]);
133 for (
int j = 0;
j < maxHDetas[
d];
j++) {
135 mipfraction[
d][
i][
j] = tmp1[
i * maxHDetas[
d] +
j];
148 vec1 _responseMU[2] = {
pset.getParameter<
vec1>(
"responseMUBarrel"),
pset.getParameter<
vec1>(
"responseMUEndcap")};
151 double _barrelMUeta =
pset.getParameter<
double>(
"barrelMUeta");
152 double _endcapMUeta =
pset.getParameter<
double>(
"endcapMUeta");
191 LogInfo(
"FastCalorimetry") <<
" responseMU " <<
i <<
" " <<
j <<
" " <<
k <<
" = " << responseMU[
i][
j][
k]
201 maxEMeta = maxHDetas[2];
213 for (
int j = 0;
j < maxEMeta;
j++) {
225 vec1 _corrHFgHad =
pset.getParameter<
vec1>(
"corrHFgHad");
227 vec1 _corrHFhHad =
pset.getParameter<
vec1>(
"corrHFhHad");
251 int det = getDet(
ieta);
252 int deta =
ieta - HDeta[det];
253 if (deta >= maxHDetas[det])
254 deta = maxHDetas[det] - 1;
258 for (
int i = 0;
i < maxHDe[det];
i++) {
259 if (
energy < eGridHD[det][
i]) {
261 return mipfraction[det][0][deta];
268 return mipfraction[det][maxHDe[det] - 1]
271 double x1 = eGridHD[det][ie];
272 double x2 = eGridHD[det][ie + 1];
273 y1 = mipfraction[det][ie][deta];
274 y2 = mipfraction[det][ie + 1][deta];
298 if (
ieta >= maxEMeta)
321 else if (partype == 1) {
323 int det = getDet(
ieta);
324 int deta =
ieta - HDeta[det];
325 if (deta >= maxHDetas[det])
326 deta = maxHDetas[det] - 1;
331 for (
int i = 0;
i < maxHDe[det];
i++) {
332 if (
energy < eGridHD[det][
i]) {
341 ie = maxHDe[det] - 2;
344 if (det == 2 && energy < 20 && deta > 5) {
345 for (
int i = 0;
i < maxHDe[3];
i++) {
356 mean = interHD(mip,
energy, ie, deta, det, random);
360 else if (partype == 2) {
396 LogInfo(
"FastCalorimetry") << std::endl
397 <<
" HCALResponse::responseHCAL, partype = " << partype <<
" E, eta = " <<
energy <<
" " 398 <<
eta <<
" mean = " <<
mean << std::endl;
409 if (
x > responseMU[ie][
ieta][
i]) {
416 if (
x > responseMU[ie + 1][
ieta][
i]) {
429 LogInfo(
"FastCalorimetry") << std::endl
430 <<
" HCALResponse::interMU " << std::endl
431 <<
" x, x1-x2, y1-y2 = " <<
e <<
", " <<
x1 <<
"-" <<
x2 <<
" " <<
y1 <<
"-" <<
y2 440 LogInfo(
"FastCalorimetry") << std::endl
441 <<
" HCALResponse::interMU " << std::endl
442 <<
" e, ie, ieta = " <<
e <<
" " << ie <<
" " <<
ieta << std::endl
443 <<
" response = " <<
mean << std::endl;
458 if (det == 2 &&
ieta > 5 &&
e < 20) {
459 for (
int p = 0;
p < 4;
p++) {
460 y1 = PoissonParameters[
p][ie][
ieta];
461 y2 = PoissonParameters[
p][ie + 1][
ieta];
463 x1 = eGridHD[det + 1][ie];
464 x2 = eGridHD[det + 1][ie + 1];
470 random->
poissonShoot((
int(PoissonShootNoNegative(pars[0], pars[1], random)) +
471 (
int(PoissonShootNoNegative(pars[2], pars[3], random))) / 4 + random->
flatShoot() / 4) *
477 x1 = eGridHD[det][ie];
478 x2 = eGridHD[det][ie + 1];
481 for (
int p = 0;
p <
nPar;
p++) {
487 bool use_custom =
false;
491 if ((
p == 0 ||
p == 1) &&
e <
x1) {
494 custom =
y1 *
e /
x1;
499 else if ((
p == 2 ||
p == 3 ||
p == 4 ||
p == 5)) {
503 }
else if (
e >
x2 &&
y2 <
y1) {
518 mean = cballShootNoNegative(pars[0], pars[1], pars[2], pars[3], pars[4], pars[5], random);
520 mean = gaussShootNoNegative(pars[0], pars[1], random);
533 LogInfo(
"FastCalorimetry") << std::endl
534 <<
" HCALResponse::interEM mean " << std::endl
535 <<
" x, x1-x2, y1-y2 = " <<
e <<
", " <<
x1 <<
"-" <<
x2 <<
" " <<
y1 <<
"-" <<
y2 547 LogInfo(
"FastCalorimetry") << std::endl
548 <<
" HCALResponse::interEM sigma" << std::endl
549 <<
" x, x1-x2, y1-y2 = " <<
e <<
", " <<
x1 <<
"-" <<
x2 <<
" " <<
y1 <<
"-" <<
y2 557 double rndm = gaussShootNoNegative(
mean, sigma, random);
565 double s = eResponseScale[
hit];
567 double p = eResponsePlateau[
hit];
570 double response =
e *
p / (1 +
c *
exp(
n *
log(
s /
e)));
593 for (
d = 0;
d < 2;
d++) {
594 if (
ieta < HDeta[
d + 1]) {
616 double out = cball.shoot(
mu, sigma, aL, nL, aR, nR, random);
619 out = cball.shoot(
mu, sigma, aL, nL, aR, nR, random);
653 }
else if (jmin >=
maxEne - 1) {
675 corrHFem[
i] = y1em + (ee -
x1) * ((y2em - y1em) / (
x2 -
x1));
676 corrHFhad[
i] = y1had + (ee -
x1) * ((y2had - y1had) / (
x2 -
x1));
double responseHCAL(int _mip, double energy, double eta, int partype, RandomEngineAndDistribution const *)
double getHCALEnergyResponse(double e, int hit, RandomEngineAndDistribution const *)
double interEM(double e, int ie, int ieta, RandomEngineAndDistribution const *)
void correctHF(double e, int type)
double PoissonShootNoNegative(double e, double sigma, RandomEngineAndDistribution const *)
std::vector< double > vec1
Abs< T >::type abs(const T &t)
double getMIPfraction(double energy, double eta)
double interHD(int mip, double e, int ie, int ieta, int det, RandomEngineAndDistribution const *)
double gaussShoot(double mean=0.0, double sigma=1.0) const
Log< level::Info, false > LogInfo
double interMU(double e, int ie, int ieta, RandomEngineAndDistribution const *)
unsigned int poissonShoot(double mean) const
HCALResponse(const edm::ParameterSet &pset)
double flatShoot(double xmin=0.0, double xmax=1.0) const
double gaussShootNoNegative(double e, double sigma, RandomEngineAndDistribution const *)
double cballShootNoNegative(double mu, double sigma, double aL, double nL, double aR, double nR, RandomEngineAndDistribution const *)