Import Geant4 10.5.1 source tree

This commit is contained in:
Gabriele Cosmo
2019-04-17 10:39:02 +02:00
parent a7fdc52004
commit 28a70706e0
661 changed files with 55791 additions and 106984 deletions
@@ -105,12 +105,10 @@ void G4MonopolePhysics::ConstructProcess()
G4ProcessManager* pmanager = fMpl->GetProcessManager();
// defined monopole parameters and binning
G4double magn = fMpl->MagneticCharge();
G4double emin = fMonopoleMass/20000.;
if(emin < keV) { emin = keV; }
G4double emin = std::min(fMonopoleMass/20000., CLHEP::keV);
G4double emax = std::max(10.*TeV, fMonopoleMass*100);
G4int nbin = G4lrint(10*std::log10(emax/emin));
G4int nbin = G4lrint(10*std::log10(emax/emin));
// dedicated trasporation
if(magn != 0.0) {
@@ -141,10 +139,11 @@ void G4MonopolePhysics::ConstructProcess()
void G4MonopolePhysics::SetMagneticCharge(G4double val)
{
if ( fMpl ) {
G4cerr << "Cannot set value. Monopole particle was already constructed." << G4endl;
G4Exception("G4MonopolePhysics", "01", JustWarning,
"Cannot set value when monopole is already constructed.");
} else {
fMagCharge = val;
}
fMagCharge = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -152,10 +151,11 @@ void G4MonopolePhysics::SetMagneticCharge(G4double val)
void G4MonopolePhysics::SetElectricCharge(G4double val)
{
if ( fMpl ) {
G4cerr << "Cannot set value. Monopole particle was already constructed." << G4endl;
G4Exception("G4MonopolePhysics", "01", JustWarning,
"Cannot set value when monopole is already constructed.");
} else {
fElCharge = val;
}
fElCharge = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -163,10 +163,11 @@ void G4MonopolePhysics::SetElectricCharge(G4double val)
void G4MonopolePhysics::SetMonopoleMass(G4double mass)
{
if ( fMpl ) {
G4cerr << "Cannot set value. Monopole particle was already constructed." << G4endl;
G4Exception("G4MonopolePhysics", "01", JustWarning,
"Cannot set value when monopole is already constructed.");
} else {
fMonopoleMass = mass;
}
fMonopoleMass = mass;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,6 +34,7 @@
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4EmCalculator.hh"
#include "G4Proton.hh"
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include <iomanip>
@@ -88,14 +89,17 @@ void Run::EndOfRun(double binLength)
const G4Material* material = fDetector->GetAbsorMaterial();
G4double density = material->GetDensity();
G4String matName = material->GetName();
const G4ParticleDefinition* part =
fPrimary->GetParticleGun()->GetParticleDefinition();
G4String particle = part->GetParticleName();
const G4ParticleDefinition* proton = G4Proton::Proton();
G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
if(GetVerbose() > 0){
G4cout << "\n The run consists of " << nEvents << " "<< particle << " of "
<< G4BestUnit(energy,"Energy") << " through "
<< G4BestUnit(energy,"Energy") << "\n through "
<< G4BestUnit(fDetector->GetAbsorSizeX(),"Length") << " of "
<< matName << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
@@ -103,7 +107,6 @@ void Run::EndOfRun(double binLength)
};
//compute projected range and straggling
fProjRange /= nEvents; fProjRange2 /= nEvents;
G4double rms = fProjRange2 - fProjRange*fProjRange;
if (rms>0.) { rms = std::sqrt(rms); }
@@ -116,44 +119,68 @@ void Run::EndOfRun(double binLength)
<< "\n" << G4endl;
};
G4double ekin[100], dedxproton[100], dedxmp[100];
G4double ekin[100], dedxp[100], dedxmp[100], tdedxp[100], tdedxmp[100],
xsp[100], xsmp[100];
G4EmCalculator calc;
//calc.SetVerbose(2);
G4int i;
for(i = 0; i < 100; ++i) {
ekin[i] = std::pow(10., 0.1*G4double(i)) * keV;
dedxproton[i] =
calc.ComputeElectronicDEDX(ekin[i], "proton", matName);
dedxmp[i] =
calc.ComputeElectronicDEDX(ekin[i], "monopole", matName);
ekin[i] = std::pow(10., 0.1*G4double(i)) * keV;
dedxp[i] = calc.GetDEDX(ekin[i], proton, material);
xsp[i] = calc.GetCrossSectionPerVolume(ekin[i], proton, "hIoni",
material);
tdedxp[i] = calc.ComputeElectronicDEDX(ekin[i], proton, material);
dedxmp[i] = calc.GetDEDX(ekin[i], part, material);
xsmp[i] = calc.GetCrossSectionPerVolume(ekin[i], part, "mplIoni",
material);
tdedxmp[i] = calc.ComputeElectronicDEDX(ekin[i], part, material);
}
if(GetVerbose() > 0){
G4cout << "### Stopping Powers" << G4endl;
G4int prec = G4cout.precision(3);
G4cout<<"##################################################################"
<< G4endl;
G4cout<< "### Stopping Powers and Cross Sections" << G4endl;
G4cout<<"##################################################################"
<< G4endl;
G4cout<<"# N E(MeV) p_dEdx(MeV/mm) mpl_dEdx(MeV/mm) xs(1/mm)"
<< G4endl;
G4cout<<" restr tot restr tot p mpl"
<< G4endl;
G4cout<<"##################################################################"
<< G4endl;
for(i=0; i<100; ++i) {
G4cout << " E(MeV)= " << ekin[i] << " dedxp(MeV/mm)= " << dedxproton[i]
<< " dedxmp(MeV/mm)= " << dedxmp[i]
G4cout << std::setw(2) << i << "." << std::setw(9) << ekin[i]
<< std::setw(8) << dedxp[i]
<< std::setw(8) << tdedxp[i]
<< std::setw(9) << dedxmp[i]
<< std::setw(9) << tdedxmp[i]
<< std::setw(10) << xsp[i]
<< std::setw(10) << xsmp[i]
<< G4endl;
}
G4cout.precision(prec);
G4cout<<"##################################################################"
<< G4endl;
}
G4cout << "### End of stopping power table" << G4endl;
// normalize histogram
G4double fac = (mm/MeV) / (nEvents * binLength);
fAnalysisManager->ScaleH1(1,fac);
if(GetVerbose() > 0){
G4cout << "Range table for " << matName << G4endl;
}
for(i=0; i<100; ++i) {
G4double e = std::log10(ekin[i] / MeV) + 0.05;
fAnalysisManager->FillH1(2, e, dedxproton[i]);
fAnalysisManager->FillH1(3, e, dedxmp[i]);
fAnalysisManager->FillH1(2, e, tdedxp[i]);
fAnalysisManager->FillH1(3, e, tdedxmp[i]);
fAnalysisManager->FillH1(4, e,
std::log10(calc.GetRange(ekin[i],"proton",matName)/mm));
fAnalysisManager->FillH1(5, e,
std::log10(calc.GetRange(ekin[i],"monopole",matName)/mm));
fAnalysisManager->FillH1(6, e, dedxp[i]);
fAnalysisManager->FillH1(7, e, dedxmp[i]);
fAnalysisManager->FillH1(8, e, xsp[i]);
fAnalysisManager->FillH1(9, e, xsmp[i]);
}
}
@@ -50,7 +50,7 @@ RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* kin)
:fDetector(det),fKinematic(kin)
{
fMessenger = new RunActionMessenger(this);
fBinLength = 5 * CLHEP::mm;
fBinLength = 5 * CLHEP::mm;
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName("monopole");
analysisManager->SetVerboseLevel(1);
@@ -127,10 +127,18 @@ void RunAction::Book()
// Create histograms
analysisManager->CreateH1("h1","Edep (MeV/mm) along absorber (mm)",
nbBins, 0, length);
analysisManager->CreateH1("h2","DEDX (MeV/mm) of proton", 100, -3., 7.);
analysisManager->CreateH1("h3","DEDX (MeV/mm) of monopole", 100, -3., 7.);
analysisManager->CreateH1("h2","Total DEDX (MeV/mm) of proton",100,-3.,7.);
analysisManager->CreateH1("h3","Total DEDX (MeV/mm) of monopole",100,-3., 7.);
analysisManager->CreateH1("h4","Range(mm) of proton", 100, -3., 7., "mm");
analysisManager->CreateH1("h5","Range(mm) of monopole", 100, -3., 7., "mm");
analysisManager->CreateH1("h6","Restricted DEDX (MeV/mm) of proton",
100,-3.,7.);
analysisManager->CreateH1("h7","Restricted DEDX (MeV/mm) of monopole",
100,-3., 7.);
analysisManager->CreateH1("h8","Delta-electron x-section (1/mm) of proton",
100, -3., 7., "mm");
analysisManager->CreateH1("h9","Delta-electron x-section (1/mm) of monopole",
100, -3., 7., "mm");
analysisManager->OpenFile();
}