CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GflashKaonPlusShowerProfile.cc
Go to the documentation of this file.
2 #include <CLHEP/Random/RandGaussQ.h>
3 
5 {
6  double einc = theShowino->getEnergy();
8  int showerType = theShowino->getShowerType();
9 
10  // energy scale
11  double energyMeanHcal = 0.0;
12  double energySigmaHcal = 0.0;
13 
14  if(showerType == 0 || showerType == 1 || showerType == 4 || showerType == 5) {
15 
16  double r1 = 0.0;
17  double r2 = 0.0;
18 
19  //@@@ energy dependent energyRho based on tuning with testbeam data
20  double energyRho = fTanh(einc,Gflash::correl_hadem);
21 
22  r1 = CLHEP::RandGaussQ::shoot();
23 
24  if(showerType == 0 || showerType == 1) {
26  +(fTanh(einc,Gflash::emscale[2]) + fTanh(einc,Gflash::emscale[3])*depthScale(position.getRho(),151.,22.) )*r1);
27 
28  energyMeanHcal = (fTanh(einc,Gflash::hadscale[0]) +
30  energySigmaHcal = (fTanh(einc,Gflash::hadscale[2]) +
32 
33  r2 = CLHEP::RandGaussQ::shoot();
35  einc*fTanh(einc,Gflash::hadcorr_pid[4]) +
36  exp(energyMeanHcal+energySigmaHcal*(energyRho*r1 + sqrt(1.0- energyRho*energyRho)*r2 ))-0.05*einc);
37  }
38  else {
40  +(fTanh(einc,Gflash::emscale[2]) + fTanh(einc,Gflash::emscale[3])*depthScale(std::fabs(position.getZ()),338.0,21.) )*r1);
41 
42  //@@@extend depthScale for HE
43  energyMeanHcal = (fTanh(einc,Gflash::hadscale[0]) +
45  energySigmaHcal = (fTanh(einc,Gflash::hadscale[2]) +
47  r2 = CLHEP::RandGaussQ::shoot();
49  einc*fTanh(einc,Gflash::hadcorr_pid[5]) +
50  exp(energyMeanHcal+energySigmaHcal*(energyRho*r1 + sqrt(1.0- energyRho*energyRho)*r2 ))-0.05*einc);
51  }
52  }
53  else if(showerType == 2 || showerType == 6 || showerType == 3 || showerType == 7) {
54  //Hcal response for mip-like pions (mip)
55 
56  energyMeanHcal = fTanh(einc,Gflash::hadscale[4]);
57  energySigmaHcal = fTanh(einc,Gflash::hadscale[5]);
58  double gap_corr = einc * fTanh(einc,Gflash::hadscale[6]);
59 
60  if(showerType == 2 || showerType == 3) {
62  exp(energyMeanHcal+energySigmaHcal*CLHEP::RandGaussQ::shoot())-2.0);
63  if(showerType == 2) {
65  - gap_corr*depthScale(position.getRho(),Gflash::Rmin[Gflash::kHB],28.));
66  }
67  }
68  else if(showerType == 6 || showerType == 7 ) {
70  exp(energyMeanHcal+energySigmaHcal*CLHEP::RandGaussQ::shoot())-2.0);
71  if(showerType == 6) {
73  - gap_corr*depthScale(std::fabs(position.getZ()),Gflash::Zmin[Gflash::kHE],66.));
74  }
75  }
76  }
77 
78  // parameters for the longitudinal profiles
79  //@@@check longitudinal profiles of endcaps for possible variations
80  double *rhoHcal = new double [2*Gflash::NPar];
81  double *correlationVectorHcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
82 
83  //@@@until we have a separate parameterization for Endcap
84  bool isEndcap = false;
85  if(showerType>3) {
86  showerType -= 4;
87  isEndcap = true;
88  }
89  //no separate parameterization before crystal
90  if(showerType==0) showerType = 1;
91 
92  //Hcal parameters are always needed regardless of showerType
93  for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) {
94  rhoHcal[i] = fTanh(einc,Gflash::rho[i + showerType*2*Gflash::NPar]);
95  }
96 
97  getFluctuationVector(rhoHcal,correlationVectorHcal);
98 
99  double normalZ[Gflash::NPar];
100  for (int i = 0; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
101 
102  for(int i = 0 ; i < Gflash::NPar ; i++) {
103  double correlationSum = 0.0;
104  for(int j = 0 ; j < i+1 ; j++) {
105  correlationSum += correlationVectorHcal[i*(i+1)/2+j]*normalZ[j];
106  }
107  longHcal[i] = fTanh(einc,Gflash::par[i+showerType*Gflash::NPar]) +
108  fTanh(einc,Gflash::par[i+(4+showerType)*Gflash::NPar])*correlationSum;
109  }
110 
111  delete [] rhoHcal;
112  delete [] correlationVectorHcal;
113 
114  // lateral parameters for Hcal
115 
116  for (int i = 0 ; i < Gflash::Nrpar ; i++) {
117  lateralPar[Gflash::kHB][i] = fLnE1(einc,Gflash::rpar[i+showerType*Gflash::Nrpar]);
118 
119  //tuning for pure hadronic response: +10%
120  if(showerType==3 && i == 0) lateralPar[Gflash::kHB][i] *= 1.1;
122  }
123 
124  //Ecal parameters are needed if and only if the shower starts inside the crystal
125 
126  if(showerType == 1) {
127  //A depth dependent correction for the core term of R in Hcal is the linear in
128  //the shower start point while for the spread term is nearly constant
129 
130  if(!isEndcap) lateralPar[Gflash::kHB][0] -= 2.3562e-01*(position.getRho()-131.0);
131  else lateralPar[Gflash::kHE][0] -= 2.3562e-01*(std::abs(position.getZ())-332.0);
132 
133  double *rhoEcal = new double [2*Gflash::NPar];
134  double *correlationVectorEcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
135  for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) rhoEcal[i] = fTanh(einc,Gflash::rho[i]);
136 
137  getFluctuationVector(rhoEcal,correlationVectorEcal);
138 
139  for (int i = 0; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
140  for(int i = 0 ; i < Gflash::NPar ; i++) {
141  double correlationSum = 0.0;
142  for(int j = 0 ; j < i+1 ; j++) {
143  correlationSum += correlationVectorEcal[i*(i+1)/2+j]*normalZ[j];
144  }
145  longEcal[i] = fTanh(einc,Gflash::par[i]) +
146  fTanh(einc,Gflash::par[i+4*Gflash::NPar])*correlationSum;
147  }
148 
149  delete [] rhoEcal;
150  delete [] correlationVectorEcal;
151 
152  // lateral parameters for Ecal
153 
154  for (int i = 0 ; i < Gflash::Nrpar ; i++) {
157  }
158  }
159 
160 }
const double ZFrontCrystalEE
double fTanh(double einc, const double *par)
int i
Definition: DBlmapReader.cc:9
double lateralPar[Gflash::kNumberCalorimeter][Gflash::Nrpar]
const double correl_hadem[4]
double getEnergy()
Definition: GflashShowino.h:24
int getShowerType()
Definition: GflashShowino.h:23
#define abs(x)
Definition: mlp_lapack.h:159
const double emcorr_pid[10][4]
const int Nrpar
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
const double emscale[4][4]
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
const double hadcorr_pid[10][4]
const double rpar[4 *Nrpar][2]
const double mipcorr_pid[10][4]
const T & max(const T &a, const T &b)
double fLnE1(double einc, const double *par)
T sqrt(T t)
Definition: SSEVec.h:28
const double hadscale[7][4]
const double LengthCrystalEE
int j
Definition: DBlmapReader.cc:9
const double LengthCrystalEB
Gflash3Vector & getPositionAtShower()
Definition: GflashShowino.h:27
const int NPar
const double RFrontCrystalEB
const double Zmin[kNumberCalorimeter]
const double rho[8 *NPar][4]
CLHEP::Hep3Vector Gflash3Vector
Definition: Gflash3Vector.h:6
void getFluctuationVector(double *lowTriangle, double *correlationVector)
double depthScale(double ssp, double ssp0, double length)
const double Rmin[kNumberCalorimeter]
const double par[8 *NPar][4]
double energyScale[Gflash::kNumberCalorimeter]