34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
81 if ( analysisManager->IsActive() ) {
82 analysisManager->OpenFile();
87 CLHEP::HepRandom::showEngineStatus();
95 if (nbEvents == 0)
return;
107 G4cout <<
"\n ======================== run summary ======================\n";
108 G4cout <<
"\n The run was " << nbEvents <<
" " << partName <<
" of "
109 <<
G4BestUnit(ePrimary,
"Energy") <<
" through "
111 << material->
GetName() <<
" (density: "
113 G4cout <<
"\n ===========================================================\n";
118 if ( analysisManager->IsActive() ) {
119 analysisManager->Write();
120 analysisManager->CloseFile();
134 <<
"\n TrackLength= "
136 <<
"\t nb of steps= " << nbStepPerEvent
137 <<
" stepSize= " <<
G4BestUnit(stepSize,
"Length")
148 <<
"\n d-rays : eLoss/primary= "
150 <<
"\t nb of d-rays= " << nbPerEvent
151 <<
" <Tkin>= " <<
G4BestUnit(meanEkin,
"Energy")
164 <<
"\n gamma : eLoss/primary= "
166 <<
"\t nb of gammas= " << nbPerEvent
167 <<
" <Tkin>= " <<
G4BestUnit(meanEkin,
"Energy")
181 G4double etry = ePrimary - energyPerEvent;
184 G4double dEtable = ePrimary - efinal;
186 if (dEtable > 0.) ratio = energyPerEvent/dEtable;
189 <<
"\n deposit : eLoss/primary= "
191 <<
"\t <dEcut > table= "
193 <<
" ---> simul/reference= " << ratio
199 energyPerEvent = energyTotal/nbEvents;
202 r1 = r0 - trackLPerEvent;
203 etry = ePrimary - energyPerEvent;
206 dEtable = ePrimary - efinal;
208 if (dEtable > 0.) ratio = energyPerEvent/dEtable;
211 <<
"\n total : eLoss/primary= "
213 <<
"\t <dEfull> table= "
215 <<
" ---> simul/reference= " << ratio
221 CLHEP::HepRandom::showEngineStatus();
233 G4double err = 1., errmax = 0.00001;
234 G4int iter = 0 , itermax = 10;
235 while (err > errmax && iter < itermax) {
240 dEdx = emCal.
GetDEDX(Energy,particle,material);
242 err = std::abs(dE)/Energy;
244 if (iter == itermax) {
246 <<
"\n ---> warning: RunAction::GetEnergyFromRestRange() did not converge"
248 <<
" Energy = " <<
G4BestUnit(Energy,
"Energy")
250 <<
" iter = " << iter <<
G4endl;
265 G4double err = 1., errmax = 0.00001;
266 G4int iter = 0 , itermax = 10;
267 while (err > errmax && iter < itermax) {
274 err = std::abs(dE)/Energy;
276 if (iter == itermax) {
278 <<
"\n ---> warning: RunAction::GetEnergyFromCSDARange() did not converge"
280 <<
" Energy = " <<
G4BestUnit(Energy,
"Energy")
282 <<
" iter = " << iter <<
G4endl;
PrimaryGeneratorAction class.
G4double GetEnergyFromCSDARange(G4double, G4ParticleDefinition *, G4Material *, G4double)
void BeginOfRunAction(const G4Run *)
const G4String & GetName() const
G4double GetDensity() const
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetRandomNumberStore(G4bool flag)
DetectorConstruction * fDetector
const G4String & GetParticleName() const
HistoManager * fHistoManager
G4double GetDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4double GetCSDARange(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
G4Material * GetMaterial()
void EndOfRunAction(const G4Run *)
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=0)
ExG4HbookAnalysisManager G4AnalysisManager
static G4RunManager * GetRunManager()
G4ParticleGun * GetParticleGun()
G4ParticleDefinition * GetParticleDefinition() const
G4double GetEnergyFromRestrictedRange(G4double, G4ParticleDefinition *, G4Material *, G4double)
Detector construction class to demonstrate various ways of placement.
G4double GetPDGCharge() const
G4double GetParticleEnergy() const
PrimaryGeneratorAction * fPrimary