34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "RunActionMessenger.hh"
52 fHisto(0),fDetector(det),fKinematic(kin),fRunActionMessenger(0)
55 fProjRange = fProjRange2 = fBinLength = fOffsetX = 0.;
67 delete fRunActionMessenger;
79 fProjRange = fProjRange2 = 0.;
82 if(0.0 == fBinLength) { fBinLength = 5 *
mm; }
86 fOffsetX = -0.5 * length;
92 fHisto->
Add1D(
"1",
"Edep (MeV/mm) along absorber (mm)", nbBins, 0, length,
mm);
93 fHisto->
Add1D(
"2",
"DEDX (MeV/mm) of proton", 100, -3., 7.);
94 fHisto->
Add1D(
"3",
"DEDX (MeV/mm) of monopole", 100, -3., 7.);
95 fHisto->
Add1D(
"4",
"Range(mm) of proton", 100, -3., 7.,
mm);
96 fHisto->
Add1D(
"5",
"Range(mm) of monopole", 100, -3., 7.,
mm);
106 if (nEvents == 0) {
return; }
119 G4cout <<
"\n The run consists of " << nEvents <<
" "<< particle <<
" of "
122 << matName <<
" (density: "
128 fProjRange /= nEvents; fProjRange2 /= nEvents;
129 G4double rms = fProjRange2 - fProjRange*fProjRange;
130 if (rms>0.) { rms = std::sqrt(rms); }
140 G4double ekin[100], dedxproton[100], dedxmp[100];
144 for(i = 0; i < 100; ++i) {
154 for(i=0; i<100; i++) {
155 G4cout <<
" E(MeV)= " << ekin[i] <<
" dedxp= " << dedxproton[i]
156 <<
" dedxmp= " << dedxmp[i]
170 for(i=0; i<100; ++i) {
172 fHisto->
Fill(1, e, dedxproton[i]);
173 fHisto->
Fill(2, e, dedxmp[i]);
174 fHisto->
Fill(3, e, std::log10(calc.
GetRange(ekin[i],
"proton",matName)/
mm));
175 fHisto->
Fill(4, e, std::log10(calc.
GetRange(ekin[i],
"monopole",matName)/
mm));
189 G4cout <<
"FillHisto " << ih <<
" x=" << x <<
" weight= " << weight
192 fHisto->
Fill(ih, x, weight);
The primary generator action class with particle gun.
static constexpr double mm
void BeginOfRunAction(const G4Run *)
G4double GetRange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
const G4String & GetName() const
G4double GetDensity() const
G4double ComputeElectronicDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
void Fill(G4int, G4double, G4double)
G4Material * GetAbsorMaterial(G4int i)
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
void FillHisto(G4int id, G4double x, G4double weight=1.0)
void ScaleH1(G4int, G4double)
void EndOfRunAction(const G4Run *)
void Add1D(const G4String &, const G4String &, G4int nb, G4double x1, G4double x2, G4double u=1.)
static void showEngineStatus()
G4double GetMaxStepSize()
G4ParticleGun * GetParticleGun()
G4double energy(const ThreeVector &p, const G4double m)
G4ParticleDefinition * GetParticleDefinition() const
static const G4double fac
Detector construction class to define materials and geometry.
static constexpr double MeV
void SetVerbose(G4int val)
static constexpr double keV
G4double GetParticleEnergy() const
void SetFileName(const G4String &)