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 "
95 << std::setw(8) <<
G4BestUnit(fRangeCut[0],
"Length")
96 <<
"\t e- " << std::setw(8) <<
G4BestUnit(fRangeCut[1],
"Length");
97 G4cout <<
"\n Energy cuts : \t gamma "
98 << std::setw(8) <<
G4BestUnit(fEnergyCut[0],
"Energy")
99 <<
"\t e- " << std::setw(8) <<
G4BestUnit(fEnergyCut[1],
"Energy")
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 G4cout <<
"\n processes : ";
140 for (
size_t j=0; j<emName.size();j++)
141 G4cout <<
"\t" << std::setw(13) << emName[j] <<
"\t";
142 G4cout <<
"\t" << std::setw(13) <<
"total";
149 std::vector<G4double> sigma0;
152 for (
size_t j=0; j<emName.size();j++) {
154 (energy,particle,emName[j],Z,A,enerCut[j]);
156 sigma0.push_back(sig);
158 sigma0.push_back(sigtot);
160 G4cout <<
"\n \n cross section per atom : ";
161 for (
size_t j=0; j<sigma0.size();j++) {
168 std::vector<G4double> sigma0;
169 std::vector<G4double> sigma1;
170 std::vector<G4double> sigma2;
171 G4double Sig, SigtotComp = 0., Sigtot = 0.;
173 for (
size_t j=0; j<emName.size();j++) {
175 (energy,particle,emName[j],material,enerCut[j]);
177 sigma0.push_back(Sig);
180 sigma1.push_back(Sig);
181 sigma2.push_back(Sig/density);
183 sigma0.push_back(SigtotComp);
184 sigma1.push_back(Sigtot);
185 sigma2.push_back(Sigtot/density);
188 G4cout <<
"\n \n compCrossSectionPerVolume : ";
189 for (
size_t j=0; j<sigma0.size();j++) {
190 G4cout <<
"\t" << std::setw(13) << sigma0[j]*
cm <<
" cm^-1";
192 G4cout <<
"\n cross section per volume : ";
193 for (
size_t j=0; j<sigma1.size();j++) {
194 G4cout <<
"\t" << std::setw(13) << sigma1[j]*
cm <<
" cm^-1";
197 G4cout <<
"\n cross section per mass : ";
198 for (
size_t j=0; j<sigma2.size();j++) {
199 G4cout <<
"\t" << std::setw(13)
207 G4cout <<
"\n \n mean free path : ";
208 for (
size_t j=0; j<sigma1.size();j++) {
210 if (sigma1[j] > 0.) lambda = 1/sigma1[j];
215 G4cout <<
"\n (g/cm2) : ";
216 for (
size_t j=0; j<sigma2.size();j++) {
218 if (sigma2[j] > 0.) lambda = 1/sigma2[j];
225 G4cout <<
"\n-----------------------------------------------------------\n"
231 std::vector<G4double> dedx1;
232 std::vector<G4double> dedx2;
234 size_t nproc = emName.size();
236 for (
size_t j=0; j<nproc; j++) {
237 dedx = emCal.
ComputeDEDX(energy,particle,emName[j],material,enerCut[j]);
239 dedx1.push_back(dedx);
240 dedx2.push_back(dedx/density);
242 dedx1.push_back(dedxtot);
243 dedx2.push_back(dedxtot/density);
246 G4cout <<
"\n \n restricted dE/dx : ";
247 for (
size_t j=0; j<=nproc; j++) {
248 G4cout <<
"\t" << std::setw(13)
252 G4cout <<
"\n (MeV/g/cm2) : ";
253 for (
size_t j=0; j<=nproc; j++) {
254 G4cout <<
"\t" << std::setw(13)
255 <<
G4BestUnit(dedx2[j],
"Energy*Surface/Mass");
259 for (
size_t j=0; j<nproc; j++) {
260 dedx = emCal.
ComputeDEDX(energy,particle,emName[j],material,energy);
263 dedx2[j] = dedx/density;
265 dedx1[nproc] = dedxtot;
266 dedx2[nproc] = dedxtot/density;
269 G4cout <<
"\n \n unrestricted dE/dx : ";
270 for (
size_t j=0; j<=nproc; j++) {
274 G4cout <<
"\n (MeV/g/cm2) : ";
275 for (
size_t j=0; j<=nproc; j++) {
276 G4cout <<
"\t" << std::setw(13)
277 <<
G4BestUnit(dedx2[j],
"Energy*Surface/Mass");
285 G4cout <<
"\n \n range from restrict dE/dx: "
286 <<
"\t" << std::setw(8) <<
G4BestUnit(range1,
"Length")
287 <<
" (" << std::setw(8) <<
G4BestUnit(range2,
"Mass/Surface") <<
")";
294 G4cout <<
"\n range from full dE/dx : "
295 <<
"\t" << std::setw(8) <<
G4BestUnit(Range1,
"Length")
296 <<
" (" << std::setw(8) <<
G4BestUnit(Range2,
"Mass/Surface") <<
")";
304 G4cout <<
"\n \n transport mean free path : "
305 <<
"\t" << std::setw(8) <<
G4BestUnit(MSmfp1,
"Length")
306 <<
" (" << std::setw(8) <<
G4BestUnit(MSmfp2,
"Mass/Surface") <<
")";
310 G4cout <<
"\n-------------------------------------------------------------\n";
336 for (
size_t i=0; i<numOfCouples; i++) {
371 G4int iter = 0 , itermax = 10;
372 while (err > errmax && iter < itermax) {
376 err = std::abs(deioni - ekin)/ekin;
379 G4cout <<
"\n \n critical energy (Rossi) : "
380 <<
"\t" << std::setw(8) <<
G4BestUnit(ekin,
"Energy");
391 EcPdg = pdga[istat]/Zeff;
392 G4cout <<
"\t\t\t (from Pdg formula : "
393 << std::setw(8) <<
G4BestUnit(EcPdg,
"Energy") <<
")";
397 G4double rMolier1 = Es/ekin, rMolier2 = rMolier1*radl;
398 G4cout <<
"\n Moliere radius : "
399 <<
"\t" << std::setw(8) << rMolier1 <<
" X0 "
400 <<
"= " << std::setw(8) <<
G4BestUnit(rMolier2,
"Length");
404 G4cout <<
"\t (from Pdg formula : "
405 << std::setw(8) <<
G4BestUnit(rMPdg,
"Length") <<
")";
The primary generator action class with particle gun.
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
void BeginOfRunAction(const G4Run *)
const G4String & GetName() const
G4double GetDensity() const
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
size_t GetTableSize() const
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
const G4ParticleDefinition const G4Material *G4double range
G4Material * GetMaterial()
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
void EndOfRunAction(const G4Run *)
static constexpr double cm
const std::vector< G4double > * GetRangeCutsVector(size_t pcIdx) const
G4double GetRadlen() const
G4double GetCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
G4double GetPDGMass() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ProcessManager * GetProcessManager() const
G4ParticleGun * GetParticleGun()
G4double energy(const ThreeVector &p, const G4double m)
G4double ComputeCrossSectionPerVolume(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
G4ParticleDefinition * GetParticleDefinition() const
static constexpr double GeV
static G4Electron * Electron()
Detector construction class to define materials and geometry.
static constexpr double MeV
G4double ComputeCrossSectionPerAtom(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
size_t GetNumberOfElements() const
G4double GetPDGCharge() const
G4double GetMeanFreePath(G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
G4double GetParticleEnergy() const
G4ProcessVector * GetProcessList() const
const G4Material * GetMaterial() const