CMS 3D CMS Logo

GflashPiKShowerProfile.cc
Go to the documentation of this file.
2 #include <CLHEP/Random/RandGaussQ.h>
3 
5  double einc = theShowino->getEnergy();
7  int showerType = theShowino->getShowerType();
8 
9  // energy scale
10  double energyMeanHcal = 0.0;
11  double energySigmaHcal = 0.0;
12 
13  double r1 = 0.0;
14  double r2 = 0.0;
15 
16  if (showerType == 0 || showerType == 1 || showerType == 4 || showerType == 5) {
17  //@@@ energy dependent energyRho based on tuning with testbeam data
18  double energyRho = fTanh(einc, Gflash::pion_correl_hadem);
19 
20  if (showerType == 0 || showerType == 1) {
21  do {
22  r1 = CLHEP::RandGaussQ::shoot();
23 
25  einc * (fTanh(einc, Gflash::pion_emscale[0]) + fTanh(einc, Gflash::pion_emscale[1]) * r1);
26 
27  // LogNormal mean and sigma of Hcal energy
28  energyMeanHcal = (fTanh(einc, Gflash::pion_hadscale[0]) +
29  fTanh(einc, Gflash::pion_hadscale[1]) *
31  energySigmaHcal = (fTanh(einc, Gflash::pion_hadscale[2]) +
32  fTanh(einc, Gflash::pion_hadscale[3]) *
34 
35  r2 = CLHEP::RandGaussQ::shoot();
37  exp(energyMeanHcal + energySigmaHcal * (energyRho * r1 + sqrt(1.0 - energyRho * energyRho) * r2));
38  } while (energyScale[Gflash::kESPM] < 0 || energyScale[Gflash::kHB] > einc * 1.5);
39  } else {
40  do {
41  r1 = CLHEP::RandGaussQ::shoot();
43  einc * (fTanh(einc, Gflash::pion_emscale[0]) + fTanh(einc, Gflash::pion_emscale[1]) * r1);
44 
45  //@@@extend depthScale for HE
46  energyMeanHcal = (fTanh(einc, Gflash::pion_hadscale[0]) +
47  fTanh(einc, Gflash::pion_hadscale[1]) *
49  energySigmaHcal =
50  (fTanh(einc, Gflash::pion_hadscale[2]) +
51  fTanh(einc, Gflash::pion_hadscale[3]) *
53  r2 = CLHEP::RandGaussQ::shoot();
55  exp(energyMeanHcal + energySigmaHcal * (energyRho * r1 + sqrt(1.0 - energyRho * energyRho) * r2));
56  } while (energyScale[Gflash::kENCA] < 0 || energyScale[Gflash::kHE] > einc * 1.5);
57  }
58  } else if (showerType == 2 || showerType == 3 || showerType == 6 || showerType == 7) {
59  // Hcal response for mip-like pions (mip)
60 
61  energyMeanHcal = fTanh(einc, Gflash::pion_hadscale[4]);
62  energySigmaHcal = fTanh(einc, Gflash::pion_hadscale[5]);
63 
64  double gap_corr = einc * fTanh(einc, Gflash::pion_hadscale[6]);
65 
66  if (showerType == 2 || showerType == 3) {
68 
69  do {
70  r1 = CLHEP::RandGaussQ::shoot();
71  energyScale[Gflash::kHB] = exp(energyMeanHcal + energySigmaHcal * r1);
72  } while (energyScale[Gflash::kHB] > einc * 1.5);
73 
74  if (showerType == 2) {
76  0.0, energyScale[Gflash::kHB] - gap_corr * depthScale(position.getRho(), Gflash::Rmin[Gflash::kHB], 28.));
77  }
78  } else if (showerType == 6 || showerType == 7) {
80 
81  do {
82  r1 = CLHEP::RandGaussQ::shoot();
83  energyMeanHcal += std::log(1.0 - fTanh(einc, Gflash::pion_hadscale[7]));
84  energyScale[Gflash::kHE] = exp(energyMeanHcal + energySigmaHcal * r1);
85  } while (energyScale[Gflash::kHE] > einc * 1.5);
86 
87  if (showerType == 6) {
89  std::max(0.0,
91  gap_corr * depthScale(std::fabs(position.getZ()), Gflash::Zmin[Gflash::kHE], 66.));
92  }
93  }
94  }
95 
96  // parameters for the longitudinal profiles
97  //@@@check longitudinal profiles of endcaps for possible variations
98 
99  double *rhoHcal = new double[2 * Gflash::NPar];
100  double *correlationVectorHcal = new double[Gflash::NPar * (Gflash::NPar + 1) / 2];
101 
102  //@@@until we have a separate parameterization for Endcap
103 
104  if (showerType > 3) {
105  showerType -= 4;
106  }
107  // no separate parameterization before crystal
108  if (showerType == 0)
109  showerType = 1;
110 
111  // Hcal parameters are always needed regardless of showerType
112  for (int i = 0; i < 2 * Gflash::NPar; i++) {
113  rhoHcal[i] = fTanh(einc, Gflash::pion_rho[i + showerType * 2 * Gflash::NPar]);
114  }
115 
116  getFluctuationVector(rhoHcal, correlationVectorHcal);
117 
118  double normalZ[Gflash::NPar];
119  for (int i = 0; i < Gflash::NPar; i++)
120  normalZ[i] = CLHEP::RandGaussQ::shoot();
121 
122  for (int i = 0; i < Gflash::NPar; i++) {
123  double correlationSum = 0.0;
124 
125  for (int j = 0; j < i + 1; j++) {
126  correlationSum += correlationVectorHcal[i * (i + 1) / 2 + j] * normalZ[j];
127  }
128  longHcal[i] = fTanh(einc, Gflash::pion_par[i + showerType * Gflash::NPar]) +
129  fTanh(einc, Gflash::pion_par[i + (4 + showerType) * Gflash::NPar]) * correlationSum;
130  }
131  delete[] rhoHcal;
132  delete[] correlationVectorHcal;
133 
134  // lateral parameters for Hcal
135 
136  for (int i = 0; i < Gflash::Nrpar; i++) {
137  lateralPar[Gflash::kHB][i] = fTanh(einc, Gflash::pion_rpar[i + showerType * Gflash::Nrpar]);
139  }
140 
141  // Ecal parameters are needed if and only if the shower starts inside the
142  // crystal
143 
144  if (showerType == 1) {
145  double *rhoEcal = new double[2 * Gflash::NPar];
146  double *correlationVectorEcal = new double[Gflash::NPar * (Gflash::NPar + 1) / 2];
147  for (int i = 0; i < 2 * Gflash::NPar; i++)
148  rhoEcal[i] = fTanh(einc, Gflash::pion_rho[i]);
149 
150  getFluctuationVector(rhoEcal, correlationVectorEcal);
151 
152  for (int i = 0; i < Gflash::NPar; i++)
153  normalZ[i] = CLHEP::RandGaussQ::shoot();
154  for (int i = 0; i < Gflash::NPar; i++) {
155  double correlationSum = 0.0;
156 
157  for (int j = 0; j < i + 1; j++) {
158  correlationSum += correlationVectorEcal[i * (i + 1) / 2 + j] * normalZ[j];
159  }
160  longEcal[i] =
161  fTanh(einc, Gflash::pion_par[i]) + 0.5 * fTanh(einc, Gflash::pion_par[i + 4 * Gflash::NPar]) * correlationSum;
162  }
163 
164  delete[] rhoEcal;
165  delete[] correlationVectorEcal;
166 
167  // lateral parameters for Ecal
168 
169  for (int i = 0; i < Gflash::Nrpar; i++) {
172  }
173  }
174 }
mps_fire.i
i
Definition: mps_fire.py:428
Gflash::LengthCrystalEE
const double LengthCrystalEE
Definition: GflashNameSpace.h:41
Gflash::pion_rpar
const double pion_rpar[4 *Nrpar][5]
Definition: GflashNameSpace.h:208
Gflash::ZFrontCrystalEE
const double ZFrontCrystalEE
Definition: GflashNameSpace.h:37
GflashHadronShowerProfile::theShowino
GflashShowino * theShowino
Definition: GflashHadronShowerProfile.h:59
Gflash::pion_par
const double pion_par[8 *NPar][5]
Definition: GflashNameSpace.h:112
GflashHadronShowerProfile::fTanh
double fTanh(double einc, const double *par)
Definition: GflashHadronShowerProfile.cc:473
GflashHadronShowerProfile::depthScale
double depthScale(double ssp, double ssp0, double length)
Definition: GflashHadronShowerProfile.cc:487
Gflash::NPar
const int NPar
Definition: GflashNameSpace.h:87
Gflash::kHB
Definition: GflashNameSpace.h:13
Gflash::kHE
Definition: GflashNameSpace.h:15
Gflash::kENCA
Definition: GflashNameSpace.h:14
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Gflash::pion_hadscale
const double pion_hadscale[8][5]
Definition: GflashNameSpace.h:95
Gflash::pion_rho
const double pion_rho[8 *NPar][5]
Definition: GflashNameSpace.h:161
GflashHadronShowerProfile::energyScale
double energyScale[Gflash::kNumberCalorimeter]
Definition: GflashHadronShowerProfile.h:62
Gflash::Nrpar
const int Nrpar
Definition: GflashNameSpace.h:88
Gflash::pion_correl_hadem
const double pion_correl_hadem[5]
Definition: GflashNameSpace.h:108
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Gflash::LengthCrystalEB
const double LengthCrystalEB
Definition: GflashNameSpace.h:40
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
GflashHadronShowerProfile::lateralPar
double lateralPar[Gflash::kNumberCalorimeter][Gflash::Nrpar]
Definition: GflashHadronShowerProfile.h:66
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
GflashShowino::getShowerType
int getShowerType()
Definition: GflashShowino.h:26
Gflash::Zmin
const double Zmin[kNumberCalorimeter]
Definition: GflashNameSpace.h:28
Gflash3Vector
CLHEP::Hep3Vector Gflash3Vector
Definition: Gflash3Vector.h:6
GflashShowino::getEnergy
double getEnergy()
Definition: GflashShowino.h:27
Gflash::RFrontCrystalEB
const double RFrontCrystalEB
Definition: GflashNameSpace.h:36
Gflash::pion_emscale
const double pion_emscale[2][5]
Definition: GflashNameSpace.h:92
GflashHadronShowerProfile::getFluctuationVector
void getFluctuationVector(double *lowTriangle, double *correlationVector)
Definition: GflashHadronShowerProfile.cc:358
GflashHadronShowerProfile::longEcal
double longEcal[Gflash::NPar]
Definition: GflashHadronShowerProfile.h:64
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
GflashPiKShowerProfile.h
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
GflashShowino::getPositionAtShower
Gflash3Vector & getPositionAtShower()
Definition: GflashShowino.h:30
Gflash::Rmin
const double Rmin[kNumberCalorimeter]
Definition: GflashNameSpace.h:30
GflashHadronShowerProfile::longHcal
double longHcal[Gflash::NPar]
Definition: GflashHadronShowerProfile.h:65
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
Gflash::kESPM
Definition: GflashNameSpace.h:12
GflashPiKShowerProfile::loadParameters
void loadParameters() override
Definition: GflashPiKShowerProfile.cc:4