34 #include "RunAction.hh"
36 #include "DetectorConstruction.hh"
37 #include "PrimaryGeneratorAction.hh"
57 fGamma(0), fElectron(0), fPositron(0),
58 fDetector(det), fPrimary(prim), fProcCounter(0), fAnalysisManager(0),
60 fPhotonStats(), fElectronStats(), fPositronStats()
132 const G4String id[] = {
"h1",
"h2",
"h3",
"h4",
"h5",
133 "h6",
"h7",
"h8",
"h9",
"h10",
"h11",
"h12"};
135 {
"Gamma Energy distribution",
136 "Gamma Cos(Theta) distribution",
137 "Gamma Phi angular distribution",
138 "Gamma longitudinal Polarization",
139 "Electron Energy distribution",
140 "Electron Cos(Theta) distribution",
141 "Electron Phi angular distribution",
142 "Electron longitudinal Polarization",
143 "Positron Energy distribution",
144 "Positron Cos(Theta) distribution",
145 "Positron Phi angular distribution",
146 "Positron longitudinal Polarization"
150 for(
int i=0; i<12; ++i) {
152 if(0==j) { vmin = 0.; vmax = 12.*
MeV; }
153 else if(1==j) { vmin = -1.; vmax = 1.; }
154 else if(2==j) { vmin = 0.; vmax =
pi; }
155 else { vmin = -1.5; vmax = 1.5; }
167 for(
int i=0; i<12; ++i) {
185 while ((i<nbProc)&&((*
fProcCounter)[i]->GetName()!=procName)) i++;
188 (*fProcCounter)[i]->Count();
196 if (NbOfEvents == 0)
return;
207 G4cout <<
"\n The run consists of " << NbOfEvents <<
" "<< Particle <<
" of "
210 << material->
GetName() <<
" (density: "
214 G4cout <<
"\n Process calls frequency --->\n";
216 G4String procName = (*fProcCounter)[i]->GetName();
217 G4int count = (*fProcCounter)[i]->GetCounter();
218 G4cout <<
"\t" << procName <<
" = " << count<<
"\n";
258 fTotalNumber(0), fTotalNumber2(0),
259 fSumEnergy(0), fSumEnergy2(0),
260 fSumPolarization(0), fSumPolarization2(0),
261 fSumCosTheta(0), fSumCosTheta2(0)
273 fTotalNumber+=fCurrentNumber;
274 fTotalNumber2+=fCurrentNumber*fCurrentNumber;
284 fSumEnergy+=kinEnergy;
285 fSumEnergy2+=kinEnergy*kinEnergy;
286 fSumPolarization+=longitudinalPolarization;
287 fSumPolarization2+=longitudinalPolarization*longitudinalPolarization;
288 fSumCosTheta+=costheta;
289 fSumCosTheta2+=costheta*costheta;
296 G4cout<<
"Mean Number per Event :"
298 if (fTotalNumber==0) fTotalNumber=1;
299 G4double energyMean=fSumEnergy/fTotalNumber;
300 G4double energyRms=std::sqrt(fSumEnergy2/fTotalNumber-energyMean*energyMean);
302 <<
" +- "<<
G4BestUnit(energyRms,
"Energy")<<
"\n";
303 G4double polarizationMean=fSumPolarization/fTotalNumber;
305 std::sqrt(fSumPolarization2/fTotalNumber-polarizationMean*polarizationMean);
306 G4cout<<
"Mean Polarization :"<< polarizationMean
307 <<
" +- "<<polarizationRms<<
"\n";
315 fTotalNumber=fTotalNumber2=0;
316 fSumEnergy=fSumEnergy2=0;
317 fSumPolarization=fSumPolarization2=0;
318 fSumCosTheta=fSumCosTheta2=0;
const G4ParticleDefinition * fPositron
void EndOfRunAction(const G4Run *)
static constexpr double MeV
ProcessesCount * fProcCounter
std::vector< OneProcessCount * > ProcessesCount
const G4String & GetParticleName() const
const G4ParticleDefinition * fGamma
G4ParticleGun * GetParticleGun()
void BeginOfRunAction(const G4Run *)
void FillData(G4double kinEnergy, G4double costheta, G4double longitudinalPolarization)
G4int GetNumberOfEvent() const
const G4String & GetName() const
G4AnalysisManager * fAnalysisManager
void CountProcesses(G4String)
const G4ParticleDefinition * fElectron
void SaveHisto(G4int nevents)
static G4Positron * Positron()
The primary generator action class with particle gun.
static G4Electron * Electron()
DetectorConstruction * fDetector
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void PrintResults(G4int totalNumberOfEvents)
G4double GetParticleEnergy() const
void FillData(const G4ParticleDefinition *particle, G4double kinEnergy, G4double costheta, G4double phi, G4double longitudinalPolarization)
PrimaryGeneratorAction * fPrimary
G4GLOB_DLL std::ostream G4cout
static constexpr double pi
ParticleStatistics fPhotonStats
G4ParticleDefinition * GetParticleDefinition() const
G4Material * GetMaterial()
static void showEngineStatus()
ParticleStatistics fElectronStats
Simple detector construction with a box volume placed in a world.
ParticleStatistics fPositronStats
G4double GetDensity() const