Go to the documentation of this file.00001 #include "SimGeneral/GFlash/interface/GflashKaonMinusShowerProfile.h"
00002 #include <CLHEP/Random/RandGaussQ.h>
00003
00004 void GflashKaonMinusShowerProfile::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::kminus_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::kminus_emscale[0]) + fTanh(einc,Gflash::kminus_emscale[1])*r1);
00027
00028
00029 energyMeanHcal = (fTanh(einc,Gflash::kminus_hadscale[0]) +
00030 fTanh(einc,Gflash::kminus_hadscale[1])*depthScale(position.getRho(),Gflash::RFrontCrystalEB,Gflash::LengthCrystalEB));
00031 energySigmaHcal = (fTanh(einc,Gflash::kminus_hadscale[2]) +
00032 fTanh(einc,Gflash::kminus_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::kminus_emscale[0]) + fTanh(einc,Gflash::kminus_emscale[1])*r1);
00042
00043
00044 energyMeanHcal = (fTanh(einc,Gflash::kminus_hadscale[0]) +
00045 fTanh(einc,Gflash::kminus_hadscale[1])*depthScale(std::fabs(position.getZ()),Gflash::ZFrontCrystalEE,Gflash::LengthCrystalEE));
00046 energySigmaHcal = (fTanh(einc,Gflash::kminus_hadscale[2]) +
00047 fTanh(einc,Gflash::kminus_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::kminus_hadscale[4]);
00057 energySigmaHcal = fTanh(einc,Gflash::kminus_hadscale[5]);
00058
00059 double gap_corr = einc*fTanh(einc,Gflash::kminus_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::kminus_hadscale[7]));
00080 energyScale[Gflash::kHE] = exp(energyMeanHcal+energySigmaHcal*r1);
00081 } while ( energyScale[Gflash::kHE] > einc*1.5 );
00082
00083
00084 if(showerType == 6) {
00085 energyScale[Gflash::kHE] = std::max(0.0,energyScale[Gflash::kHE]
00086 - gap_corr*depthScale(std::fabs(position.getZ()),Gflash::Zmin[Gflash::kHE],66.));
00087 }
00088 }
00089 }
00090
00091
00092
00093
00094 double *rhoHcal = new double [2*Gflash::NPar];
00095 double *correlationVectorHcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
00096
00097
00098
00099 if(showerType>3) {
00100 showerType -= 4;
00101 }
00102
00103 if(showerType==0) showerType = 1;
00104
00105
00106 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) {
00107 rhoHcal[i] = fTanh(einc,Gflash::kminus_rho[i + showerType*2*Gflash::NPar]);
00108 }
00109
00110 getFluctuationVector(rhoHcal,correlationVectorHcal);
00111
00112 double normalZ[Gflash::NPar];
00113 for (int i = 0; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00114
00115 for(int i = 0 ; i < Gflash::NPar ; i++) {
00116 double correlationSum = 0.0;
00117
00118 for(int j = 0 ; j < i+1 ; j++) {
00119 correlationSum += correlationVectorHcal[i*(i+1)/2+j]*normalZ[j];
00120 }
00121 longHcal[i] = fTanh(einc,Gflash::kminus_par[i+showerType*Gflash::NPar]) +
00122 fTanh(einc,Gflash::kminus_par[i+(4+showerType)*Gflash::NPar])*correlationSum;
00123 }
00124 delete [] rhoHcal;
00125 delete [] correlationVectorHcal;
00126
00127
00128
00129 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00130 lateralPar[Gflash::kHB][i] = fTanh(einc,Gflash::kminus_rpar[i+showerType*Gflash::Nrpar]);
00131 lateralPar[Gflash::kHE][i] = lateralPar[Gflash::kHB][i];
00132 }
00133
00134
00135
00136 if(showerType == 1) {
00137
00138 double *rhoEcal = new double [2*Gflash::NPar];
00139 double *correlationVectorEcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
00140 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) rhoEcal[i] = fTanh(einc,Gflash::kminus_rho[i]);
00141
00142 getFluctuationVector(rhoEcal,correlationVectorEcal);
00143
00144 for(int i = 0 ; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00145 for(int i = 0 ; i < Gflash::NPar ; i++) {
00146 double correlationSum = 0.0;
00147
00148 for(int j = 0 ; j < i+1 ; j++) {
00149 correlationSum += correlationVectorEcal[i*(i+1)/2+j]*normalZ[j];
00150 }
00151 longEcal[i] = fTanh(einc,Gflash::kminus_par[i]) +
00152 0.5*fTanh(einc,Gflash::kminus_par[i+4*Gflash::NPar])*correlationSum;
00153 }
00154
00155 delete [] rhoEcal;
00156 delete [] correlationVectorEcal;
00157
00158
00159
00160 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00161 lateralPar[Gflash::kESPM][i] = fTanh(einc,Gflash::kminus_rpar[i]);
00162 lateralPar[Gflash::kENCA][i] = lateralPar[Gflash::kESPM][i];
00163 }
00164 }
00165
00166 }