Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistoManager Class Reference

#include <HistoManager.hh>

Public Member Functions

 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void Book ()
 
void Save ()
 
void FillHisto (G4int id, G4double e, G4double weight=1.0)
 
void Normalize (G4int id, G4double fac)
 
void FillNtuple (G4double EnergyAbs, G4double EnergyGap, G4double TrackLAbs, G4double TrackLGap)
 
void PrintStatistic ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void Book ()
 
void Save ()
 
void FillHisto (G4int id, G4double bin, G4double weight=1.0)
 
void Normalize (G4int id, G4double fac)
 
void FillNtuple (G4double energyAbs, G4double energyGap, G4double trackLAbs, G4double trackLGap)
 
void PrintStatistic ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void Book ()
 
void Save ()
 
void FillHisto (G4int id, G4double bin, G4double weight=1.0)
 
void Normalize (G4int id, G4double fac)
 
void FillNtuple (G4double EnergyAbs, G4double EnergyGap, G4double TrackLAbs, G4double TrackLGap)
 
void PrintStatistic ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void Book ()
 
void Save ()
 
void SetHisto (G4int, G4int, G4double, G4double, const G4String &unit="none")
 
void FillHisto (G4int id, G4double e, G4double weight=1.0)
 
void Normalize (G4int id, G4double fac)
 
void PrintHisto (G4int)
 
void SetFileName (const G4String &name)
 
G4bool HistoExist (G4int id)
 
G4String GetTitle (G4int id)
 
G4int GetNbins (G4int id)
 
G4double GetVmin (G4int id)
 
G4double GetVmax (G4int id)
 
G4double GetHistoUnit (G4int id)
 
G4double GetBinWidth (G4int id)
 
G4int GetHistoID (G4int id)
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 ~HistoManager ()
 
void BookHisto ()
 
void BeginOfRun ()
 
void EndOfRun (G4int runID)
 
void BeginOfEvent ()
 
void EndOfEvent ()
 
void ScoreNewTrack (const G4Track *aTrack)
 
void AddEnergy (G4double edep, G4int idx, G4int copyNo)
 
void AddDeltaElectron (const G4DynamicParticle *)
 
void AddPhoton (const G4DynamicParticle *)
 
void ResetTrackLength ()
 
void AddPositron (const G4DynamicParticle *)
 
void SetVerbose (G4int val)
 
G4int GetVerbose () const
 
void SetHistoNumber (G4int val)
 
void SetFirstEventToDebug (G4int val)
 
G4int FirstEventToDebug () const
 
void SetLastEventToDebug (G4int val)
 
G4int LastEventToDebug () const
 
void SetMaxEnergy (G4double val)
 
G4double GetMaxEnergy () const
 
void AddStep ()
 
void SetBeamEnergy (G4double val)
 
void SetEdepAndRMS (G4int, G4ThreeVector)
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void BeginOfRun ()
 
void EndOfRun ()
 
void SetVerbose (G4int val)
 
void SetParticleName (const G4String &)
 
void SetElementName (const G4String &)
 
void SetNumberOfBinsE (G4int val)
 
void SetNumberOfBinsP (G4int val)
 
void SetMinKinEnergy (G4double val)
 
void SetMaxKinEnergy (G4double val)
 
void SetMinMomentum (G4double val)
 
void SetMaxMomentum (G4double val)
 
void SetHistoName (G4String &val)
 
void SetTargetMaterial (const G4Material *p)
 
 ~HistoManager ()
 
void BookHisto ()
 
void BeginOfRun ()
 
void EndOfRun ()
 
void BeginOfEvent ()
 
void EndOfEvent ()
 
void Fill (G4int id, G4double x, G4double w)
 
void ScoreNewTrack (const G4Track *)
 
void AddTargetStep (const G4Step *)
 
void AddLeakingParticle (const G4Track *)
 
void SetVerbose (G4int val)
 
void SetTargetLength (G4double val)
 
void SetNumberOfSlices (G4int val)
 
void SetNumberOfBinsE (G4int val)
 
void SetDefaultBeamPositionFlag (G4bool f)
 
void SetMaxEnergyDeposit (G4double val)
 
G4double Length () const
 
G4bool DefaultBeamPosition () const
 
G4int NumberOfSlices () const
 
G4int GetVerbose () const
 
 ~HistoManager ()
 
void BookHisto ()
 
void BeginOfRun ()
 
void EndOfRun ()
 
void BeginOfEvent ()
 
void EndOfEvent ()
 
void Fill (G4int id, G4double x, G4double w)
 
void ScoreNewTrack (const G4Track *)
 
void AddTargetStep (const G4Step *)
 
void SetVerbose (G4int val)
 
void SetIonPhysics (const G4String &)
 
void SetTargetMaterial (const G4Material *mat)
 
void SetTargetLength (G4double val)
 
void SetNumberOfSlices (G4int val)
 
void SetNumberOfBinsE (G4int val)
 
G4double Length () const
 
G4int NumberOfSlices () const
 
G4int GetVerbose () const
 
void SetDefaultBeamPositionFlag (G4bool f)
 
G4bool DefaultBeamPosition () const
 
void SetMaxEnergyDeposit (G4double val)
 
void SetPhysicsList (G4VModularPhysicsList *p)
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
void BeginOfRun ()
 
void EndOfRun ()
 
void SetVerbose (G4int val)
 
void SetParticleName (const G4String &)
 
void SetElementName (const G4String &)
 
void SetNumberOfBinsE (G4int val)
 
void SetNumberOfBinsP (G4int val)
 
void SetMinKinEnergy (G4double val)
 
void SetMaxKinEnergy (G4double val)
 
void SetMinMomentum (G4double val)
 
void SetMaxMomentum (G4double val)
 
void SetHistoName (G4String &val)
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 
 HistoManager ()
 
 ~HistoManager ()
 

Static Public Member Functions

static HistoManagerGetPointer ()
 
static HistoManagerGetPointer ()
 
static HistoManagerGetPointer ()
 

Detailed Description

Definition at line 44 of file HistoManager.hh.

Constructor & Destructor Documentation

HistoManager::HistoManager ( )

Definition at line 39 of file HistoManager.cc.

40  : fFileName("amsEcal")
41 {
42  Book();
43 }

Here is the caller graph for this function:

HistoManager::~HistoManager ( )

Definition at line 47 of file HistoManager.cc.

48 {
49  delete G4AnalysisManager::Instance();
50 }
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )
HistoManager::HistoManager ( )
HistoManager::~HistoManager ( )

Member Function Documentation

void HistoManager::AddDeltaElectron ( const G4DynamicParticle elec)

Definition at line 526 of file HistoManager.cc.

527 {
528  G4double e = elec->GetKineticEnergy()/MeV;
529  if(e > 0.0) fElec++;
530  fHisto->Fill(3,e,1.0);
531 }
G4double GetKineticEnergy() const
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void HistoManager::AddEnergy ( G4double  edep,
G4int  idx,
G4int  copyNo 
)

Definition at line 487 of file HistoManager.cc.

