Go to the documentation of this file.00001 #include "SimGeneral/GFlash/interface/GflashProtonShowerProfile.h"
00002 #include <CLHEP/Random/RandGaussQ.h>
00003
00004 void GflashProtonShowerProfile::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::pro_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::pro_emscale[0]) + fTanh(einc,Gflash::pro_emscale[1])*r1);
00027
00028
00029 energyMeanHcal = (fTanh(einc,Gflash::pro_hadscale[0]) +
00030 fTanh(einc,Gflash::pro_hadscale[1])*depthScale(position.getRho(),Gflash::RFrontCrystalEB,Gflash::LengthCrystalEB));
00031 energySigmaHcal = (fTanh(einc,Gflash::pro_hadscale[2]) +
00032 fTanh(einc,Gflash::pro_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::pro_emscale[0]) + fTanh(einc,Gflash::pro_emscale[1])*r1);
00042
00043
00044 energyMeanHcal = (fTanh(einc,Gflash::pro_hadscale[0]) +
00045 fTanh(einc,Gflash::pro_hadscale[1])*depthScale(std::fabs(position.getZ()),Gflash::ZFrontCrystalEE,Gflash::LengthCrystalEE));
00046 energySigmaHcal = (fTanh(einc,Gflash::pro_hadscale[2]) +
00047 fTanh(einc,Gflash::pro_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::pro_hadscale[4]);
00057 energySigmaHcal = fTanh(einc,Gflash::pro_hadscale[5]);
00058
00059 double gap_corr = einc*fTanh(einc,Gflash::pro_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::pro_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 bool isEndcap = false;
00099 if(showerType>3) {
00100 showerType -= 4;
00101 isEndcap = true;
00102 }
00103
00104 if(showerType==0) showerType = 1;
00105
00106
00107 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) {
00108 rhoHcal[i] = fTanh(einc,Gflash::pro_rho[i + showerType*2*Gflash::NPar]);
00109 }
00110
00111 getFluctuationVector(rhoHcal,correlationVectorHcal);
00112
00113 double normalZ[Gflash::NPar];
00114 for (int i = 0; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00115
00116 for(int i = 0 ; i < Gflash::NPar ; i++) {
00117 double correlationSum = 0.0;
00118
00119 for(int j = 0 ; j < i+1 ; j++) {
00120 correlationSum += correlationVectorHcal[i*(i+1)/2+j]*normalZ[j];
00121 }
00122 longHcal[i] = fTanh(einc,Gflash::pro_par[i+showerType*Gflash::NPar]) +
00123 fTanh(einc,Gflash::pro_par[i+(4+showerType)*Gflash::NPar])*correlationSum;
00124 }
00125 delete [] rhoHcal;
00126 delete [] correlationVectorHcal;
00127
00128
00129
00130 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00131 lateralPar[Gflash::kHB][i] = fTanh(einc,Gflash::pro_rpar[i+showerType*Gflash::Nrpar]);
00132 lateralPar[Gflash::kHE][i] = lateralPar[Gflash::kHB][i];
00133 }
00134
00135
00136
00137 if(showerType == 1) {
00138
00139 double *rhoEcal = new double [2*Gflash::NPar];
00140 double *correlationVectorEcal = new double [Gflash::NPar*(Gflash::NPar+1)/2];
00141 for(int i = 0 ; i < 2*Gflash::NPar ; i++ ) rhoEcal[i] = fTanh(einc,Gflash::pro_rho[i]);
00142
00143 getFluctuationVector(rhoEcal,correlationVectorEcal);
00144
00145 for(int i = 0 ; i < Gflash::NPar ; i++) normalZ[i] = CLHEP::RandGaussQ::shoot();
00146 for(int i = 0 ; i < Gflash::NPar ; i++) {
00147 double correlationSum = 0.0;
00148
00149 for(int j = 0 ; j < i+1 ; j++) {
00150 correlationSum += correlationVectorEcal[i*(i+1)/2+j]*normalZ[j];
00151 }
00152 longEcal[i] = fTanh(einc,Gflash::pro_par[i]) +
00153 0.5*fTanh(einc,Gflash::pro_par[i+4*Gflash::NPar])*correlationSum;
00154 }
00155
00156 delete [] rhoEcal;
00157 delete [] correlationVectorEcal;
00158
00159
00160
00161 for (int i = 0 ; i < Gflash::Nrpar ; i++) {
00162 lateralPar[Gflash::kESPM][i] = fTanh(einc,Gflash::pro_rpar[i]);
00163 lateralPar[Gflash::kENCA][i] = lateralPar[Gflash::kESPM][i];
00164 }
00165 }
00166
00167 }