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 /// \file electromagnetic/TestEm0/src/RunActio << 26 // $Id: RunAction.cc,v 1.9 2006/12/08 16:38:38 maire Exp $ 27 /// \brief Implementation of the RunAction cla << 27 // GEANT4 tag $Name: geant4-09-01-patch-02 $ 28 // << 28 // 29 // << 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "RunAction.hh" 32 #include "RunAction.hh" 34 << 35 #include "DetectorConstruction.hh" 33 #include "DetectorConstruction.hh" 36 #include "PrimaryGeneratorAction.hh" 34 #include "PrimaryGeneratorAction.hh" 37 35 38 #include "G4Electron.hh" << 39 #include "G4EmCalculator.hh" << 40 #include "G4LossTableManager.hh" << 41 #include "G4PhysicalConstants.hh" << 42 #include "G4Positron.hh" << 43 #include "G4ProcessManager.hh" << 44 #include "G4Run.hh" 36 #include "G4Run.hh" 45 #include "G4SystemOfUnits.hh" << 37 #include "G4ProcessManager.hh" 46 #include "G4UnitsTable.hh" 38 #include "G4UnitsTable.hh" >> 39 #include "G4EmCalculator.hh" >> 40 #include "G4Electron.hh" 47 41 48 #include <vector> 42 #include <vector> 49 43 50 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 51 45 52 RunAction::RunAction(DetectorConstruction* det 46 RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin) 53 : fDetector(det), fPrimary(kin) << 47 :detector(det), primary(kin) 54 {} << 48 { } >> 49 >> 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 51 >> 52 RunAction::~RunAction() >> 53 { } >> 54 55 //....oooOO0OOooo........oooOO0OOooo........oo 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 56 57 void RunAction::BeginOfRunAction(const G4Run*) 57 void RunAction::BeginOfRunAction(const G4Run*) 58 { 58 { 59 // set precision for printing << 59 //set precision for printing 60 G4int prec = G4cout.precision(6); 60 G4int prec = G4cout.precision(6); 61 << 61 62 // instanciate EmCalculator << 62 // get particle 63 G4EmCalculator emCal; << 63 G4ParticleDefinition* particle = primary->GetParticleGun() 64 // emCal.SetVerbose(2); << 64 ->GetParticleDefinition(); 65 << 66 // get particle << 67 G4ParticleDefinition* particle = fPrimary->G << 68 G4String partName = particle->GetParticleNam 65 G4String partName = particle->GetParticleName(); 69 G4double charge = particle->GetPDGCharge(); << 66 G4double charge = particle->GetPDGCharge(); 70 G4double energy = fPrimary->GetParticleGun() << 67 G4double energy = primary->GetParticleGun()->GetParticleEnergy(); 71 << 68 72 // get material 69 // get material 73 const G4Material* material = fDetector->GetM << 70 G4Material* material = detector->GetMaterial(); 74 G4String matName = material->GetName(); << 71 G4String matName = material->GetName(); 75 G4double density = material->GetDensity(); << 72 G4double density = material->GetDensity(); 76 G4double radl = material->GetRadlen(); << 73 G4double radl = material->GetRadlen(); 77 << 74 78 G4cout << "\n " << partName << " (" << G4Bes << 75 G4cout << "\n " << partName << " (" 79 << material->GetName() << " (density: << 76 << G4BestUnit(energy,"Energy") << ") in " 80 << "; radiation length: " << G4Best << 77 << material->GetName() << " (density: " >> 78 << G4BestUnit(density,"Volumic Mass") << "; radiation length: " >> 79 << G4BestUnit(radl, "Length") << ")" << G4endl; 81 80 82 // get cuts << 81 // get cuts 83 GetCuts(); 82 GetCuts(); 84 if (charge != 0.) { 83 if (charge != 0.) { 85 G4cout << "\n Range cuts: \t gamma " << s << 84 G4cout << "\n Range cuts : \t gamma " 86 << "\t e- " << std::setw(12) << G4B << 85 << std::setw(8) << G4BestUnit(rangeCut[0],"Length") 87 G4cout << "\n Energy cuts: \t gamma " << s << 86 << "\t e- " << std::setw(8) << G4BestUnit(rangeCut[1],"Length"); 88 << "\t e- " << std::setw(12) << G4B << 87 G4cout << "\n Energy cuts : \t gamma " 89 } << 88 << std::setw(8) << G4BestUnit(energyCut[0],"Energy") 90 << 89 << "\t e- " << std::setw(8) << G4BestUnit(energyCut[1],"Energy") 91 // max energy transfert << 90 << G4endl; 92 if (charge != 0.) { << 91 } 93 G4double Mass_c2 = particle->GetPDGMass(); << 92 94 G4double moverM = electron_mass_c2 / Mass_ << 95 G4double gamM1 = energy / Mass_c2, gam = g << 96 G4double Tmax = energy; << 97 if (particle == G4Electron::Electron()) { << 98 Tmax *= 0.5; << 99 } << 100 else if (particle != G4Positron::Positron( << 101 Tmax = (2 * electron_mass_c2 * gamM1 * g << 102 } << 103 G4double range = emCal.GetCSDARange(Tmax, << 104 << 105 G4cout << "\n Max_energy _transferable : << 106 << G4BestUnit(range, "Length") << " << 107 } << 108 << 109 // get processList and extract EM processes 93 // get processList and extract EM processes (but not MultipleScattering) 110 G4ProcessVector* plist = particle->GetProces 94 G4ProcessVector* plist = particle->GetProcessManager()->GetProcessList(); 111 G4String procName; 95 G4String procName; 112 G4double cut; 96 G4double cut; 113 std::vector<G4String> emName; 97 std::vector<G4String> emName; 114 std::vector<G4double> enerCut; 98 std::vector<G4double> enerCut; 115 size_t length = plist->size(); 99 size_t length = plist->size(); 116 for (size_t j = 0; j < length; j++) { << 100 for (size_t j=0; j<length; j++) { 117 procName = (*plist)[j]->GetProcessName(); << 101 procName = (*plist)[j]->GetProcessName(); 118 cut = fEnergyCut[1]; << 102 cut = energyCut[1]; 119 if ((procName == "eBrem") || (procName == << 103 if ((procName == "eBrem")||(procName == "muBrems")) cut = energyCut[0]; 120 if (((*plist)[j]->GetProcessType() == fEle << 104 if (((*plist)[j]->GetProcessType() == fElectromagnetic) && 121 emName.push_back(procName); << 105 (procName != "msc")) { 122 enerCut.push_back(cut); << 106 emName.push_back(procName); 123 } << 107 enerCut.push_back(cut); >> 108 } 124 } 109 } 125 << 110 126 // write html documentation, if requested << 127 char* htmlDocName = std::getenv("G4PhysListN << 128 char* htmlDocDir = std::getenv("G4PhysListDo << 129 if (htmlDocName && htmlDocDir) { << 130 G4LossTableManager::Instance()->DumpHtml() << 131 } << 132 << 133 // print list of processes 111 // print list of processes 134 G4cout << "\n processes : "; 112 G4cout << "\n processes : "; 135 for (size_t j = 0; j < emName.size(); ++j) { << 113 for (size_t j=0; j<emName.size();j++) 136 G4cout << "\t" << std::setw(14) << emName[ << 114 G4cout << "\t" << std::setw(13) << emName[j] << "\t"; 137 } << 115 G4cout << "\t" << std::setw(13) <<"total"; 138 G4cout << "\t" << std::setw(14) << "total"; << 116 139 << 117 //instanciate EmCalculator 140 // compute cross section per atom (only for << 118 G4EmCalculator emCal; >> 119 // emCal.SetVerbose(2); >> 120 >> 121 //compute cross section per atom (only for single material) 141 if (material->GetNumberOfElements() == 1) { 122 if (material->GetNumberOfElements() == 1) { 142 G4double Z = material->GetZ(); 123 G4double Z = material->GetZ(); 143 G4double A = material->GetA(); 124 G4double A = material->GetA(); 144 << 125 145 std::vector<G4double> sigma0; 126 std::vector<G4double> sigma0; 146 G4double sig, sigtot = 0.; 127 G4double sig, sigtot = 0.; 147 128 148 for (size_t j = 0; j < emName.size(); j++) << 129 for (size_t j=0; j<emName.size();j++) { 149 sig = emCal.ComputeCrossSectionPerAtom(e << 130 sig = emCal.ComputeCrossSectionPerAtom 150 sigtot += sig; << 131 (energy,particle,emName[j],Z,A,enerCut[j]); 151 sigma0.push_back(sig); << 132 sigtot += sig; >> 133 sigma0.push_back(sig); 152 } 134 } 153 sigma0.push_back(sigtot); 135 sigma0.push_back(sigtot); 154 136 155 G4cout << "\n \n cross section per atom 137 G4cout << "\n \n cross section per atom : "; 156 for (size_t j = 0; j < sigma0.size(); ++j) << 138 for (size_t j=0; j<sigma0.size();j++) { 157 G4cout << "\t" << std::setw(9) << G4Best << 139 G4cout << "\t" << std::setw(13) << G4BestUnit(sigma0[j], "Surface"); 158 } 140 } 159 G4cout << G4endl; 141 G4cout << G4endl; 160 } 142 } 161 << 143 162 // get cross section per volume << 144 //get cross section per volume 163 std::vector<G4double> sigma0; << 164 std::vector<G4double> sigma1; 145 std::vector<G4double> sigma1; 165 std::vector<G4double> sigma2; << 146 std::vector<G4double> sigma2; 166 G4double Sig, SigtotComp = 0., Sigtot = 0.; << 147 G4double Sig, Sigtot = 0.; 167 148 168 for (size_t j = 0; j < emName.size(); ++j) { << 149 for (size_t j=0; j<emName.size();j++) { 169 Sig = emCal.ComputeCrossSectionPerVolume(e << 150 Sig = emCal.GetCrossSectionPerVolume(energy,particle,emName[j],material); 170 SigtotComp += Sig; << 151 if (Sig == 0.) Sig = emCal.ComputeCrossSectionPerVolume 171 sigma0.push_back(Sig); << 152 (energy,particle,emName[j],material,enerCut[j]); 172 Sig = emCal.GetCrossSectionPerVolume(energ << 153 Sigtot += Sig; 173 Sigtot += Sig; << 174 sigma1.push_back(Sig); 154 sigma1.push_back(Sig); 175 sigma2.push_back(Sig / density); << 155 sigma2.push_back(Sig/density); 176 } 156 } 177 sigma0.push_back(SigtotComp); << 178 sigma1.push_back(Sigtot); 157 sigma1.push_back(Sigtot); 179 sigma2.push_back(Sigtot / density); << 158 sigma2.push_back(Sigtot/density); 180 << 159 181 // print cross sections << 160 //print cross sections 182 G4cout << "\n compCrossSectionPerVolume: "; << 161 G4cout << "\n \n cross section per volume : "; 183 for (size_t j = 0; j < sigma0.size(); ++j) { << 162 for (size_t j=0; j<sigma1.size();j++) { 184 G4cout << "\t" << std::setw(9) << sigma0[j << 163 G4cout << "\t" << std::setw(13) << sigma1[j]*cm << " cm^-1"; 185 } << 186 G4cout << "\n cross section per volume : "; << 187 for (size_t j = 0; j < sigma1.size(); ++j) { << 188 G4cout << "\t" << std::setw(9) << sigma1[j << 189 } 164 } 190 << 165 191 G4cout << "\n cross section per mass : "; 166 G4cout << "\n cross section per mass : "; 192 for (size_t j = 0; j < sigma2.size(); ++j) { << 167 for (size_t j=0; j<sigma2.size();j++) { 193 G4cout << "\t" << std::setw(9) << G4BestUn << 168 G4cout << "\t" << std::setw(13) << G4BestUnit(sigma2[j], "Surface/Mass"); 194 } 169 } 195 << 170 196 // print mean free path << 171 //print mean free path 197 << 172 198 G4double lambda; 173 G4double lambda; 199 << 174 200 G4cout << "\n \n mean free path : 175 G4cout << "\n \n mean free path : "; 201 for (size_t j = 0; j < sigma1.size(); ++j) { << 176 for (size_t j=0; j<sigma1.size();j++) { 202 lambda = DBL_MAX; << 177 lambda = DBL_MAX; 203 if (sigma1[j] > 0.) lambda = 1 / sigma1[j] << 178 if (sigma1[j] > 0.) lambda = 1/sigma1[j]; 204 G4cout << "\t" << std::setw(9) << G4BestUn << 179 G4cout << "\t" << std::setw(13) << G4BestUnit( lambda, "Length"); 205 } << 180 } 206 << 181 207 // mean free path (g/cm2) << 182 //mean free path (g/cm2) 208 G4cout << "\n (g/cm2) : "; << 183 G4cout << "\n (g/cm2) : "; 209 for (size_t j = 0; j < sigma2.size(); ++j) { << 184 for (size_t j=0; j<sigma2.size();j++) { 210 lambda = DBL_MAX; << 185 lambda = DBL_MAX; 211 if (sigma2[j] > 0.) lambda = 1 / sigma2[j] << 186 if (sigma2[j] > 0.) lambda = 1/sigma2[j]; 212 G4cout << "\t" << std::setw(9) << G4BestUn << 187 G4cout << "\t" << std::setw(13) << G4BestUnit( lambda, "Mass/Surface"); 213 } 188 } 214 G4cout << G4endl; 189 G4cout << G4endl; 215 << 190 216 if (charge == 0.) { 191 if (charge == 0.) { 217 G4cout.precision(prec); 192 G4cout.precision(prec); 218 G4cout << "\n----------------------------- << 193 G4cout << "\n-------------------------------------------------------------\n" >> 194 << G4endl; 219 return; 195 return; 220 } 196 } 221 << 197 222 // get stopping power << 198 //get stopping power 223 std::vector<G4double> dedx1; 199 std::vector<G4double> dedx1; 224 std::vector<G4double> dedx2; << 200 std::vector<G4double> dedx2; 225 G4double dedx, dedxtot = 0.; 201 G4double dedx, dedxtot = 0.; 226 size_t nproc = emName.size(); << 227 202 228 for (size_t j = 0; j < nproc; ++j) { << 203 for (size_t j=0; j<emName.size();j++) { 229 dedx = emCal.ComputeDEDX(energy, particle, << 204 dedx = emCal.ComputeDEDX(energy,particle,emName[j],material,enerCut[j]); 230 dedxtot += dedx; << 231 dedx1.push_back(dedx); 205 dedx1.push_back(dedx); 232 dedx2.push_back(dedx / density); << 206 dedx2.push_back(dedx/density); 233 } 207 } >> 208 dedxtot = emCal.GetDEDX(energy,particle,material); 234 dedx1.push_back(dedxtot); 209 dedx1.push_back(dedxtot); 235 dedx2.push_back(dedxtot / density); << 210 dedx2.push_back(dedxtot/density); 236 << 211 237 // print stopping power << 212 //print stopping power 238 G4cout << "\n \n restricted dE/dx : 213 G4cout << "\n \n restricted dE/dx : "; 239 for (size_t j = 0; j <= nproc; ++j) { << 214 for (size_t j=0; j<sigma1.size();j++) { 240 G4cout << "\t" << std::setw(9) << G4BestUn << 215 G4cout << "\t" << std::setw(13) << G4BestUnit(dedx1[j],"Energy/Length"); 241 } << 242 << 243 G4cout << "\n (MeV/g/cm2) : "; << 244 for (size_t j = 0; j <= nproc; ++j) { << 245 G4cout << "\t" << std::setw(9) << G4BestUn << 246 } << 247 dedxtot = 0.; << 248 << 249 for (size_t j = 0; j < nproc; ++j) { << 250 dedx = emCal.ComputeDEDX(energy, particle, << 251 dedxtot += dedx; << 252 dedx1[j] = dedx; << 253 dedx2[j] = dedx / density; << 254 } << 255 dedx1[nproc] = dedxtot; << 256 dedx2[nproc] = dedxtot / density; << 257 << 258 // print stopping power << 259 G4cout << "\n \n unrestricted dE/dx : << 260 for (size_t j = 0; j <= nproc; ++j) { << 261 G4cout << "\t" << std::setw(9) << G4BestUn << 262 } 216 } 263 << 217 264 G4cout << "\n (MeV/g/cm2) : "; 218 G4cout << "\n (MeV/g/cm2) : "; 265 for (size_t j = 0; j <= nproc; ++j) { << 219 for (size_t j=0; j<sigma2.size();j++) { 266 G4cout << "\t" << std::setw(9) << G4BestUn << 220 G4cout << "\t" << std::setw(13) << G4BestUnit(dedx2[j],"Energy*Surface/Mass"); 267 } 221 } 268 << 222 269 // get range from restricted dedx << 223 //get range from restricted dedx 270 G4double range1 = emCal.GetRangeFromRestrict << 224 G4double range1 = emCal.GetRangeFromRestricteDEDX(energy,particle,material); 271 G4double range2 = range1 * density; << 225 G4double range2 = range1*density; 272 << 226 273 // print range << 227 //get range from full dedx 274 G4cout << "\n \n range from restrict dE/dx: << 228 G4double Range1 = emCal.GetCSDARange(energy,particle,material); 275 << "\t" << std::setw(9) << G4BestUnit << 229 G4double Range2 = Range1*density; 276 << G4BestUnit(range2, "Mass/Surface") << 230 277 << 231 //print range 278 // get range from full dedx << 232 G4cout << "\n \n range from restrict dE/dx: " 279 G4double EmaxTable = G4EmParameters::Instanc << 233 << "\t" << std::setw(8) << G4BestUnit(range1,"Length") 280 if (energy < EmaxTable) { << 234 << " (" << std::setw(8) << G4BestUnit(range2,"Mass/Surface") << ")"; 281 G4double Range1 = emCal.GetCSDARange(energ << 235 282 G4double Range2 = Range1 * density; << 236 G4cout << "\n range from full dE/dx : " 283 << 237 << "\t" << std::setw(8) << G4BestUnit(Range1,"Length") 284 G4cout << "\n range from full dE/dx : << 238 << " (" << std::setw(8) << G4BestUnit(Range2,"Mass/Surface") << ")"; 285 << "\t" << std::setw(9) << G4BestUn << 239 286 << G4BestUnit(Range2, "Mass/Surface << 240 //get transport mean free path (for multiple scattering) 287 } << 241 G4double MSmfp1 = emCal.GetMeanFreePath(energy,particle,"msc",material); 288 << 242 G4double MSmfp2 = MSmfp1*density; 289 // get transport mean free path (for multipl << 243 290 G4double MSmfp1 = emCal.GetMeanFreePath(ener << 244 //print transport mean free path 291 G4double MSmfp2 = MSmfp1 * density; << 245 G4cout << "\n \n transport mean free path : " 292 << 246 << "\t" << std::setw(8) << G4BestUnit(MSmfp1,"Length") 293 // print transport mean free path << 247 << " (" << std::setw(8) << G4BestUnit(MSmfp2,"Mass/Surface") << ")"; 294 G4cout << "\n \n transport mean free path : << 295 << "\t" << std::setw(9) << G4BestUnit << 296 << G4BestUnit(MSmfp2, "Mass/Surface") << 297 248 298 if (particle == G4Electron::Electron()) Crit 249 if (particle == G4Electron::Electron()) CriticalEnergy(); 299 << 250 300 G4cout << "\n------------------------------- 251 G4cout << "\n-------------------------------------------------------------\n"; 301 G4cout << G4endl; 252 G4cout << G4endl; 302 << 253 303 // reset default precision << 254 // reset default precision 304 G4cout.precision(prec); << 255 G4cout.precision(prec); 305 } 256 } 306 257 307 //....oooOO0OOooo........oooOO0OOooo........oo 258 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 308 259 309 void RunAction::EndOfRunAction(const G4Run*) { << 260 void RunAction::EndOfRunAction(const G4Run* ) >> 261 { } 310 262 311 //....oooOO0OOooo........oooOO0OOooo........oo 263 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 312 264 313 #include "G4ProductionCutsTable.hh" 265 #include "G4ProductionCutsTable.hh" 314 266 315 //....oooOO0OOooo........oooOO0OOooo........oo 267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 316 268 317 void RunAction::GetCuts() 269 void RunAction::GetCuts() 318 { << 270 { 319 G4ProductionCutsTable* theCoupleTable = G4Pr << 271 G4ProductionCutsTable* theCoupleTable = 320 << 272 G4ProductionCutsTable::GetProductionCutsTable(); >> 273 321 size_t numOfCouples = theCoupleTable->GetTab 274 size_t numOfCouples = theCoupleTable->GetTableSize(); 322 const G4MaterialCutsCouple* couple = 0; 275 const G4MaterialCutsCouple* couple = 0; 323 G4int index = 0; 276 G4int index = 0; 324 for (size_t i = 0; i < numOfCouples; i++) { << 277 for (size_t i=0; i<numOfCouples; i++) { 325 couple = theCoupleTable->GetMaterialCutsCo << 278 couple = theCoupleTable->GetMaterialCutsCouple(i); 326 if (couple->GetMaterial() == fDetector->Ge << 279 if (couple->GetMaterial() == detector->GetMaterial()) {index = i; break;} 327 index = i; << 280 } 328 break; << 281 329 } << 282 rangeCut[0] = 330 } << 283 (*(theCoupleTable->GetRangeCutsVector(idxG4GammaCut)))[index]; >> 284 rangeCut[1] = >> 285 (*(theCoupleTable->GetRangeCutsVector(idxG4ElectronCut)))[index]; >> 286 rangeCut[2] = >> 287 (*(theCoupleTable->GetRangeCutsVector(idxG4PositronCut)))[index]; >> 288 >> 289 energyCut[0] = >> 290 (*(theCoupleTable->GetEnergyCutsVector(idxG4GammaCut)))[index]; >> 291 energyCut[1] = >> 292 (*(theCoupleTable->GetEnergyCutsVector(idxG4ElectronCut)))[index]; >> 293 energyCut[2] = >> 294 (*(theCoupleTable->GetEnergyCutsVector(idxG4PositronCut)))[index]; 331 295 332 fRangeCut[0] = (*(theCoupleTable->GetRangeCu << 333 fRangeCut[1] = (*(theCoupleTable->GetRangeCu << 334 fRangeCut[2] = (*(theCoupleTable->GetRangeCu << 335 << 336 fEnergyCut[0] = (*(theCoupleTable->GetEnergy << 337 fEnergyCut[1] = (*(theCoupleTable->GetEnergy << 338 fEnergyCut[2] = (*(theCoupleTable->GetEnergy << 339 } 296 } 340 297 341 //....oooOO0OOooo........oooOO0OOooo........oo 298 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 342 299 343 void RunAction::CriticalEnergy() 300 void RunAction::CriticalEnergy() 344 { 301 { 345 // compute e- critical energy (Rossi definit 302 // compute e- critical energy (Rossi definition) and Moliere radius. 346 // Review of Particle Physics - Eur. Phys. J 303 // Review of Particle Physics - Eur. Phys. J. C3 (1998) page 147 347 // 304 // 348 G4EmCalculator emCal; 305 G4EmCalculator emCal; 349 << 306 350 const G4Material* material = fDetector->GetM << 307 const G4Material* material = detector->GetMaterial(); 351 const G4double radl = material->GetRadlen(); 308 const G4double radl = material->GetRadlen(); 352 G4double ekin = 5 * MeV; << 309 G4double ekin = 5*MeV; 353 G4double deioni; 310 G4double deioni; 354 G4double err = 1., errmax = 0.001; << 311 G4double err = 1., errmax = 0.001; 355 G4int iter = 0, itermax = 10; << 312 G4int iter = 0 , itermax = 10; 356 while (err > errmax && iter < itermax) { 313 while (err > errmax && iter < itermax) { 357 iter++; << 314 iter++; 358 deioni = radl * emCal.ComputeDEDX(ekin, G4 << 315 deioni = radl* 359 err = std::abs(deioni - ekin) / ekin; << 316 emCal.ComputeDEDX(ekin,G4Electron::Electron(),"eIoni",material); >> 317 err = std::abs(deioni - ekin)/ekin; 360 ekin = deioni; 318 ekin = deioni; 361 } 319 } 362 G4cout << "\n \n critical energy (Rossi) : << 320 G4cout << "\n \n critical energy (Rossi) : " 363 << "\t" << std::setw(8) << G4BestUnit << 321 << "\t" << std::setw(8) << G4BestUnit(ekin,"Energy"); 364 << 322 365 // Pdg formula (only for single material) << 323 //Pdg formula (only for single material) 366 G4double pdga[2] = {610 * MeV, 710 * MeV}; << 324 G4double pdga[2] = { 610*MeV, 710*MeV }; 367 G4double pdgb[2] = {1.24, 0.92}; << 325 G4double pdgb[2] = { 1.24, 0.92 }; 368 G4double EcPdg = 0.; 326 G4double EcPdg = 0.; 369 << 327 370 if (material->GetNumberOfElements() == 1) { 328 if (material->GetNumberOfElements() == 1) { 371 G4int istat = 0; 329 G4int istat = 0; 372 if (material->GetState() == kStateGas) ist << 330 if (material->GetState() == kStateGas) istat = 1; 373 G4double Zeff = material->GetZ() + pdgb[is 331 G4double Zeff = material->GetZ() + pdgb[istat]; 374 EcPdg = pdga[istat] / Zeff; << 332 EcPdg = pdga[istat]/Zeff; 375 G4cout << "\t\t\t (from Pdg formula : " << << 333 G4cout << "\t\t\t (from Pdg formula : " 376 } << 334 << std::setw(8) << G4BestUnit(EcPdg,"Energy") << ")"; 377 << 335 } 378 const G4double Es = 21.2052 * MeV; << 336 379 G4double rMolier1 = Es / ekin, rMolier2 = rM << 337 const G4double Es = 21.2052*MeV; 380 G4cout << "\n Moliere radius : " << 338 G4double rMolier1 = Es/ekin, rMolier2 = rMolier1*radl; 381 << "\t" << std::setw(8) << rMolier1 < << 339 G4cout << "\n Moliere radius : " 382 << "= " << std::setw(8) << G4BestUnit << 340 << "\t" << std::setw(8) << rMolier1 << " X0 " 383 << 341 << "= " << std::setw(8) << G4BestUnit(rMolier2,"Length"); 384 if (material->GetNumberOfElements() == 1) { << 342 385 G4double rMPdg = radl * Es / EcPdg; << 343 if (material->GetNumberOfElements() == 1) { 386 G4cout << "\t (from Pdg formula : " << std << 344 G4double rMPdg = radl*Es/EcPdg; 387 } << 345 G4cout << "\t (from Pdg formula : " >> 346 << std::setw(8) << G4BestUnit(rMPdg,"Length") << ")"; >> 347 } 388 } 348 } 389 349 390 //....oooOO0OOooo........oooOO0OOooo........oo 350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 391 351