488 {
489  if(1 < fVerbose) {
490  G4cout << "HistoManager::AddEnergy: e(keV)= " << edep/keV
491  << "; volIdx= " << volIndex
492  << "; copyNo= " << copyNo
493  << G4endl;
494  }
495  if(0 == volIndex) {
496  fE[copyNo] += edep;
497  } else if (1 == volIndex) {
498  fEabs1 += edep;
499  } else if (2 == volIndex) {
500  fEabs2 += edep;
501  } else if (3 == volIndex) {
502  fEabs3 += edep;
503  } else if (4 == volIndex) {
504  fEabs4 += edep;
505  } else if (5 == volIndex) {
506  G4int n = fNvertex.size();
507  G4bool newPad = true;
508  if (n > 0) {
509  for(G4int i=0; i<n; i++) {
510  if (copyNo == fNvertex[i]) {
511  newPad = false;
512  fEvertex[i] += edep;
513  break;
514  }
515  }
516  }
517  if(newPad) {
518  fNvertex.push_back(copyNo);
519  fEvertex.push_back(edep);
520  }
521  }
522 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
const G4int n
#define G4endl
Definition: G4ios.hh:61
static constexpr double keV
Definition: G4SIunits.hh:216
void HistoManager::AddLeakingParticle ( const G4Track track)

Definition at line 462 of file HistoManager.cc.

463 {
464  const G4ParticleDefinition* pd = track->GetDefinition();
465  G4double e = std::log10(track->GetKineticEnergy()/MeV);
466 
467  G4ThreeVector pos = track->GetPosition();
468  G4ThreeVector dir = track->GetMomentumDirection();
469  G4double x = pos.x();
470  G4double y = pos.y();
471  G4double z = pos.z();
472 
473  G4bool isLeaking = false;
474 
475  // Forward
476  if(z > -fAbsZ0 && dir.z() > 0.0) {
477  isLeaking = true;
478  if(pd == fNeutron) {
479  ++fNneu_forw;
480  fHisto->Fill(15,e,1.0);
481  } else isLeaking = true;
482 
483  // Backward
484  } else if (z < fAbsZ0 && dir.z() < 0.0) {
485  isLeaking = true;
486  if(pd == fNeutron) {
487  ++fNneu_back;
488  fHisto->Fill(16,e,1.0);
489  } else isLeaking = true;
490 
491  // Side
492  } else if (std::abs(z) <= -fAbsZ0 && x*dir.x() + y*dir.y() > 0.0) {
493  isLeaking = true;
494  if(pd == fNeutron) {
495  ++fNneu_leak;
496  fHisto->Fill(14,e,1.0);
497  } else isLeaking = true;
498  }
499 
500  // protons and pions
501  if(isLeaking) {
502  if(pd == G4Proton::Proton()) {
503  fHisto->Fill(17,e,1.0);
504  ++fNprot_leak;
505  } else if (pd == G4PionPlus::PionPlus() ||
506  pd == G4PionMinus::PionMinus()) {
507  fHisto->Fill(18,e,1.0);
508  ++fNpiofNleak;
509  }
510  }
511 }
G4ParticleDefinition * GetDefinition() const
double x() const
const G4ThreeVector & GetPosition() const
tuple x
Definition: test.py:50
double z() const
G4double GetKineticEnergy() const
bool G4bool
Definition: G4Types.hh:79
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
const G4ThreeVector & GetMomentumDirection() const
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
double y() const
tuple z
Definition: test.py:28
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
static const G4double pos

Here is the call graph for this function:

Here is the caller graph for this function:

void HistoManager::AddPhoton ( const G4DynamicParticle ph)

Definition at line 535 of file HistoManager.cc.

536 {
537  G4double e = ph->GetKineticEnergy()/MeV;
538  if(e > 0.0) fGam++;
539  fHisto->Fill(4,e,1.0);
540 }
G4double GetKineticEnergy() const
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

void HistoManager::AddPositron ( const G4DynamicParticle )
inline

Definition at line 94 of file HistoManager.hh.

94 {++fPosit;};

Here is the caller graph for this function:

void HistoManager::AddStep ( )
inline

Definition at line 106 of file HistoManager.hh.

106 {fStep += 1.0;};
void HistoManager::AddTargetStep ( const G4Step )
void HistoManager::AddTargetStep ( const G4Step step)

Definition at line 413 of file HistoManager.cc.

414 {
415  fNstep++;
416  G4double fEdep = step->GetTotalEnergyDeposit();
417  if(1 < fVerbose) {
418  G4cout << "TargetSD::ProcessHits: beta1= "
419  << step->GetPreStepPoint()->GetVelocity()/c_light
420  << " beta2= " << step->GetPostStepPoint()->GetVelocity()/c_light
421  << " weight= " << step->GetTrack()->GetWeight()
422  << G4endl;
423  }
424  if(fEdep >= DBL_MIN) {
425  const G4Track* track = step->GetTrack();
426 
427  G4ThreeVector pos =
428  (step->GetPreStepPoint()->GetPosition() +
429  step->GetPostStepPoint()->GetPosition())*0.5;
430 
431  G4double z = pos.z() - fAbsZ0;
432 
433  // scoring
434  fEdepEvt += fEdep;
435  fHisto->Fill(0,z,fEdep);
436  const G4ParticleDefinition* pd = track->GetDefinition();
437 
438  if(pd == G4Gamma::Gamma() || pd == G4Electron::Electron()
439  || pd == G4Positron::Positron()) {
440  fEdepEM += fEdep;
441  } else if ( pd == G4PionPlus::PionPlus() ||
442  pd == G4PionMinus::PionMinus()) {
443  fEdepPI += fEdep;
444  } else if ( pd == G4Proton::Proton() ||
445  pd == G4AntiProton::AntiProton()) {
446  fEdepP += fEdep;
447  }
448 
449  if(1 < fVerbose) {
450  G4cout << "HistoManager::AddEnergy: e(keV)= " << fEdep/keV
451  << "; z(mm)= " << z/mm
452  << "; step(mm)= " << step->GetStepLength()/mm
453  << " by " << pd->GetParticleName()
454  << " E(MeV)= " << track->GetKineticEnergy()/MeV
455  << G4endl;
456  }
457  }
458 }
G4ParticleDefinition * GetDefinition() const
static constexpr double mm
Definition: G4SIunits.hh:115
G4double GetStepLength() const
G4double GetVelocity() const
const G4String & GetParticleName() const
double z() const
G4StepPoint * GetPreStepPoint() const
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetPosition() const
static G4AntiProton * AntiProton()
Definition: G4AntiProton.cc:93
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double GetTotalEnergyDeposit() const
static G4Positron * Positron()
Definition: G4Positron.cc:94
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
G4StepPoint * GetPostStepPoint() const
#define DBL_MIN
Definition: templates.hh:75
tuple z
Definition: test.py:28
G4double GetWeight() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
static constexpr double keV
Definition: G4SIunits.hh:216
float c_light
Definition: hepunit.py:257
static const G4double pos

Here is the call graph for this function:

void HistoManager::BeginOfEvent ( )
void HistoManager::BeginOfEvent ( )
void HistoManager::BeginOfEvent ( )

Definition at line 309 of file HistoManager.cc.

310 {
311  ++fEvt;
312 
313  fEabs1 = 0.0;
314  fEabs2 = 0.0;
315  fEabs3 = 0.0;
316  fEabs4 = 0.0;
317  fEvertex.clear();
318  fNvertex.clear();
319  for (G4int i=0; i<25; i++) {
320  fE[i] = 0.0;
321  }
322 }
int G4int
Definition: G4Types.hh:78
void HistoManager::BeginOfRun ( )
void HistoManager::BeginOfRun ( )
void HistoManager::BeginOfRun ( )
void HistoManager::BeginOfRun ( )

Definition at line 129 of file HistoManager.cc.

130 {
131  // initilise scoring
132  fEvt = 0;
133  fElec = 0;
134  fPosit= 0;
135  fGam = 0;
136  fStep = 0;
137  fLowe = 0;
138 
139  for(G4int i=0; i<6; i++) {
140  fStat[i] = 0;
141  fEdep[i] = 0.0;
142  fErms[i] = 0.0;
143  if(i < 3) {
144  fEdeptr[i] = 0.0;
145  fErmstr[i] = 0.0;
146  }
147  }
148 
149  // initialise counters
150  fBrem.resize(93,0.0);
151  fPhot.resize(93,0.0);
152  fComp.resize(93,0.0);
153  fConv.resize(93,0.0);
154 
155  // initialise acceptance - by default is not applied
156  for(G4int i=0; i<fNmax; i++) {
157  fEdeptrue[i] = 1.0;
158  fRmstrue[i] = 1.0;
159  fLimittrue[i]= 10.;
160  }
161 
162  if(fHisto->IsActive()) {
163  for(G4int i=0; i<fNHisto; ++i) {fHisto->Activate(i, true); }
164  fHisto->Book();
165 
166  if(fVerbose > 0) {
167  G4cout << "HistoManager: Histograms are booked and run has been started"
168  << G4endl;
169  }
170  }
171 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void HistoManager::BeginOfRun ( )
void HistoManager::Book ( )
void HistoManager::Book ( )
void HistoManager::Book ( )
void HistoManager::Book ( )
void HistoManager::BookHisto ( )
void HistoManager::BookHisto ( )

Definition at line 109 of file HistoManager.cc.

110 {
111  fHisto->Add1D("10","Evis/E0 in central crystal",fBinsED,0.0,1,1.0);
112  fHisto->Add1D("11","Evis/E0 in 3x3",fBinsED,0.0,1.0,1.0);
113  fHisto->Add1D("12","Evis/E0 in 5x5",fBinsED,0.0,1.0,1.0);
114  fHisto->Add1D("13","Energy (MeV) of delta-electrons",
115  fBinsE,0.0,fMaxEnergy,MeV);
116  fHisto->Add1D("14","Energy (MeV) of gammas",fBinsE,0.0,fMaxEnergy,MeV);
117  fHisto->Add1D("15","Energy (MeV) in abs1",fBinsEA,0.0,fMaxEnergyAbs,MeV);
118  fHisto->Add1D("16","Energy (MeV) in abs2",fBinsEA,0.0,fMaxEnergyAbs,MeV);
119  fHisto->Add1D("17","Energy (MeV) in abs3",fBinsEA,0.0,fMaxEnergyAbs,MeV);
120  fHisto->Add1D("18","Energy (MeV) in abs4",fBinsEA,0.0,fMaxEnergyAbs,MeV);
121  fHisto->Add1D("19","Number of vertex hits",20,-0.5,19.5,1.0);
122  fHisto->Add1D("20","E1/E9 Ratio",fBinsED,0.0,1,1.0);
123  fHisto->Add1D("21","E1/E25 Ratio",fBinsED,0.0,1.0,1.0);
124  fHisto->Add1D("22","E9/E25 Ratio",fBinsED,0.0,1.0,1.0);
125 }
static constexpr double MeV
Definition: G4SIunits.hh:214
void HistoManager::BookHisto ( )
G4bool HistoManager::DefaultBeamPosition ( ) const
inline

Definition at line 97 of file HistoManager.hh.

97 {return fBeamFlag;};
G4bool HistoManager::DefaultBeamPosition ( ) const
inline

Definition at line 101 of file HistoManager.hh.

101 {return fBeamFlag;};
void HistoManager::EndOfEvent ( )
void HistoManager::EndOfEvent ( )
void HistoManager::EndOfEvent ( )

Definition at line 326 of file HistoManager.cc.

327 {
328  G4double e9 = 0.0;
329  G4double e25= 0.0;
330  for (G4int i=0; i<25; i++) {
331  fE[i] /= fBeamEnergy;
332  e25 += fE[i];
333  if( ( 6<=i && 8>=i) || (11<=i && 13>=i) || (16<=i && 18>=i)) e9 += fE[i];
334  }
335 
336  if(1 < fVerbose && e25 < 0.8) {
337  ++fLowe;
338  G4cout << "### in the event# " << fEvt << " E25= " << e25 << G4endl;
339  }
340 
341  // compute ratios
342  G4double e0 = fE[12];
343  G4double e19 = 0.0;
344  G4double e125 = 0.0;
345  G4double e925 = 0.0;
346  if(e9 > 0.0) {
347  e19 = e0/e9;
348  e125 = e0/e25;
349  e925 = e9/e25;
350  fEdep[3] += e19;
351  fErms[3] += e19*e19;
352  fEdep[4] += e125;
353  fErms[4] += e125*e125;
354  fEdep[5] += e925;
355  fErms[5] += e925*e925;
356  fStat[3] += 1;
357  fStat[4] += 1;
358  fStat[5] += 1;
359  }
360 
361  // Fill histo
362  fHisto->Fill(0,e0,1.0);
363  fHisto->Fill(1,e9,1.0);
364  fHisto->Fill(2,e25,1.0);
365  fHisto->Fill(5,fEabs1,1.0);
366  fHisto->Fill(6,fEabs2,1.0);
367  fHisto->Fill(7,fEabs3,1.0);
368  fHisto->Fill(8,fEabs4,1.0);
369  fHisto->Fill(9,G4double(fNvertex.size()),1.0);
370  fHisto->Fill(10,e19,1.0);
371  fHisto->Fill(11,e125,1.0);
372  fHisto->Fill(12,e925,1.0);
373 
374  // compute sums
375  fEdep[0] += e0;
376  fErms[0] += e0*e0;
377  fEdep[1] += e9;
378  fErms[1] += e9*e9;
379  fEdep[2] += e25;
380  fErms[2] += e25*e25;
381 
382  // trancated mean
383  if(std::abs(e0-fEdeptrue[0])<fRmstrue[0]*fLimittrue[0]) {
384  fStat[0] += 1;
385  fEdeptr[0] += e0;
386  fErmstr[0] += e0*e0;
387  }
388  if(std::abs(e9-fEdeptrue[1])<fRmstrue[1]*fLimittrue[1]) {
389  fStat[1] += 1;
390  fEdeptr[1] += e9;
391  fErmstr[1] += e9*e9;
392  }
393  if(std::abs(e25-fEdeptrue[2])<fRmstrue[2]*fLimittrue[2]) {
394  fStat[2] += 1;
395  fEdeptr[2] += e25;
396  fErmstr[2] += e25*e25;
397  }
398 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void HistoManager::EndOfRun ( )

Definition at line 145 of file HistoManager.cc.

146 {
147  if(fVerbose > 0) {
148  G4cout << "HistoManager: End of run actions are started" << G4endl;
149  }
150 
151  const G4Element* elm =
153  const G4Material* mat =
154  G4NistManager::Instance()->FindOrBuildMaterial("G4_"+fElementName);
155  const G4ParticleDefinition* particle =
157 
158  G4cout << "### Fill Cross Sections for " << fParticleName
159  << " off " << fElementName
160  << G4endl;
161  if(fVerbose > 0) {
162  G4cout << "-------------------------------------------------------------"
163  << G4endl;
164  G4cout << " N E(MeV) Elastic(b) Inelastic(b)";
165  if(particle == fNeutron) { G4cout << " Capture(b) Fission(b)"; }
166  G4cout << " Total(b)" << G4endl;
167  G4cout << "-------------------------------------------------------------"
168  << G4endl;
169  }
170  if(!particle || !elm) {
171  G4cout << "HistoManager WARNING Particle or element undefined" << G4endl;
172  return;
173  }
174 
175  G4int prec = G4cout.precision();
176  G4cout.precision(4);
177 
179  G4double mass = particle->GetPDGMass();
180 
181  // Build histograms
182 
183  G4double p1 = std::log10(fMinMomentum/GeV);
184  G4double p2 = std::log10(fMaxMomentum/GeV);
185  G4double e1 = std::log10(fMinKinEnergy/MeV);
186  G4double e2 = std::log10(fMaxKinEnergy/MeV);
187  G4double de = (e2 - e1)/G4double(fBinsE);
188  G4double dp = (p2 - p1)/G4double(fBinsP);
189 
190  G4double x = e1 - de*0.5;
191  G4double e, p, xs, xtot;
192  G4int i;
193 
194  G4double coeff = 1.0;
195  if(fTargetMaterial) { coeff = fTargetMaterial->GetDensity()*cm2/g; }
196 
197  for(i=0; i<fBinsE; i++) {
198  x += de;
199  e = std::pow(10.,x)*MeV;
200  if(fVerbose>0) G4cout << std::setw(5) << i << std::setw(12) << e;
201  xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
202  xtot = xs;
203  if(fVerbose>0) G4cout << std::setw(12) << xs/barn;
204  fAnalysisManager->FillH1(2, x, xs/barn);
205  xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
206  xtot += xs;
207  if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
208  fAnalysisManager->FillH1(4, x, xs/barn);
209  if(fTargetMaterial) {
210  xs =
211  store->GetInelasticCrossSectionPerVolume(particle,e,fTargetMaterial);
212  fAnalysisManager->FillH1(9, x, xs/coeff);
213  xs =
214  store->GetElasticCrossSectionPerVolume(particle,e,fTargetMaterial);
215  fAnalysisManager->FillH1(10, x, xs/coeff);
216  }
217  if(particle == fNeutron) {
218  xs = store->GetCaptureCrossSectionPerAtom(particle,e,elm,mat);
219  xtot += xs;
220  if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
221  fAnalysisManager->FillH1(5, x, xs/barn);
222  xs = store->GetFissionCrossSectionPerAtom(particle,e,elm,mat);
223  xtot += xs;
224  if(fVerbose>0) G4cout << " " << std::setw(12) << xs/barn;
225  fAnalysisManager->FillH1(6, x, xs/barn);
226  }
227  xs = store->GetChargeExchangeCrossSectionPerAtom(particle,e,elm,mat);
228  if(fVerbose>0) G4cout << " " << std::setw(12) << xtot/barn << G4endl;
229  fAnalysisManager->FillH1(7, x, xs/barn);
230  fAnalysisManager->FillH1(8, x, xtot/barn);
231  }
232 
233  x = p1 - dp*0.5;
234  for(i=0; i<fBinsP; i++) {
235  x += dp;
236  p = std::pow(10.,x)*GeV;
237  e = std::sqrt(p*p + mass*mass) - mass;
238  xs = store->GetElasticCrossSectionPerAtom(particle,e,elm,mat);
239  fAnalysisManager->FillH1(1, x, xs/barn);
240  xs = store->GetInelasticCrossSectionPerAtom(particle,e,elm,mat);
241  fAnalysisManager->FillH1(3, x, xs/barn);
242  }
243  if(fVerbose > 0) {
244  G4cout << "-------------------------------------------------------------"
245  << G4endl;
246  }
247  G4cout.precision(prec);
248  fAnalysisManager->Write();
249  fAnalysisManager->CloseFile();
250 
251  G4bool extra = true;
252  if(fTargetMaterial && extra) {
253  G4double E= 5*GeV;
254  G4double cross =
255  store->GetInelasticCrossSectionPerVolume(particle,E,fTargetMaterial);
256  if(cross <= 0.0) { cross = 1.e-100; }
257  G4cout << "### " << particle->GetParticleName() << " " << E/GeV
258  << " GeV on " << fTargetMaterial->GetName()
259  << " xs/X0= " << 1.0/(cross*fTargetMaterial->GetRadlen()) << G4endl;
260  }
261  delete fAnalysisManager;
262 }
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static constexpr double cm2
Definition: G4SIunits.hh:120
static G4HadronicProcessStore * Instance()
G4double GetElasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
const char * p
Definition: xmltok.h:285
const G4String & GetName() const
Definition: G4Material.hh:178
G4double GetDensity() const
Definition: G4Material.hh:180
tuple x
Definition: test.py:50
G4double GetFissionCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
const G4String & GetParticleName() const
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
static const double prec
Definition: RanecuEngine.cc:58
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
G4double GetInelasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
G4double GetChargeExchangeCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
G4double GetRadlen() const
Definition: G4Material.hh:220
G4double GetPDGMass() const
static G4ParticleTable * GetParticleTable()
static constexpr double GeV
Definition: G4SIunits.hh:217
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
G4double GetElasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
double G4double
Definition: G4Types.hh:76
G4double GetInelasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
static constexpr double barn
Definition: G4SIunits.hh:105
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
G4double GetCaptureCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)

Here is the call graph for this function:

void HistoManager::EndOfRun ( )
void HistoManager::EndOfRun ( )
void HistoManager::EndOfRun ( G4int  runID)

Definition at line 175 of file HistoManager.cc.

176 {
177 
178  G4cout << "HistoManager: End of run actions are started RunID# "
179  << runID << G4endl;
180  G4String nam[6] = {"1x1", "3x3", "5x5", "E1/E9 ", "E1/E25", "E9/E25"};
181 
182  // average
183 
184  G4cout<<"================================================================="
185  <<G4endl;
186  G4double x = (G4double)fEvt;
187  if(fEvt > 0) x = 1.0/x;
188  G4int j;
189  for(j=0; j<fNmax; j++) {
190 
191  // total mean
192  fEdep[j] *= x;
193  G4double y = fErms[j]*x - fEdep[j]*fEdep[j];
194  if(y < 0.0) y = 0.0;
195  fErms[j] = std::sqrt(y);
196 
197  // trancated mean
198  G4double xx = G4double(fStat[j]);
199  if(xx > 0.0) xx = 1.0/xx;
200  fEdeptr[j] *= xx;
201  y = fErmstr[j]*xx - fEdeptr[j]*fEdeptr[j];
202  if(y < 0.0) y = 0.0;
203  fErmstr[j] = std::sqrt(y);
204  }
205  G4double xe = x*(G4double)fElec;
206  G4double xg = x*(G4double)fGam;
207  G4double xp = x*(G4double)fPosit;
208  G4double xs = x*fStep;
209 
210  G4double f = 100.*std::sqrt(fBeamEnergy/GeV);
211 
212  G4cout << "Number of events " << fEvt <<G4endl;
213  G4cout << std::setprecision(4) << "Average number of e- " << xe << G4endl;
214  G4cout << std::setprecision(4) << "Average number of gamma " << xg << G4endl;
215  G4cout << std::setprecision(4) << "Average number of e+ " << xp << G4endl;
216  G4cout << std::setprecision(4) << "Average number of steps " << xs << G4endl;
217 
218  for(j=0; j<3; j++) {
219  G4double ex = fEdeptr[j];
220  G4double sx = fErmstr[j];
221  G4double xx= G4double(fStat[j]);
222  if(xx > 0.0) xx = 1.0/xx;
223  G4double r = sx*std::sqrt(xx);
224  G4cout << std::setprecision(4) << "Edep " << nam[j]
225  << " = " << ex
226  << " +- " << r;
227  if(ex > 0.1) G4cout << " res= " << f*sx/ex << " % " << fStat[j];
228  G4cout << G4endl;
229  }
230  if(fLimittrue[0] < 10. || fLimittrue[1] < 10. || fLimittrue[2] < 10.) {
231  G4cout
232  <<"=========== Mean values without trancating ====================="<<G4endl;
233  for(j=0; j<fNmax; j++) {
234  G4double ex = fEdep[j];
235  G4double sx = fErms[j];
236  G4double rx = sx*std::sqrt(x);
237  G4cout << std::setprecision(4) << "Edep " << nam[j]
238  << " = " << ex
239  << " +- " << rx;
240  if(ex > 0.0) G4cout << " res= " << f*sx/ex << " %";
241  G4cout << G4endl;
242  }
243  }
244  G4cout
245  <<"=========== Ratios without trancating ==========================="<<G4endl;
246  for(j=3; j<6; j++) {
247  G4double e = fEdep[j];
248  G4double xx= G4double(fStat[j]);
249  if(xx > 0.0) xx = 1.0/xx;
250  e *= xx;
251  G4double y = fErms[j]*xx - e*e;
252  G4double r = 0.0;
253  if(y > 0.0) r = std::sqrt(y*xx);
254  G4cout << " " << nam[j] << " = " << e
255  << " +- " << r;
256  G4cout << G4endl;
257  }
258  G4cout << std::setprecision(4) << "Beam Energy " << fBeamEnergy/GeV
259  << " GeV" << G4endl;
260  if(fLowe > 0) G4cout << "Number of events E/E0<0.8 " << fLowe << G4endl;
261  G4cout
262  <<"=================================================================="<<G4endl;
263  G4cout<<G4endl;
264 
265  // normalise histograms
266  if(fHisto->IsActive()) {
267  for(G4int i=0; i<fNHisto; i++) {
268  fHisto->ScaleH1(i,x);
269  }
270  fHisto->Save();
271  }
272  if(0 < runID) { return; }
273 
274  // Acceptance only for the first run
275  EmAcceptance acc;
276  G4bool isStarted = false;
277  for (j=0; j<fNmax; j++) {
278 
279  G4double ltrue = fLimittrue[j];
280  if (ltrue < DBL_MAX) {
281  if (!isStarted) {
282  acc.BeginOfAcceptance("Crystal Calorimeter",fEvt);
283  isStarted = true;
284  }
285  G4double etrue = fEdeptrue[j];
286  G4double rtrue = fRmstrue[j];
287  acc.EmAcceptanceGauss("Edep"+nam[j],fEvt,fEdeptr[j],etrue,rtrue,ltrue);
288  acc.EmAcceptanceGauss("Erms"+nam[j],fEvt,fErmstr[j],rtrue,rtrue,2.0*ltrue);
289  }
290  }
291  if(isStarted) acc.EndOfAcceptance();
292 
293  // atom frequency
294  G4cout << " Z bremsstrahlung photoeffect compton conversion" << G4endl;
295  for(j=1; j<93; ++j) {
296  G4int n1 = G4int(fBrem[j]*x);
297  G4int n2 = G4int(fPhot[j]*x);
298  G4int n3 = G4int(fComp[j]*x);
299  G4int n4 = G4int(fConv[j]*x);
300  if(n1 + n2 + n3 + n4 > 0) {
301  G4cout << std::setw(4) << j << std::setw(12) << n1 << std::setw(12) << n2
302  << std::setw(12) << n3 << std::setw(12) << n4 << G4endl;
303  }
304  }
305 }
void EmAcceptanceGauss(const G4String &title, G4int stat, G4double avr, G4double avr0, G4double rms, G4double limit)
Definition: EmAcceptance.cc:68
tuple x
Definition: test.py:50
void BeginOfAcceptance(const G4String &title, G4int stat)
Definition: EmAcceptance.cc:49
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void EndOfAcceptance()
Definition: EmAcceptance.cc:58
bool G4bool
Definition: G4Types.hh:79
static constexpr double GeV
Definition: G4SIunits.hh:217
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83

Here is the call graph for this function:

void HistoManager::EndOfRun ( )
void HistoManager::Fill ( G4int  id,
G4double  x,
G4double  w 
)
void HistoManager::Fill ( G4int  id,
G4double  x,
G4double  w 
)

Definition at line 523 of file HistoManager.cc.

524 {
525  fHisto->Fill(id, x, w);
526 }
tuple x
Definition: test.py:50
void HistoManager::FillHisto ( G4int  id,
G4double  e,
G4double  weight = 1.0 
)

Definition at line 131 of file HistoManager.cc.

132 {
133  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
134  analysisManager->FillH1(ih, xbin, weight);
135 }
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
void HistoManager::FillHisto ( G4int  id,
G4double  bin,
G4double  weight = 1.0 
)
void HistoManager::FillHisto ( G4int  id,
G4double  e,
G4double  weight = 1.0 
)
void HistoManager::FillHisto ( G4int  id,
G4double  bin,
G4double  weight = 1.0 
)
void HistoManager::FillNtuple ( G4double  EnergyAbs,
G4double  EnergyGap,
G4double  TrackLAbs,
G4double  TrackLGap 
)

Definition at line 148 of file HistoManager.cc.

150 {
151  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
152  // Fill 1st ntuple ( id = 0)
153  analysisManager->FillNtupleDColumn(0, 0, energyAbs);
154  analysisManager->FillNtupleDColumn(0, 1, energyGap);
155  analysisManager->AddNtupleRow(0);
156  // Fill 2nd ntuple ( id = 1)
157  analysisManager->FillNtupleDColumn(1, 0, trackLAbs);
158  analysisManager->FillNtupleDColumn(1, 1, trackLGap);
159  analysisManager->AddNtupleRow(1);
160 }
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
void HistoManager::FillNtuple ( G4double  energyAbs,
G4double  energyGap,
G4double  trackLAbs,
G4double  trackLGap 
)
void HistoManager::FillNtuple ( G4double  EnergyAbs,
G4double  EnergyGap,
G4double  TrackLAbs,
G4double  TrackLGap 
)
G4int HistoManager::FirstEventToDebug ( ) const
inline

Definition at line 100 of file HistoManager.hh.

100 {return fEvt1;};
G4double HistoManager::GetBinWidth ( G4int  id)
inline

Definition at line 70 of file HistoManager.hh.

70 {return fWidth[id];}
G4int HistoManager::GetHistoID ( G4int  id)
inline

Definition at line 71 of file HistoManager.hh.

71 {return fHistId[id];}
G4double HistoManager::GetHistoUnit ( G4int  id)
inline

Definition at line 69 of file HistoManager.hh.

69 {return fUnit[id];}
G4double HistoManager::GetMaxEnergy ( ) const
inline

Definition at line 105 of file HistoManager.hh.

105 {return fMaxEnergy;};
G4int HistoManager::GetNbins ( G4int  id)
inline

Definition at line 66 of file HistoManager.hh.

66 {return fNbins[id];}
static HistoManager* HistoManager::GetPointer ( )
static
HistoManager * HistoManager::GetPointer ( )
static

Definition at line 64 of file HistoManager.cc.

65 {
66  if(!fManager) {
67  fManager = new HistoManager();
68  }
69  return fManager;
70 }

Here is the call graph for this function:

Here is the caller graph for this function:

static HistoManager* HistoManager::GetPointer ( )
static
G4String HistoManager::GetTitle ( G4int  id)
inline

Definition at line 65 of file HistoManager.hh.

65 {return fTitle[id];}
G4int HistoManager::GetVerbose ( ) const
inline

Definition at line 94 of file HistoManager.hh.

94 {return fVerbose;};
G4int HistoManager::GetVerbose ( ) const
inline

Definition at line 96 of file HistoManager.hh.

96 {return fVerbose;};
G4int HistoManager::GetVerbose ( ) const
inline

Definition at line 103 of file HistoManager.hh.

103 {return fVerbose;};
G4double HistoManager::GetVmax ( G4int  id)
inline

Definition at line 68 of file HistoManager.hh.

68 {return fVmax[id];}
G4double HistoManager::GetVmin ( G4int  id)
inline

Definition at line 67 of file HistoManager.hh.

67 {return fVmin[id];}
G4bool HistoManager::HistoExist ( G4int  id)
inline

Definition at line 64 of file HistoManager.hh.

64 {return fExist[id];}
G4int HistoManager::LastEventToDebug ( ) const
inline

Definition at line 102 of file HistoManager.hh.

102 {return fEvt2;};
G4double HistoManager::Length ( ) const
inline

Definition at line 91 of file HistoManager.hh.

91 {return fLength;};
G4double HistoManager::Length ( ) const
inline

Definition at line 100 of file HistoManager.hh.

100 {return fLength;};
void HistoManager::Normalize ( G4int  id,
G4double  fac 
)

Definition at line 139 of file HistoManager.cc.

140 {
141  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
142  G4H1* h1 = analysisManager->GetH1(ih);
143  if (h1) h1->scale(fac);
144 }
tools::histo::h1d G4H1
Definition: g4csv_defs.hh:46
static const G4double fac
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
void HistoManager::Normalize ( G4int  id,
G4double  fac 
)
void HistoManager::Normalize ( G4int  id,
G4double  fac 
)
void HistoManager::Normalize ( G4int  id,
G4double  fac 
)
G4int HistoManager::NumberOfSlices ( ) const
inline

Definition at line 92 of file HistoManager.hh.

92 {return fNSlices;};
G4int HistoManager::NumberOfSlices ( ) const
inline

Definition at line 102 of file HistoManager.hh.

102 {return fNSlices;};
void HistoManager::PrintHisto ( G4int  ih)

Definition at line 211 of file HistoManager.cc.

212 {
213  if (ih < kMaxHisto) { fAscii[ih] = true; fAscii[0] = true; }
214  else
215  G4cout << "---> warning from HistoManager::PrintHisto() : histo " << ih
216  << "does not exist" << G4endl;
217 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4int kMaxHisto
Definition: HistoManager.hh:46

Here is the caller graph for this function:

void HistoManager::PrintStatistic ( )

Definition at line 164 of file HistoManager.cc.

165 {
166  if (! fFactoryOn) return;
167 
168  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
169 
170  G4cout << "\n ----> print histograms statistic \n" << G4endl;
171  for ( G4int i=0; i<analysisManager->GetNofH1s(); ++i ) {
172  G4String name = analysisManager->GetH1Name(i);
173  G4H1* h1 = analysisManager->GetH1(i);
174 
175  G4String unitCategory;
176  if (name[0U] == 'E' ) unitCategory = "Energy";
177  if (name[0U] == 'L' ) unitCategory = "Length";
178  // we use an explicit unsigned int type for operator [] argument
179  // to avoid problems with windows compiler
180 
181  G4cout << name
182  << ": mean = " << G4BestUnit(h1->mean(), unitCategory)
183  << " rms = " << G4BestUnit(h1->rms(), unitCategory )
184  << G4endl;
185  }
186 }
const XML_Char * name
Definition: expat.h:151
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
tools::histo::h1d G4H1
Definition: g4csv_defs.hh:46
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
void HistoManager::PrintStatistic ( )
void HistoManager::PrintStatistic ( )
void HistoManager::ResetTrackLength ( )
inline

Definition at line 93 of file HistoManager.hh.

93 {fTrackLength = 0.0, fTrackAbs = true;};

Here is the caller graph for this function:

void HistoManager::Save ( )

Definition at line 115 of file HistoManager.cc.

116 {
117  if (! fFactoryOn) return;
118 
119  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
120  analysisManager->Write();
121  analysisManager->CloseFile();
122 
123  G4cout << "\n----> Histograms and ntuples are saved\n" << G4endl;
124 
125  delete G4AnalysisManager::Instance();
126  fFactoryOn = false;
127 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
void HistoManager::Save ( )
void HistoManager::Save ( )
void HistoManager::Save ( )
void HistoManager::ScoreNewTrack ( const G4Track )
void HistoManager::ScoreNewTrack ( const G4Track aTrack)

Definition at line 402 of file HistoManager.cc.

403 {
404  //Save primary parameters
406  const G4ParticleDefinition* particle = aTrack->GetDefinition();
407  const G4DynamicParticle* dynParticle = aTrack->GetDynamicParticle();
408 
409  G4int pid = aTrack->GetParentID();
410  G4double kinE = dynParticle->GetKineticEnergy();
411  G4ThreeVector pos = aTrack->GetVertexPosition();
412 
413  // primary
414  if(0 == pid) {
415 
416  G4double mass = 0.0;
417  if(particle) {
418  mass = particle->GetPDGMass();
419  }
420 
421  G4ThreeVector dir = dynParticle->GetMomentumDirection();
422  if(1 < fVerbose) {
423  G4cout << "TrackingAction: Primary kinE(MeV)= " << kinE/MeV
424  << "; m(MeV)= " << mass/MeV
425  << "; pos= " << pos << "; dir= " << dir << G4endl;
426  }
427 
428  // secondary
429  } else {
430  const G4VProcess* proc = aTrack->GetCreatorProcess();
431  G4int type = proc->GetProcessSubType();
432  if(type == fBremsstrahlung) {
433  const G4Element* elm =
434  static_cast<const G4VEnergyLossProcess*>(proc)->GetCurrentElement();
435  if(elm) {
436  G4int Z = G4lrint(elm->GetZ());
437  if(Z > 0 && Z < 93) { fBrem[Z] += 1.0; }
438  }
439  } else if(type == fPhotoElectricEffect) {
440  const G4Element* elm =
441  static_cast<const G4VEmProcess*>(proc)->GetCurrentElement();
442  if(elm) {
443  G4int Z = G4lrint(elm->GetZ());
444  if(Z > 0 && Z < 93) { fPhot[Z] += 1.0; }
445  }
446  } else if(type == fGammaConversion) {
447  const G4Element* elm =
448  static_cast<const G4VEmProcess*>(proc)->GetCurrentElement();
449  if(elm) {
450  G4int Z = G4lrint(elm->GetZ());
451  if(Z > 0 && Z < 93) { fConv[Z] += 1.0; }
452  }
453  } else if(type == fComptonScattering) {
454  const G4Element* elm =
455  static_cast<const G4VEmProcess*>(proc)->GetCurrentElement();
456  if(elm) {
457  G4int Z = G4lrint(elm->GetZ());
458  if(Z > 0 && Z < 93) { fComp[Z] += 1.0; }
459  }
460  }
461 
462  // delta-electron
463  if (particle == fElectron) {
464  if(1 < fVerbose) {
465  G4cout << "TrackingAction: Secondary electron " << G4endl;
466  }
467  AddDeltaElectron(dynParticle);
468 
469  } else if (particle == fPositron) {
470  if(1 < fVerbose) {
471  G4cout << "TrackingAction: Secondary positron " << G4endl;
472  }
473  AddPositron(dynParticle);
474 
475  } else if (particle == fGamma) {
476  if(1 < fVerbose) {
477  G4cout << "TrackingAction: Secondary gamma; parentID= " << pid
478  << " E= " << kinE << G4endl;
479  }
480  AddPhoton(dynParticle);
481  }
482  }
483 }
void AddPositron(const G4DynamicParticle *)
Definition: HistoManager.hh:94
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
void AddPhoton(const G4DynamicParticle *)
G4double GetKineticEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetZ() const
Definition: G4Element.hh:131
int G4int
Definition: G4Types.hh:78
const G4VProcess * GetCreatorProcess() const
G4GLOB_DLL std::ostream G4cout
void AddDeltaElectron(const G4DynamicParticle *)
const G4ThreeVector & GetMomentumDirection() const
const G4ThreeVector & GetVertexPosition() const
G4double GetPDGMass() const
int G4lrint(double ad)
Definition: templates.hh:163
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
void ResetTrackLength()
Definition: HistoManager.hh:93
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
static const G4double pos

Here is the call graph for this function:

void HistoManager::ScoreNewTrack ( const G4Track )
void HistoManager::SetBeamEnergy ( G4double  val)
inline

Definition at line 109 of file HistoManager.hh.

109 {fBeamEnergy = val;};
void HistoManager::SetDefaultBeamPositionFlag ( G4bool  f)
inline

Definition at line 96 of file HistoManager.hh.

96 {fBeamFlag = f;};
void HistoManager::SetDefaultBeamPositionFlag ( G4bool  f)
inline

Definition at line 97 of file HistoManager.hh.

97 {fBeamFlag = f;};
void HistoManager::SetEdepAndRMS ( G4int  i,
G4ThreeVector  val 
)

Definition at line 544 of file HistoManager.cc.

545 {
546  if(i<fNmax && i>=0) {
547  if(val[0] > 0.0) fEdeptrue[i] = val[0];
548  if(val[1] > 0.0) fRmstrue[i] = val[1];
549  if(val[2] > 0.0) fLimittrue[i] = val[2];
550  }
551 }
void HistoManager::SetElementName ( const G4String )
inline
void HistoManager::SetElementName ( const G4String name)
inline

Definition at line 120 of file HistoManager.hh.

121 {
122  fElementName = name;
123 }
const XML_Char * name
Definition: expat.h:151

Here is the caller graph for this function:

void HistoManager::SetFileName ( const G4String name)
inline

Definition at line 63 of file HistoManager.hh.

63 { fileName[0] = name;};
const XML_Char * name
Definition: expat.h:151

Here is the caller graph for this function:

void HistoManager::SetFirstEventToDebug ( G4int  val)
inline

Definition at line 99 of file HistoManager.hh.

99 {fEvt1 = val;};
void HistoManager::SetHisto ( G4int  ih,
G4int  nbins,
G4double  vmin,
G4double  vmax,
const G4String unit = "none" 
)

Definition at line 143 of file HistoManager.cc.

145 {
146  if (ih > kMaxHisto) {
147  G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
148  << "does not fExist" << G4endl;
149  return;
150  }
151 
152  const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
153  "10", "11", "12", "13", "14", "15"};
154  const G4String title[] =
155  { "dummy", //0
156  "log10(Etransfert/Emu) muIonization", //1
157  "log10(Etransfert/Emu) muPair", //2
158  "log10(Etransfert/Emu) muBrems", //3
159  "log10(Etransfert/Emu) muNuclear", //4
160  "log10(Etransfert/Emu) hIonization", //5
161  "log10(Etransfert/Emu) hPair", //6
162  "log10(Etransfert/Emu) hBrems", //7
163  "dummy", //8
164  "dummy", //9
165  "dummy", //10
166  "log10(Etransfert/Emu) muIonization", //11
167  "log10(Etransfert/Emu) muPair", //12
168  "log10(Etransfert/Emu) muBrems", //13
169  "log10(Etransfert/Emu) muNuclear" //14
170  };
171 
172  G4String titl = title[ih];
173  fUnit[ih] = 1.;
174 
175  if (unit != "none") {
176  titl = title[ih] + " (" + unit + ")";
177  fUnit[ih] = G4UnitDefinition::GetValueOf(unit);
178  }
179 
180  fExist[ih] = true;
181  fLabel[ih] = "h"+id[ih];
182  fTitle[ih] = titl;
183  fNbins[ih] = nbins;
184  fVmin[ih] = vmin;
185  fVmax[ih] = vmax;
186  fWidth[ih] = fUnit[ih]*(vmax-vmin)/nbins;
187 
188  fNbHist++;
189 
190  G4cout << "----> SetHisto " << ih << ": " << titl << "; "
191  << nbins << " bins from "
192  << vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
193 
194 }
static G4double GetValueOf(const G4String &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4int kMaxHisto
Definition: HistoManager.hh:46
subroutine title
Definition: hijing1.383.f:5980

Here is the call graph for this function:

Here is the caller graph for this function:

void HistoManager::SetHistoName ( G4String val)
inline

Definition at line 155 of file HistoManager.hh.

156 {
157  fHistoName = val;
158 }

Here is the caller graph for this function:

void HistoManager::SetHistoName ( G4String val)
inline
void HistoManager::SetHistoNumber ( G4int  val)
inline

Definition at line 97 of file HistoManager.hh.

97 {fNHisto = val;};
void HistoManager::SetIonPhysics ( const G4String nam)

Definition at line 453 of file HistoManager.cc.

454 {
455  if(fIonPhysics) {
456  G4cout << "### HistoManager WARNING: Ion Physics is already defined: <"
457  << nam << "> is ignored!" << G4endl;
458  } else if(nam == "HIJING") {
459 #ifdef G4_USE_HIJING
460  fIonPhysics = new IonHIJINGPhysics();
461  fPhysList->ReplacePhysics(fIonPhysics);
463  G4cout << "### SetIonPhysics: Ion Physics FTFP/Binary is added"
464  << G4endl;
465 #else
466  G4cout << "Error: Ion Physics HIJING is requested but is not available"
467  <<G4endl;
468 #endif
469  } else if(nam == "UrQMD") {
470 #ifdef G4_USE_URQMD
471  fIonPhysics = new IonUrQMDPhysics(1);
472  fPhysList->ReplacePhysics(fIonPhysics);
474  G4cout << "### SetIonPhysics: Ion Physics UrQMD is added"
475  << G4endl;
476 #else
477  G4cout << "Error: Ion Physics UrQMD is requested but is not available"
478  <<G4endl;
479 #endif
480  } else {
481  G4cout << "### HistoManager WARNING: Ion Physics <"
482  << nam << "> is unknown!" << G4endl;
483  }
484 }
G4GLOB_DLL std::ostream G4cout
void PhysicsHasBeenModified()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
void ReplacePhysics(G4VPhysicsConstructor *)
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void HistoManager::SetLastEventToDebug ( G4int  val)
inline

Definition at line 101 of file HistoManager.hh.

101 {fEvt2 = val;};
void HistoManager::SetMaxEnergy ( G4double  val)
inline

Definition at line 104 of file HistoManager.hh.

104 {fMaxEnergy = val;};
void HistoManager::SetMaxEnergyDeposit ( G4double  val)
inline

Definition at line 98 of file HistoManager.hh.

98 {fEdepMax = val;};
void HistoManager::SetMaxEnergyDeposit ( G4double  val)
inline

Definition at line 99 of file HistoManager.hh.

99 {fEdepMax = val;};
void HistoManager::SetMaxKinEnergy ( G4double  val)
inline

Definition at line 140 of file HistoManager.hh.

141 {
142  if(val>fMinKinEnergy) { fMaxKinEnergy = val; }
143 }

Here is the caller graph for this function:

void HistoManager::SetMaxKinEnergy ( G4double  val)
inline
void HistoManager::SetMaxMomentum ( G4double  val)
inline

Definition at line 150 of file HistoManager.hh.

151 {
152  if(val>fMinMomentum) { fMaxMomentum = val; }
153 }

Here is the caller graph for this function:

void HistoManager::SetMaxMomentum ( G4double  val)
inline
void HistoManager::SetMinKinEnergy ( G4double  val)
inline

Definition at line 135 of file HistoManager.hh.

136 {
137  if(val>0 && val<fMaxKinEnergy) { fMinKinEnergy = val; }
138 }

Here is the caller graph for this function:

void HistoManager::SetMinKinEnergy ( G4double  val)
inline
void HistoManager::SetMinMomentum ( G4double  val)
inline
void HistoManager::SetMinMomentum ( G4double  val)
inline

Definition at line 145 of file HistoManager.hh.

146 {
147  if(val>0 && val<fMaxMomentum) { fMinMomentum = val; }
148 }

Here is the caller graph for this function:

void HistoManager::SetNumberOfBinsE ( G4int  val)
inline
void HistoManager::SetNumberOfBinsE ( G4int  val)
inline

Definition at line 125 of file HistoManager.hh.

126 {
127  if(val>0) { fBinsE = val; }
128 }

Here is the caller graph for this function:

void HistoManager::SetNumberOfBinsE ( G4int  val)
inline

Definition at line 89 of file HistoManager.hh.

89 {fNBinsE = val;};
void HistoManager::SetNumberOfBinsE ( G4int  val)
inline

Definition at line 96 of file HistoManager.hh.

96 {fNBinsE = val;};
void HistoManager::SetNumberOfBinsP ( G4int  val)
inline

Definition at line 130 of file HistoManager.hh.

131 {
132  if(val>0) { fBinsP = val; }
133 }

Here is the caller graph for this function:

void HistoManager::SetNumberOfBinsP ( G4int  val)
inline
void HistoManager::SetNumberOfSlices ( G4int  val)
inline

Definition at line 88 of file HistoManager.hh.

88 {fNSlices = val;};
void HistoManager::SetNumberOfSlices ( G4int  val)
inline

Definition at line 95 of file HistoManager.hh.

95 {fNSlices = val;};
void HistoManager::SetParticleName ( const G4String )
inline
void HistoManager::SetParticleName ( const G4String name)
inline

Definition at line 115 of file HistoManager.hh.

116 {
117  fParticleName = name;
118 }
const XML_Char * name
Definition: expat.h:151

Here is the caller graph for this function:

void HistoManager::SetPhysicsList ( G4VModularPhysicsList p)
inline

Definition at line 101 of file HistoManager.hh.

101 {fPhysList = p;};
const char * p
Definition: xmltok.h:285

Here is the caller graph for this function:

void HistoManager::SetTargetLength ( G4double  val)
inline

Definition at line 87 of file HistoManager.hh.

87 {fLength = val;};
void HistoManager::SetTargetLength ( G4double  val)
inline

Definition at line 94 of file HistoManager.hh.

94 {fLength = val;};
void HistoManager::SetTargetMaterial ( const G4Material mat)
inline

Definition at line 86 of file HistoManager.hh.

86 {fMaterial = mat;};
void HistoManager::SetTargetMaterial ( const G4Material p)
inline

Definition at line 160 of file HistoManager.hh.

161 {
162  fTargetMaterial = p;
163 }
const char * p
Definition: xmltok.h:285
void HistoManager::SetVerbose ( G4int  val)
void HistoManager::SetVerbose ( G4int  val)
void HistoManager::SetVerbose ( G4int  val)
void HistoManager::SetVerbose ( G4int  val)
void HistoManager::SetVerbose ( G4int  val)
inline

Definition at line 95 of file HistoManager.hh.

95 {fVerbose = val;};

Here is the caller graph for this function:


The documentation for this class was generated from the following files: