34 #include "RunAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "PrimaryGeneratorAction.hh"
37 #include "HistoManager.hh"
83 if ( analysisManager->IsActive() ) {
84 analysisManager->OpenFile();
89 CLHEP::HepRandom::showEngineStatus();
97 if (nbEvents == 0)
return;
109 G4cout <<
"\n ======================== run summary ======================\n";
110 G4cout <<
"\n The run was " << nbEvents <<
" " << partName <<
" of "
111 <<
G4BestUnit(ePrimary,
"Energy") <<
" through "
113 << material->
GetName() <<
" (density: "
115 G4cout <<
"\n ===========================================================\n";
120 if ( analysisManager->IsActive() ) {
121 analysisManager->Write();
122 analysisManager->CloseFile();
136 <<
"\n TrackLength= "
138 <<
"\t nb of steps= " << nbStepPerEvent
139 <<
" stepSize= " <<
G4BestUnit(stepSize,
"Length")
150 <<
"\n d-rays : eLoss/primary= "
152 <<
"\t nb of d-rays= " << nbPerEvent
153 <<
" <Tkin>= " <<
G4BestUnit(meanEkin,
"Energy")
166 <<
"\n gamma : eLoss/primary= "
168 <<
"\t nb of gammas= " << nbPerEvent
169 <<
" <Tkin>= " <<
G4BestUnit(meanEkin,
"Energy")
183 G4double etry = ePrimary - energyPerEvent;
186 G4double dEtable = ePrimary - efinal;
188 if (dEtable > 0.) ratio = energyPerEvent/dEtable;
191 <<
"\n deposit : eLoss/primary= "
193 <<
"\t <dEcut > table= "
195 <<
" ---> simul/reference= " << ratio
201 energyPerEvent = energyTotal/
nbEvents;
204 r1 = r0 - trackLPerEvent;
205 etry = ePrimary - energyPerEvent;
208 dEtable = ePrimary - efinal;
210 if (dEtable > 0.) ratio = energyPerEvent/dEtable;
213 <<
"\n total : eLoss/primary= "
215 <<
"\t <dEfull> table= "
217 <<
" ---> simul/reference= " << ratio
223 CLHEP::HepRandom::showEngineStatus();
235 G4double err = 1., errmax = 0.00001;
236 G4int iter = 0 , itermax = 10;
237 while (err > errmax && iter < itermax) {
242 dEdx = emCal.
GetDEDX(Energy,particle,material);
244 err = std::abs(dE)/Energy;
246 if (iter == itermax) {
248 <<
"\n ---> warning: RunAction::GetEnergyFromRestRange() did not converge"
250 <<
" Energy = " <<
G4BestUnit(Energy,
"Energy")
252 <<
" iter = " << iter <<
G4endl;
267 G4double err = 1., errmax = 0.00001;
268 G4int iter = 0 , itermax = 10;
269 while (err > errmax && iter < itermax) {
276 err = std::abs(dE)/Energy;
278 if (iter == itermax) {
280 <<
"\n ---> warning: RunAction::GetEnergyFromCSDARange() did not converge"
282 <<
" Energy = " <<
G4BestUnit(Energy,
"Energy")
284 <<
" iter = " << iter <<
G4endl;
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