36 #include "G4ProcessManager.hh" 37 #include "G4UnitsTable.hh" 38 #include "G4EmCalculator.hh" 39 #include "G4Electron.hh" 40 #include "G4SystemOfUnits.hh" 47 :detector(det), primary(kin)
60 G4int prec = G4cout.precision(6);
64 ->GetParticleDefinition();
65 G4String partName = particle->GetParticleName();
66 G4double charge = particle->GetPDGCharge();
71 G4String matName = material->GetName();
72 G4double density = material->GetDensity();
73 G4double radl = material->GetRadlen();
75 G4cout <<
"\n " << partName <<
" (" 76 << G4BestUnit(energy,
"Energy") <<
") in " 77 << material->GetName() <<
" (density: " 78 << G4BestUnit(density,
"Volumic Mass") <<
"; radiation length: " 79 << G4BestUnit(radl,
"Length") <<
")" << G4endl;
84 G4cout <<
"\n Range cuts : \t gamma " 85 << std::setw(8) << G4BestUnit(
rangeCut[0],
"Length")
86 <<
"\t e- " << std::setw(8) << G4BestUnit(
rangeCut[1],
"Length");
87 G4cout <<
"\n Energy cuts : \t gamma " 88 << std::setw(8) << G4BestUnit(
energyCut[0],
"Energy")
89 <<
"\t e- " << std::setw(8) << G4BestUnit(
energyCut[1],
"Energy")
94 G4ProcessVector* plist = particle->GetProcessManager()->GetProcessList();
97 std::vector<G4String> emName;
98 std::vector<G4double> enerCut;
99 size_t length = plist->size();
100 for (
size_t j=0; j<length; j++) {
101 procName = (*plist)[j]->GetProcessName();
103 if ((procName ==
"eBrem")||(procName ==
"muBrems")) cut =
energyCut[0];
104 if (((*plist)[j]->GetProcessType() == fElectromagnetic) &&
105 (procName !=
"msc")) {
106 emName.push_back(procName);
107 enerCut.push_back(cut);
112 G4cout <<
"\n processes : ";
113 for (
size_t j=0; j<emName.size();j++)
114 G4cout <<
"\t" << std::setw(13) << emName[j] <<
"\t";
115 G4cout <<
"\t" << std::setw(13) <<
"total";
118 G4EmCalculator emCal;
122 if (material->GetNumberOfElements() == 1) {
123 G4double
Z = material->GetZ();
124 G4double A = material->GetA();
126 std::vector<G4double> sigma0;
127 G4double sig, sigtot = 0.;
129 for (
size_t j=0; j<emName.size();j++) {
130 sig = emCal.ComputeCrossSectionPerAtom
131 (energy,particle,emName[j],Z,A,enerCut[j]);
133 sigma0.push_back(sig);
135 sigma0.push_back(sigtot);
137 G4cout <<
"\n \n cross section per atom : ";
138 for (
size_t j=0; j<sigma0.size();j++) {
139 G4cout <<
"\t" << std::setw(13) << G4BestUnit(sigma0[j],
"Surface");
145 std::vector<G4double> sigma1;
146 std::vector<G4double> sigma2;
147 G4double Sig, Sigtot = 0.;
149 for (
size_t j=0; j<emName.size();j++) {
150 Sig = emCal.GetCrossSectionPerVolume(energy,particle,emName[j],material);
151 if (Sig == 0.) Sig = emCal.ComputeCrossSectionPerVolume
152 (energy,particle,emName[j],material,enerCut[j]);
154 sigma1.push_back(Sig);
155 sigma2.push_back(Sig/density);
157 sigma1.push_back(Sigtot);
158 sigma2.push_back(Sigtot/density);
161 G4cout <<
"\n \n cross section per volume : ";
162 for (
size_t j=0; j<sigma1.size();j++) {
163 G4cout <<
"\t" << std::setw(13) << sigma1[j]*cm <<
" cm^-1";
166 G4cout <<
"\n cross section per mass : ";
167 for (
size_t j=0; j<sigma2.size();j++) {
168 G4cout <<
"\t" << std::setw(13) << G4BestUnit(sigma2[j],
"Surface/Mass");
175 G4cout <<
"\n \n mean free path : ";
176 for (
size_t j=0; j<sigma1.size();j++) {
178 if (sigma1[j] > 0.) lambda = 1/sigma1[j];
179 G4cout <<
"\t" << std::setw(13) << G4BestUnit( lambda,
"Length");
183 G4cout <<
"\n (g/cm2) : ";
184 for (
size_t j=0; j<sigma2.size();j++) {
186 if (sigma2[j] > 0.) lambda = 1/sigma2[j];
187 G4cout <<
"\t" << std::setw(13) << G4BestUnit( lambda,
"Mass/Surface");
192 G4cout.precision(prec);
193 G4cout <<
"\n-------------------------------------------------------------\n" 199 std::vector<G4double> dedx1;
200 std::vector<G4double> dedx2;
201 G4double dedx, dedxtot = 0.;
203 for (
size_t j=0; j<emName.size();j++) {
204 dedx = emCal.ComputeDEDX(energy,particle,emName[j],material,enerCut[j]);
205 dedx1.push_back(dedx);
206 dedx2.push_back(dedx/density);
208 dedxtot = emCal.GetDEDX(energy,particle,material);
209 dedx1.push_back(dedxtot);
210 dedx2.push_back(dedxtot/density);
213 G4cout <<
"\n \n restricted dE/dx : ";
214 for (
size_t j=0; j<sigma1.size();j++) {
215 G4cout <<
"\t" << std::setw(13) << G4BestUnit(dedx1[j],
"Energy/Length");
218 G4cout <<
"\n (MeV/g/cm2) : ";
219 for (
size_t j=0; j<sigma2.size();j++) {
220 G4cout <<
"\t" << std::setw(13) << G4BestUnit(dedx2[j],
"Energy*Surface/Mass");
224 G4double range1 = emCal.GetRangeFromRestricteDEDX(energy,particle,material);
225 G4double range2 = range1*density;
228 G4double Range1 = emCal.GetCSDARange(energy,particle,material);
229 G4double Range2 = Range1*density;
232 G4cout <<
"\n \n range from restrict dE/dx: " 233 <<
"\t" << std::setw(8) << G4BestUnit(range1,
"Length")
234 <<
" (" << std::setw(8) << G4BestUnit(range2,
"Mass/Surface") <<
")";
236 G4cout <<
"\n range from full dE/dx : " 237 <<
"\t" << std::setw(8) << G4BestUnit(Range1,
"Length")
238 <<
" (" << std::setw(8) << G4BestUnit(Range2,
"Mass/Surface") <<
")";
241 G4double MSmfp1 = emCal.GetMeanFreePath(energy,particle,
"msc",material);
242 G4double MSmfp2 = MSmfp1*density;
245 G4cout <<
"\n \n transport mean free path : " 246 <<
"\t" << std::setw(8) << G4BestUnit(MSmfp1,
"Length")
247 <<
" (" << std::setw(8) << G4BestUnit(MSmfp2,
"Mass/Surface") <<
")";
251 G4cout <<
"\n-------------------------------------------------------------\n";
255 G4cout.precision(prec);
265 #include "G4ProductionCutsTable.hh" 271 G4ProductionCutsTable* theCoupleTable =
272 G4ProductionCutsTable::GetProductionCutsTable();
274 size_t numOfCouples = theCoupleTable->GetTableSize();
275 const G4MaterialCutsCouple* couple = 0;
277 for (
size_t i=0; i<numOfCouples; i++) {
278 couple = theCoupleTable->GetMaterialCutsCouple(i);
283 (*(theCoupleTable->GetRangeCutsVector(idxG4GammaCut)))[index];
285 (*(theCoupleTable->GetRangeCutsVector(idxG4ElectronCut)))[index];
287 (*(theCoupleTable->GetRangeCutsVector(idxG4PositronCut)))[index];
290 (*(theCoupleTable->GetEnergyCutsVector(idxG4GammaCut)))[index];
292 (*(theCoupleTable->GetEnergyCutsVector(idxG4ElectronCut)))[index];
294 (*(theCoupleTable->GetEnergyCutsVector(idxG4PositronCut)))[index];
305 G4EmCalculator emCal;
308 const G4double radl = material->GetRadlen();
309 G4double ekin = 5*MeV;
311 G4double err = 1., errmax = 0.001;
312 G4int iter = 0 , itermax = 10;
313 while (err > errmax && iter < itermax) {
316 emCal.ComputeDEDX(ekin,G4Electron::Electron(),
"eIoni",material);
317 err = std::abs(deioni - ekin)/ekin;
320 G4cout <<
"\n \n critical energy (Rossi) : " 321 <<
"\t" << std::setw(8) << G4BestUnit(ekin,
"Energy");
324 G4double pdga[2] = { 610*MeV, 710*MeV };
325 G4double pdgb[2] = { 1.24, 0.92 };
328 if (material->GetNumberOfElements() == 1) {
330 if (material->GetState() == kStateGas) istat = 1;
331 G4double Zeff = material->GetZ() + pdgb[istat];
332 EcPdg = pdga[istat]/Zeff;
333 G4cout <<
"\t\t\t (from Pdg formula : " 334 << std::setw(8) << G4BestUnit(EcPdg,
"Energy") <<
")";
337 const G4double Es = 21.2052*MeV;
338 G4double rMolier1 = Es/ekin, rMolier2 = rMolier1*radl;
339 G4cout <<
"\n Moliere radius : " 340 <<
"\t" << std::setw(8) << rMolier1 <<
" X0 " 341 <<
"= " << std::setw(8) << G4BestUnit(rMolier2,
"Length");
343 if (material->GetNumberOfElements() == 1) {
344 G4double rMPdg = radl*Es/EcPdg;
345 G4cout <<
"\t (from Pdg formula : " 346 << std::setw(8) << G4BestUnit(rMPdg,
"Length") <<
")";
void EndOfRunAction(const G4Run *)
DetectorConstruction * detector
G4ParticleGun * GetParticleGun()
void BeginOfRunAction(const G4Run *)
PrimaryGeneratorAction * primary
G4Material * GetMaterial()
RunAction(DetectorConstruction *, PrimaryGeneratorAction *)