34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
85 G4cout <<
"\n " << partName <<
" ("
87 << material->
GetName() <<
" (density: "
88 <<
G4BestUnit(density,
"Volumic Mass") <<
"; radiation length: "
94 G4cout <<
"\n Range cuts : \t gamma "
97 G4cout <<
"\n Energy cuts : \t gamma "
107 G4double gamM1 = energy/Mass_c2,
gam = gamM1 + 1., gamP1 = gam + 1.;
124 std::vector<G4String> emName;
125 std::vector<G4double> enerCut;
126 size_t length = plist->
size();
127 for (
size_t j=0; j<length; j++) {
128 procName = (*plist)[j]->GetProcessName();
130 if ((procName ==
"eBrem")||(procName ==
"muBrems")) cut =
fEnergyCut[0];
132 (procName !=
"msc")) {
133 emName.push_back(procName);
134 enerCut.push_back(cut);
139 char* htmlDocName = getenv(
"G4PhysListName");
140 char* htmlDocDir = getenv(
"G4PhysListDocDir");
141 if (htmlDocName && htmlDocDir) {
146 G4cout <<
"\n processes : ";
147 for (
size_t j=0; j<emName.size();j++)
148 G4cout <<
"\t" << std::setw(13) << emName[j] <<
"\t";
149 G4cout <<
"\t" << std::setw(13) <<
"total";
156 std::vector<G4double> sigma0;
159 for (
size_t j=0; j<emName.size();j++) {
161 (energy,particle,emName[j],Z,A,enerCut[j]);
163 sigma0.push_back(sig);
165 sigma0.push_back(sigtot);
167 G4cout <<
"\n \n cross section per atom : ";
168 for (
size_t j=0; j<sigma0.size();j++) {
175 std::vector<G4double> sigma0;
176 std::vector<G4double> sigma1;
177 std::vector<G4double> sigma2;
178 G4double Sig, SigtotComp = 0., Sigtot = 0.;
180 for (
size_t j=0; j<emName.size();j++) {
182 (energy,particle,emName[j],material,enerCut[j]);
184 sigma0.push_back(Sig);
187 sigma1.push_back(Sig);
188 sigma2.push_back(Sig/density);
190 sigma0.push_back(SigtotComp);
191 sigma1.push_back(Sigtot);
192 sigma2.push_back(Sigtot/density);
195 G4cout <<
"\n \n compCrossSectionPerVolume : ";
196 for (
size_t j=0; j<sigma0.size();j++) {
197 G4cout <<
"\t" << std::setw(13) << sigma0[j]*
cm <<
" cm^-1";
199 G4cout <<
"\n cross section per volume : ";
200 for (
size_t j=0; j<sigma1.size();j++) {
201 G4cout <<
"\t" << std::setw(13) << sigma1[j]*
cm <<
" cm^-1";
204 G4cout <<
"\n cross section per mass : ";
205 for (
size_t j=0; j<sigma2.size();j++) {
206 G4cout <<
"\t" << std::setw(13)
214 G4cout <<
"\n \n mean free path : ";
215 for (
size_t j=0; j<sigma1.size();j++) {
217 if (sigma1[j] > 0.) lambda = 1/sigma1[j];
222 G4cout <<
"\n (g/cm2) : ";
223 for (
size_t j=0; j<sigma2.size();j++) {
225 if (sigma2[j] > 0.) lambda = 1/sigma2[j];
232 G4cout <<
"\n-----------------------------------------------------------\n"
238 std::vector<G4double> dedx1;
239 std::vector<G4double> dedx2;
241 size_t nproc = emName.size();
243 for (
size_t j=0; j<nproc; j++) {
244 dedx = emCal.
ComputeDEDX(energy,particle,emName[j],material,enerCut[j]);
246 dedx1.push_back(dedx);
247 dedx2.push_back(dedx/density);
249 dedx1.push_back(dedxtot);
250 dedx2.push_back(dedxtot/density);
253 G4cout <<
"\n \n restricted dE/dx : ";
254 for (
size_t j=0; j<=nproc; j++) {
255 G4cout <<
"\t" << std::setw(13)
259 G4cout <<
"\n (MeV/g/cm2) : ";
260 for (
size_t j=0; j<=nproc; j++) {
261 G4cout <<
"\t" << std::setw(13)
262 <<
G4BestUnit(dedx2[j],
"Energy*Surface/Mass");
266 for (
size_t j=0; j<nproc; j++) {
267 dedx = emCal.
ComputeDEDX(energy,particle,emName[j],material,energy);
270 dedx2[j] = dedx/density;
272 dedx1[nproc] = dedxtot;
273 dedx2[nproc] = dedxtot/density;
276 G4cout <<
"\n \n unrestricted dE/dx : ";
277 for (
size_t j=0; j<=nproc; j++) {
281 G4cout <<
"\n (MeV/g/cm2) : ";
282 for (
size_t j=0; j<=nproc; j++) {
283 G4cout <<
"\t" << std::setw(13)
284 <<
G4BestUnit(dedx2[j],
"Energy*Surface/Mass");
292 G4cout <<
"\n \n range from restrict dE/dx: "
293 <<
"\t" << std::setw(8) <<
G4BestUnit(range1,
"Length")
294 <<
" (" << std::setw(8) <<
G4BestUnit(range2,
"Mass/Surface") <<
")";
298 if(energy < EmaxTable) {
302 G4cout <<
"\n range from full dE/dx : "
303 <<
"\t" << std::setw(8) <<
G4BestUnit(Range1,
"Length")
304 <<
" (" << std::setw(8) <<
G4BestUnit(Range2,
"Mass/Surface") <<
")";
312 G4cout <<
"\n \n transport mean free path : "
313 <<
"\t" << std::setw(8) <<
G4BestUnit(MSmfp1,
"Length")
314 <<
" (" << std::setw(8) <<
G4BestUnit(MSmfp2,
"Mass/Surface") <<
")";
318 G4cout <<
"\n-------------------------------------------------------------\n";
344 for (
size_t i=0; i<numOfCouples; i++) {
379 G4int iter = 0 , itermax = 10;
380 while (err > errmax && iter < itermax) {
384 err = std::abs(deioni - ekin)/ekin;
387 G4cout <<
"\n \n critical energy (Rossi) : "
388 <<
"\t" << std::setw(8) <<
G4BestUnit(ekin,
"Energy");
399 EcPdg = pdga[istat]/Zeff;
400 G4cout <<
"\t\t\t (from Pdg formula : "
401 << std::setw(8) <<
G4BestUnit(EcPdg,
"Energy") <<
")";
405 G4double rMolier1 = Es/ekin, rMolier2 = rMolier1*radl;
406 G4cout <<
"\n Moliere radius : "
407 <<
"\t" << std::setw(8) << rMolier1 <<
" X0 "
408 <<
"= " << std::setw(8) <<
G4BestUnit(rMolier2,
"Length");
412 G4cout <<
"\t (from Pdg formula : "
413 << std::setw(8) <<
G4BestUnit(rMPdg,
"Length") <<
")";
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
void EndOfRunAction(const G4Run *)
static constexpr double MeV
G4double GetRadlen() const
const G4String & GetParticleName() const
G4double GetPDGCharge() const
G4ParticleGun * GetParticleGun()
G4ProcessVector * GetProcessList() const
G4double GetPDGMass() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
void BeginOfRunAction(const G4Run *)
const G4String & GetName() const
G4double MaxEnergyForCSDARange() const
const G4ParticleDefinition const G4Material *G4double range
static constexpr double electron_mass_c2
double A(double temperature)
static G4Positron * Positron()
The primary generator action class with particle gun.
G4double ComputeCrossSectionPerAtom(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
static G4Electron * Electron()
size_t GetTableSize() const
DetectorConstruction * fDetector
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
static G4ProductionCutsTable * GetProductionCutsTable()
G4ProcessManager * GetProcessManager() const
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
G4double GetParticleEnergy() const
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
const std::vector< G4double > * GetRangeCutsVector(size_t pcIdx) const
PrimaryGeneratorAction * fPrimary
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
static G4LossTableManager * Instance()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
const G4Material * GetMaterial() const
G4ParticleDefinition * GetParticleDefinition() const
G4Material * GetMaterial()
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
static G4EmParameters * Instance()
Simple detector construction with a box volume placed in a world.
size_t GetNumberOfElements() const
G4double GetDensity() const