Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // 27 // 28 // ------------------------------------------- 28 // ------------------------------------------------------------ 29 // GEANT 4 class implementation 29 // GEANT 4 class implementation 30 // 30 // 31 // ------- GFlashHomoShowerParameterisati 31 // ------- GFlashHomoShowerParameterisation ------- 32 // 32 // 33 // Authors: E.Barberio & Joanna Weng - 9.11.20 33 // Authors: E.Barberio & Joanna Weng - 9.11.2004 34 // ------------------------------------------- 34 // ------------------------------------------------------------ 35 35 36 #include <cmath> 36 #include <cmath> 37 37 38 #include "GFlashHomoShowerParameterisation.hh" 38 #include "GFlashHomoShowerParameterisation.hh" 39 #include "GVFlashShowerParameterisation.hh" 39 #include "GVFlashShowerParameterisation.hh" 40 #include "G4PhysicalConstants.hh" 40 #include "G4PhysicalConstants.hh" 41 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" 42 #include "Randomize.hh" 42 #include "Randomize.hh" 43 #include "G4ios.hh" 43 #include "G4ios.hh" 44 #include "G4Material.hh" 44 #include "G4Material.hh" 45 #include "G4MaterialTable.hh" 45 #include "G4MaterialTable.hh" 46 46 47 GFlashHomoShowerParameterisation::GFlashHomoSh << 47 GFlashHomoShowerParameterisation:: 48 << 48 GFlashHomoShowerParameterisation(G4Material * aMat, >> 49 GVFlashHomoShowerTuning * aPar) 49 : GVFlashShowerParameterisation(), 50 : GVFlashShowerParameterisation(), 50 ConstantResolution(0.), << 51 ConstantResolution(0.), NoiseResolution(0.), SamplingResolution(0.), 51 NoiseResolution(0.), << 52 AveLogAlphah(0.), AveLogTmaxh(0.), SigmaLogAlphah(0.), SigmaLogTmaxh(0.), 52 SamplingResolution(0.), << 53 Rhoh(0.), Alphah(0.), Tmaxh(0.), Betah(0.) 53 AveLogAlphah(0.), << 54 54 AveLogTmaxh(0.), << 55 { 55 SigmaLogAlphah(0.), << 56 if(!aPar) { thePar = new GVFlashHomoShowerTuning; owning = true; } 56 SigmaLogTmaxh(0.), << 57 else { thePar = aPar; owning = false; } 57 Rhoh(0.), << 58 Alphah(0.), << 59 Tmaxh(0.), << 60 Betah(0.) << 61 << 62 { << 63 if (!aPar) { << 64 thePar = new GVFlashHomoShowerTuning; << 65 } << 66 else { << 67 thePar = aPar; << 68 } << 69 58 70 SetMaterial(aMat); 59 SetMaterial(aMat); 71 PrintMaterial(aMat); 60 PrintMaterial(aMat); 72 61 73 /******************************************* 62 /********************************************/ 74 /* Homo Calorimeter 63 /* Homo Calorimeter */ 75 /******************************************* << 64 /********************************************/ 76 // Longitudinal Coefficients for a homogenio 65 // Longitudinal Coefficients for a homogenious calo 77 // shower max 66 // shower max 78 // 67 // 79 ParAveT1 = thePar->ParAveT1(); // ln (ln y << 68 ParAveT1 = thePar->ParAveT1(); // ln (ln y -0.812) 80 ParAveA1 = thePar->ParAveA1(); // ln a (0.8 << 69 ParAveA1 = thePar->ParAveA1(); // ln a (0.81 + (0.458 + 2.26/Z)ln y) 81 ParAveA2 = thePar->ParAveA2(); << 70 ParAveA2 = thePar->ParAveA2(); 82 ParAveA3 = thePar->ParAveA3(); << 71 ParAveA3 = thePar->ParAveA3(); 83 72 84 // Variance of shower max 73 // Variance of shower max 85 ParSigLogT1 = thePar->ParSigLogT1(); // Sig << 74 ParSigLogT1 = thePar->ParSigLogT1(); // Sigma T1 (-1.4 + 1.26 ln y)**-1 86 ParSigLogT2 = thePar->ParSigLogT2(); 75 ParSigLogT2 = thePar->ParSigLogT2(); 87 76 88 // variance of 'alpha' 77 // variance of 'alpha' 89 // 78 // 90 ParSigLogA1 = thePar->ParSigLogA1(); // Sig << 79 ParSigLogA1 = thePar->ParSigLogA1(); // Sigma a (-0.58 + 0.86 ln y)**-1 91 ParSigLogA2 = thePar->ParSigLogA2(); 80 ParSigLogA2 = thePar->ParSigLogA2(); 92 81 93 // correlation alpha%T 82 // correlation alpha%T 94 // 83 // 95 ParRho1 = thePar->ParRho1(); // Rho = 0.705 << 84 ParRho1 = thePar->ParRho1(); // Rho = 0.705 -0.023 ln y 96 ParRho2 = thePar->ParRho2(); << 85 ParRho2 = thePar->ParRho2(); 97 86 98 // Radial Coefficients 87 // Radial Coefficients 99 // r_C (tau)= z_1 +z_2 tau 88 // r_C (tau)= z_1 +z_2 tau 100 // r_t (tau)= k1 (std::exp (k3(tau -k2 ))+st 89 // r_t (tau)= k1 (std::exp (k3(tau -k2 ))+std::exp (k_4 (tau- k_2)))) 101 // 90 // 102 ParRC1 = thePar->ParRC1(); // z_1 = 0.0251 << 91 ParRC1 = thePar->ParRC1(); // z_1 = 0.0251 + 0.00319 ln E 103 ParRC2 = thePar->ParRC2(); << 92 ParRC2 = thePar->ParRC2(); 104 93 105 ParRC3 = thePar->ParRC3(); // z_2 = 0.1162 << 94 ParRC3 = thePar->ParRC3(); // z_2 = 0.1162 + - 0.000381 Z 106 ParRC4 = thePar->ParRC4(); << 95 ParRC4 = thePar->ParRC4(); 107 96 108 ParWC1 = thePar->ParWC1(); 97 ParWC1 = thePar->ParWC1(); 109 ParWC2 = thePar->ParWC2(); 98 ParWC2 = thePar->ParWC2(); 110 ParWC3 = thePar->ParWC3(); 99 ParWC3 = thePar->ParWC3(); 111 ParWC4 = thePar->ParWC4(); 100 ParWC4 = thePar->ParWC4(); 112 ParWC5 = thePar->ParWC5(); << 101 ParWC5 = thePar->ParWC5(); 113 ParWC6 = thePar->ParWC6(); 102 ParWC6 = thePar->ParWC6(); 114 103 115 ParRT1 = thePar->ParRT1(); 104 ParRT1 = thePar->ParRT1(); 116 ParRT2 = thePar->ParRT2(); 105 ParRT2 = thePar->ParRT2(); 117 ParRT3 = thePar->ParRT3(); 106 ParRT3 = thePar->ParRT3(); 118 ParRT4 = thePar->ParRT4(); << 107 ParRT4 = thePar->ParRT4(); 119 ParRT5 = thePar->ParRT5(); 108 ParRT5 = thePar->ParRT5(); 120 ParRT6 = thePar->ParRT6(); 109 ParRT6 = thePar->ParRT6(); 121 110 122 // Coeff for fluctueted radial profiles for 111 // Coeff for fluctueted radial profiles for a uniform media 123 // 112 // 124 ParSpotT1 = thePar->ParSpotT1(); // T_spot << 113 ParSpotT1 = thePar->ParSpotT1(); // T_spot = T_hom =(0.698 + 0.00212) 125 ParSpotT2 = thePar->ParSpotT2(); << 114 ParSpotT2 = thePar->ParSpotT2(); 126 115 127 ParSpotA1 = thePar->ParSpotA1(); // a_spot= << 116 ParSpotA1 = thePar->ParSpotA1(); // a_spot= a_hom (0.639 + 0.00334) 128 ParSpotA2 = thePar->ParSpotA2(); << 117 ParSpotA2 = thePar->ParSpotA2(); 129 118 130 ParSpotN1 = thePar->ParSpotN1(); // N_Spot << 119 ParSpotN1 = thePar->ParSpotN1(); // N_Spot 93 * ln(Z) E ** 0.876 131 ParSpotN2 = thePar->ParSpotN2(); << 120 ParSpotN2 = thePar->ParSpotN2(); 132 121 133 // Inits 122 // Inits 134 123 135 NSpot = 0.00; << 124 NSpot = 0.00; 136 AlphaNSpot = 0.00; << 125 AlphaNSpot = 0.00; 137 TNSpot = 0.00; << 126 TNSpot = 0.00; 138 BetaNSpot = 0.00; << 127 BetaNSpot = 0.00; 139 << 128 140 RadiusCore = 0.00; << 129 RadiusCore = 0.00; 141 WeightCore = 0.00; << 130 WeightCore = 0.00; 142 RadiusTail = 0.00; << 131 RadiusTail = 0.00; 143 132 144 G4cout << "/******************************** 133 G4cout << "/********************************************/ " << G4endl; 145 G4cout << " - GFlashHomoShowerParameterisat << 134 G4cout << " - GFlashHomoShowerParameterisation::Constructor - " << G4endl; 146 G4cout << "/******************************** 135 G4cout << "/********************************************/ " << G4endl; 147 } 136 } 148 137 149 void GFlashHomoShowerParameterisation::SetMate << 138 void GFlashHomoShowerParameterisation::SetMaterial(G4Material *mat) 150 { 139 { 151 material = mat; << 140 material= mat; 152 Z = GetEffZ(material); 141 Z = GetEffZ(material); 153 A = GetEffA(material); 142 A = GetEffA(material); 154 density = material->GetDensity() / (g / cm3) << 143 density = material->GetDensity()/(g/cm3); 155 X0 = material->GetRadlen(); << 144 X0 = material->GetRadlen(); 156 // O. I. Dovzhenkko and A. A. Pommanskii << 145 Ec = 2.66 * std::pow((X0 * Z / A),1.1); 157 Ec = 2.66 * std::pow((X0 * Z / A), 1.1); << 146 G4double Es = 21*MeV; 158 // // Rossi appriximation << 147 Rm = X0*Es/Ec; 159 // Ec = 610.0 * MeV / (Z + 1.24); << 148 // PrintMaterial(); 160 const G4double Es = 21.2 * MeV; << 161 Rm = X0 * Es / Ec; << 162 // PrintMaterial(); << 163 } 149 } 164 150 165 GFlashHomoShowerParameterisation::~GFlashHomoS 151 GFlashHomoShowerParameterisation::~GFlashHomoShowerParameterisation() 166 { 152 { 167 delete thePar; << 153 if(owning) { delete thePar; } 168 } 154 } 169 155 170 void GFlashHomoShowerParameterisation::Generat << 156 void GFlashHomoShowerParameterisation:: >> 157 GenerateLongitudinalProfile(G4double Energy) 171 { 158 { 172 if (material == 0) { << 159 if (material==0) 173 G4Exception("GFlashHomoShowerParameterisat << 160 { 174 FatalException, "No material i << 161 G4Exception("GFlashHomoShowerParameterisation::GenerateLongitudinalProfile()", >> 162 "InvalidSetup", FatalException, "No material initialized!"); 175 } 163 } 176 << 164 177 G4double y = Energy / Ec; << 165 G4double y = Energy/Ec; 178 ComputeLongitudinalParameters(y); << 166 ComputeLongitudinalParameters(y); 179 GenerateEnergyProfile(y); 167 GenerateEnergyProfile(y); 180 GenerateNSpotProfile(y); 168 GenerateNSpotProfile(y); 181 } 169 } 182 170 183 void GFlashHomoShowerParameterisation::Compute << 171 void >> 172 GFlashHomoShowerParameterisation::ComputeLongitudinalParameters(G4double y) 184 { 173 { 185 AveLogTmaxh = std::log(ParAveT1 + std::log(y << 174 AveLogTmaxh = std::log(ParAveT1 + std::log(y)); 186 // ok <ln T hom> << 175 //ok <ln T hom> 187 AveLogAlphah = std::log(ParAveA1 + (ParAveA2 << 176 AveLogAlphah = std::log(ParAveA1 + (ParAveA2+ParAveA3/Z)*std::log(y)); 188 // ok <ln alpha hom> << 177 //ok <ln alpha hom> 189 << 178 190 SigmaLogTmaxh = 1.00 / (ParSigLogT1 + ParSig << 179 SigmaLogTmaxh = 1.00/( ParSigLogT1 + ParSigLogT2*std::log(y)) ; 191 // ok sigma (ln T hom) << 180 //ok sigma (ln T hom) 192 SigmaLogAlphah = 1.00 / (ParSigLogA1 + ParSi << 181 SigmaLogAlphah = 1.00/( ParSigLogA1 + ParSigLogA2*std::log(y)); 193 // ok sigma (ln alpha hom) << 182 //ok sigma (ln alpha hom) 194 Rhoh = ParRho1 + ParRho2 * std::log(y); // << 183 Rhoh = ParRho1+ParRho2*std::log(y); //ok 195 } 184 } 196 185 197 void GFlashHomoShowerParameterisation::Generat 186 void GFlashHomoShowerParameterisation::GenerateEnergyProfile(G4double /* y */) 198 { << 187 { 199 G4double Correlation1h = std::sqrt((1 + Rhoh << 188 G4double Correlation1h = std::sqrt((1+Rhoh)/2); 200 G4double Correlation2h = std::sqrt((1 - Rhoh << 189 G4double Correlation2h = std::sqrt((1-Rhoh)/2); 201 190 202 G4double Random1 = G4RandGauss::shoot(); 191 G4double Random1 = G4RandGauss::shoot(); 203 G4double Random2 = G4RandGauss::shoot(); 192 G4double Random2 = G4RandGauss::shoot(); 204 193 205 // Parameters for Enenrgy Profile including << 194 // Parameters for Enenrgy Profile including correaltion and sigmas 206 << 195 207 Tmaxh = << 196 Tmaxh = std::exp( AveLogTmaxh + SigmaLogTmaxh * 208 std::exp(AveLogTmaxh + SigmaLogTmaxh * (Co << 197 (Correlation1h*Random1 + Correlation2h*Random2) ); 209 Alphah = << 198 Alphah = std::exp( AveLogAlphah + SigmaLogAlphah * 210 std::exp(AveLogAlphah + SigmaLogAlphah * ( << 199 (Correlation1h*Random1 - Correlation2h*Random2) ); 211 Betah = (Alphah - 1.00) / Tmaxh; << 200 Betah = (Alphah-1.00)/Tmaxh; 212 } 201 } 213 202 214 void GFlashHomoShowerParameterisation::Generat 203 void GFlashHomoShowerParameterisation::GenerateNSpotProfile(const G4double y) 215 { 204 { 216 TNSpot = Tmaxh * (ParSpotT1 + ParSpotT2 * Z) << 205 TNSpot = Tmaxh * (ParSpotT1+ParSpotT2*Z); // ok 217 AlphaNSpot = Alphah * (ParSpotA1 + ParSpotA2 << 206 AlphaNSpot = Alphah * (ParSpotA1+ParSpotA2*Z); 218 BetaNSpot = (AlphaNSpot - 1.00) / TNSpot; / << 207 BetaNSpot = (AlphaNSpot-1.00)/TNSpot; // ok 219 NSpot = ParSpotN1 * std::log(Z) * std::pow(( << 208 NSpot = ParSpotN1 * std::log(Z)*std::pow((y*Ec)/GeV,ParSpotN2 ); // ok 220 } 209 } 221 210 222 G4double GFlashHomoShowerParameterisation:: 211 G4double GFlashHomoShowerParameterisation:: 223 IntegrateEneLongitudinal(G4double Longitudinal 212 IntegrateEneLongitudinal(G4double LongitudinalStep) 224 { 213 { 225 G4double LongitudinalStepInX0 = Longitudinal 214 G4double LongitudinalStepInX0 = LongitudinalStep / X0; 226 G4float x1= Betah*LongitudinalStepInX0; 215 G4float x1= Betah*LongitudinalStepInX0; 227 G4float x2= Alphah; 216 G4float x2= Alphah; 228 float x3 = gam(x1,x2); 217 float x3 = gam(x1,x2); 229 G4double DEne=x3; 218 G4double DEne=x3; 230 return DEne; 219 return DEne; 231 } 220 } 232 221 233 G4double GFlashHomoShowerParameterisation::Int << 222 G4double GFlashHomoShowerParameterisation:: >> 223 IntegrateNspLongitudinal(G4double LongitudinalStep) 234 { 224 { 235 G4double LongitudinalStepInX0 = Longitudinal << 225 G4double LongitudinalStepInX0 = LongitudinalStep / X0; 236 G4float x1 = BetaNSpot * LongitudinalStepInX << 226 G4float x1 = BetaNSpot*LongitudinalStepInX0; 237 G4float x2 = AlphaNSpot; 227 G4float x2 = AlphaNSpot; 238 G4float x3 = gam(x1, x2); << 228 G4float x3 = gam(x1,x2); 239 G4double DNsp = x3; 229 G4double DNsp = x3; 240 return DNsp; 230 return DNsp; 241 } 231 } 242 232 243 G4double GFlashHomoShowerParameterisation::Gen << 233 244 << 234 G4double GFlashHomoShowerParameterisation:: >> 235 GenerateRadius(G4int ispot, G4double Energy, G4double LongitudinalPosition) 245 { 236 { 246 if (ispot < 1) { << 237 if(ispot < 1) >> 238 { 247 // Determine lateral parameters in the mid 239 // Determine lateral parameters in the middle of the step. 248 // They depend on energy & position along 240 // They depend on energy & position along step. 249 // 241 // 250 G4double Tau = ComputeTau(LongitudinalPosi 242 G4double Tau = ComputeTau(LongitudinalPosition); 251 ComputeRadialParameters(Energy, Tau); << 243 ComputeRadialParameters(Energy,Tau); 252 } 244 } 253 245 254 G4double Radius; 246 G4double Radius; 255 G4double Random1 = G4UniformRand(); 247 G4double Random1 = G4UniformRand(); 256 G4double Random2 = G4UniformRand(); << 248 G4double Random2 = G4UniformRand(); 257 249 258 if (Random1 < WeightCore) // WeightCore = p << 250 if(Random1 <WeightCore) //WeightCore = p < w_i 259 { 251 { 260 Radius = Rm * RadiusCore * std::sqrt(Rando << 252 Radius = Rm * RadiusCore * std::sqrt( Random2/(1. - Random2) ); 261 } << 262 else { << 263 Radius = Rm * RadiusTail * std::sqrt(Rando << 264 } 253 } 265 Radius = std::min(Radius, DBL_MAX); << 254 else >> 255 { >> 256 Radius = Rm * RadiusTail * std::sqrt( Random2/(1. - Random2) ); >> 257 } >> 258 Radius = std::min(Radius,DBL_MAX); 266 return Radius; 259 return Radius; 267 } 260 } 268 261 269 G4double GFlashHomoShowerParameterisation::Com << 262 G4double GFlashHomoShowerParameterisation:: >> 263 ComputeTau(G4double LongitudinalPosition) 270 { 264 { 271 G4double tau = LongitudinalPosition / Tmaxh << 265 G4double tau = LongitudinalPosition / Tmaxh / X0 //<t> = T* a /(a - 1) 272 * (Alphah - 1.00) / Alphah * << 266 * (Alphah-1.00) /Alphah * 273 / (std::exp(AveLogAlphah) - 1 << 267 std::exp(AveLogAlphah)/(std::exp(AveLogAlphah)-1.); //ok 274 return tau; 268 return tau; 275 } 269 } 276 270 277 void GFlashHomoShowerParameterisation::Compute << 271 void GFlashHomoShowerParameterisation:: >> 272 ComputeRadialParameters(G4double Energy, G4double Tau) 278 { 273 { 279 G4double z1 = ParRC1 + ParRC2 * std::log(Ene << 274 G4double z1 = ParRC1 + ParRC2* std::log(Energy/GeV) ; //ok 280 G4double z2 = ParRC3 + ParRC4 * Z; // ok << 275 G4double z2 = ParRC3+ParRC4*Z ; //ok 281 RadiusCore = z1 + z2 * Tau; // ok << 276 RadiusCore = z1 + z2 * Tau ; //ok 282 << 277 283 G4double p1 = ParWC1 + ParWC2 * Z; // ok << 278 G4double p1 = ParWC1+ParWC2*Z; //ok 284 G4double p2 = ParWC3 + ParWC4 * Z; // ok << 279 G4double p2 = ParWC3+ParWC4*Z; //ok 285 G4double p3 = ParWC5 + ParWC6 * std::log(Ene << 280 G4double p3 = ParWC5+ParWC6*std::log(Energy/GeV); //ok 286 << 281 287 WeightCore = p1 * std::exp((p2 - Tau) / p3 - << 282 WeightCore = p1 * std::exp( (p2-Tau)/p3 - std::exp( (p2-Tau) /p3) ); //ok 288 << 283 289 G4double k1 = ParRT1 + ParRT2 * Z; // ok << 284 G4double k1 = ParRT1+ParRT2*Z; // ok 290 G4double k2 = ParRT3; // ok << 285 G4double k2 = ParRT3; // ok 291 G4double k3 = ParRT4; // ok << 286 G4double k3 = ParRT4; // ok 292 G4double k4 = ParRT5 + ParRT6 * std::log(Ene << 287 G4double k4 = ParRT5+ParRT6* std::log(Energy/GeV); // ok 293 288 294 RadiusTail = k1 * (std::exp(k3 * (Tau - k2)) << 289 RadiusTail = k1*(std::exp(k3*(Tau-k2)) + >> 290 std::exp(k4*(Tau-k2)) ); //ok 295 } 291 } 296 292 297 G4double GFlashHomoShowerParameterisation:: 293 G4double GFlashHomoShowerParameterisation:: 298 GenerateExponential(const G4double /* Energy * 294 GenerateExponential(const G4double /* Energy */ ) 299 { 295 { 300 G4double ParExp1 = 9./7.*X0; 296 G4double ParExp1 = 9./7.*X0; 301 G4double random = -ParExp1*G4RandExponentia 297 G4double random = -ParExp1*G4RandExponential::shoot() ; 302 return random; 298 return random; 303 } 299 } 304 300