Go to the documentation of this file.00001 #include "SimGeneral/GFlash/interface/GflashKaonPlusShowerProfile.h"
00002 #include <CLHEP/Random/RandGaussQ.h>
00003
00004 void GflashKaonPlusShowerProfile::loadParameters()
00005 {
00006 double einc = theShowino->getEnergy();
00007 Gflash3Vector position = theShowino->getPositionAtShower();
00008 int showerType = theShowino->getShowerType();
00009
00010
00011 double energyMeanHcal = 0.0;
00012 double energySigmaHcal = 0.0;
00013
00014 double r1 = 0.0;
00015 double r2 = 0.0;
00016
00017 if(showerType == 0 || showerType == 1 || showerType == 4 || showerType == 5) {
00018
00019
00020 double energyRho = fTanh(einc,Gflash::kplus_correl_hadem);
00021
00022 if(showerType == 0 || showerType == 1) {
00023 do {
00024 r1 = CLHEP::RandGaussQ::shoot();
00025
00026 energyScale[Gflash::kESPM] = einc*(fTanh(einc,Gflash::kplus_emscale[0]) + fTanh(einc,Gflash::kplus_emscale[1])*r1);
00027
00028
00029 energyMeanHcal = (fTanh(einc,Gflash::kplus_hadscale[0]) +
00030 fTanh(einc,Gflash::kplus_hadscale[1])*depthScale(position.getRho(),Gflash::RFrontCrystalEB,Gflash::LengthCrystalEB));
00031 energySigmaHcal = (fTanh(einc,Gflash::kplus_hadscale[2]) +
00032 fTanh(einc,Gflash::kplus_hadscale[3])*depthScale(position.getRho(),Gflash::RFrontCrystalEB,Gflash::LengthCrystalEB));
00033
00034 r2 = CLHEP::RandGaussQ::shoot();
00035 energyScale[Gflash::kHB] = exp(energyMeanHcal+energySigmaHcal*(energyRho*r1 + sqrt(1.0- energyRho*energyRho)*r2 ));
00036 } while ( energyScale[Gflash::kESPM] < 0 || energyScale[Gflash::kHB] > einc*1.5 );
00037 }
00038 else {
00039 do {
00040 r1 = CLHEP::RandGaussQ::shoot();
00041 energyScale[Gflash::kENCA] = einc*(fTanh(einc,Gflash::kplus_emscale[0]) + fTanh(einc,Gflash::kplus_emscale[1])*r1);
00042
00043
00044 energyMeanHcal = (fTanh(einc,Gflash::kplus_hadscale[0]) +
00045 fTanh(einc,Gflash::kplus_hadscale[1])*depthScale(std::fabs(position.getZ()),Gflash::ZFrontCrystalEE,Gflash::LengthCrystalEE));
00046 energySigmaHcal = (fTanh(einc,Gflash::kplus_hadscale[2]) +
00047 fTanh(einc,Gflash::kplus_hadscale[3])*depthScale(std::fabs(position.getZ()),Gflash::ZFrontCrystalEE,Gflash::LengthCrystalEE));
00048 r2 = CLHEP::RandGaussQ::shoot();
00049 energyScale[Gflash::kHE] = exp(energyMeanHcal+energySigmaHcal*(energyRho*r1 + sqrt(1.0- energyRho*energyRho)*r2 ));
00050 } while ( energyScale[Gflash::kENCA] < 0 || energyScale[Gflash::kHE] > einc*1.5 );
00051 }
00052 }
00053 else if(showerType == 2 || showerType == 3 || showerType == 6 || showerType == 7) {
00054
00055
00056 energyMeanHcal = fTanh(einc,Gflash::kplus_hadscale[4]);
00057 energySigmaHcal = fTanh(einc,Gflash::kplus_hadscale[5]);
00058
00059 double gap_corr = einc*fTanh(einc,Gflash::kplus_hadscale[6]);
00060
00061 if(showerType == 2 || showerType == 3) {
00062 energyScale[Gflash::kESPM] = 0.0;
00063
00064 do {
00065 r1 = CLHEP::RandGaussQ::shoot();
00066 energyScale[Gflash::kHB] = exp(energyMeanHcal+energySigmaHcal*r1);
00067 } while ( energyScale[Gflash::kHB] > einc*1.5 );
00068
00069 if(showerType == 2) {
00070 energyScale[Gflash::kHE] = std::max(0.0,energyScale[Gflash::kHB]
00071 - gap_corr*depthScale(position.getRho(),Gflash::Rmin[Gflash::kHB],28.));
00072 }
00073 }
00074 else if(showerType == 6 || showerType == 7 ) {
00075 energyScale[Gflash::kENCA] = 0.0;
00076
00077 do {
00078 r1 = CLHEP::RandGaussQ::shoot();
00079 energyMeanHcal += std::log(1.0-fTanh(einc,Gflash::kplus_hadscale[7]));
00080 energyScale[Gflash::kHE] = exp(energyMeanHcal+energySigmaHcal*r1);
00081 } while ( energyScale[Gflash::kHE] > einc*1.5 );
00082
00083 if(showerType == 6) {
00084 energyScale[Gflash::kHE] = std::max(0.0,energyScale[Gflash::kHE]
00085 - gap_corr*depthScale(std::fabs(position.getZ()),Gflash::Zmin[Gflash::kHE],66.));
00086 }
00087 }
00088 }
00089
00090
00091
00092
00093 double *rhoHcal = new double [2*Gflash::NPar];
00094 double *correlationVectorHcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
00095
00096
00097
00098 if(showerType>3) {
00099 showerType -= 4;
00100 }
00101
00102 if(showerType==0) showerType = 1;
00103
00104
00105 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) {
00106 rhoHcal[i] = fTanh(einc,Gflash::kplus_rho[i + showerType*2*Gflash::NPar]);
00107 }
00108
00109 getFluctuationVector(rhoHcal,correlationVectorHcal);
00110
00111 double normalZ[Gflash::NPar];
00112 for (int i = 0; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00113
00114 for(int i = 0 ; i < Gflash::NPar ; i++) {
00115 double correlationSum = 0.0;
00116
00117 for(int j = 0 ; j < i+1 ; j++) {
00118 correlationSum += correlationVectorHcal[i*(i+1)/2+j]*normalZ[j];
00119 }
00120 longHcal[i] = fTanh(einc,Gflash::kplus_par[i+showerType*Gflash::NPar]) +
00121 fTanh(einc,Gflash::kplus_par[i+(4+showerType)*Gflash::NPar])*correlationSum;
00122 }
00123 delete [] rhoHcal;
00124 delete [] correlationVectorHcal;
00125
00126
00127
00128 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00129 lateralPar[Gflash::kHB][i] = fTanh(einc,Gflash::kplus_rpar[i+showerType*Gflash::Nrpar]);
00130 lateralPar[Gflash::kHE][i] = lateralPar[Gflash::kHB][i];
00131 }
00132
00133
00134
00135 if(showerType == 1) {
00136
00137 double *rhoEcal = new double [2*Gflash::NPar];
00138 double *correlationVectorEcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
00139 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) rhoEcal[i] = fTanh(einc,Gflash::kplus_rho[i]);
00140
00141 getFluctuationVector(rhoEcal,correlationVectorEcal);
00142
00143 for(int i = 0 ; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00144 for(int i = 0 ; i < Gflash::NPar ; i++) {
00145 double correlationSum = 0.0;
00146
00147 for(int j = 0 ; j < i+1 ; j++) {
00148 correlationSum += correlationVectorEcal[i*(i+1)/2+j]*normalZ[j];
00149 }
00150 longEcal[i] = fTanh(einc,Gflash::kplus_par[i]) +
00151 0.5*fTanh(einc,Gflash::kplus_par[i+4*Gflash::NPar])*correlationSum;
00152 }
00153
00154 delete [] rhoEcal;
00155 delete [] correlationVectorEcal;
00156
00157
00158
00159 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00160 lateralPar[Gflash::kESPM][i] = fTanh(einc,Gflash::kplus_rpar[i]);
00161 lateralPar[Gflash::kENCA][i] = lateralPar[Gflash::kESPM][i];
00162 }
00163 }
00164
00165 }