Loading...
Searching...
No Matches
OpNoviceRun.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file OpNovice/src/OpNoviceRun.cc
27/// \brief Implementation of the OpNoviceRun class
28//
29//
30//
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "OpNoviceRun.hh"
35#include "G4ParticleDefinition.hh"
36#include "G4Run.hh"
37#include "G4UnitsTable.hh"
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
41void OpNoviceRun::SetPrimary(G4ParticleDefinition* particle, G4double energy)
42{
43 fParticle = particle;
44 fEnergy = energy;
45}
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
49void OpNoviceRun::Merge(const G4Run* run)
50{
51 const auto localRun = static_cast<const OpNoviceRun*>(run);
52
53 fParticle = localRun->fParticle;
54 fEnergy = localRun->fEnergy;
55
56 fCerenkovCounter += localRun->fCerenkovCounter;
57 fCerenkov2 += localRun->fCerenkov2;
58 fScintillationCounter += localRun->fScintillationCounter;
59 fScintillation2 += localRun->fScintillation2;
60
61 fRayleighCounter += localRun->fRayleighCounter;
62 fRayleigh2 += localRun->fRayleigh2;
63 fAbsorptionCounter += localRun->fAbsorptionCounter;
64 fAbsorption2 += localRun->fAbsorption2;
65 fMieCounter += localRun->fMieCounter;
66 fMie2 += localRun->fMie2;
67 fBoundaryCounter += localRun->fBoundaryCounter;
68 fBoundary2 += localRun->fBoundary2;
69
70 G4Run::Merge(run);
71}
72
73//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
75{
76 if(numberOfEvent == 0)
77 return;
78 auto TotNbofEvents = G4double(numberOfEvent);
79
80 fCerenkovCounter /= TotNbofEvents;
81 fCerenkov2 /= TotNbofEvents;
82 G4double rmsCerenkov = fCerenkov2 - fCerenkovCounter * fCerenkovCounter;
83 if(rmsCerenkov > 0.)
84 rmsCerenkov = std::sqrt(rmsCerenkov);
85 else
86 rmsCerenkov = 0.;
87
88 fScintillationCounter /= TotNbofEvents;
89 fScintillation2 /= TotNbofEvents;
90 G4double rmsScint =
92 if(rmsScint > 0.)
93 rmsScint = std::sqrt(rmsScint);
94 else
95 rmsScint = 0.;
96
97 fRayleighCounter /= TotNbofEvents;
98 fRayleigh2 /= TotNbofEvents;
99 G4double rmsRayleigh = fRayleigh2 - fRayleighCounter * fRayleighCounter;
100 if(rmsRayleigh > 0.)
101 rmsRayleigh = std::sqrt(rmsRayleigh);
102 else
103 rmsRayleigh = 0.;
104
105 fAbsorptionCounter /= TotNbofEvents;
106 fAbsorption2 /= TotNbofEvents;
107 G4double rmsAbsorption =
109 if(rmsAbsorption > 0.)
110 rmsAbsorption = std::sqrt(rmsAbsorption);
111 else
112 rmsAbsorption = 0.;
113
114 fMieCounter /= TotNbofEvents;
115 fMie2 /= TotNbofEvents;
116 G4double rmsMie = fMie2 - fMieCounter * fMieCounter;
117 if(rmsMie > 0.)
118 rmsMie = std::sqrt(rmsMie);
119 else
120 rmsMie = 0.;
121
122 fBoundaryCounter /= TotNbofEvents;
123 fBoundary2 /= TotNbofEvents;
124 G4double rmsBoundary = fBoundary2 - fBoundaryCounter * fBoundaryCounter;
125 if(rmsBoundary > 0.)
126 rmsBoundary = std::sqrt(rmsBoundary);
127 else
128 rmsBoundary = 0.;
129
130 G4int prec = G4cout.precision(3);
131 G4cout << "\n ======================== run summary ======================\n";
132
133 G4cout << "Primary particle was: " << fParticle->GetParticleName()
134 << " with energy " << G4BestUnit(fEnergy, "Energy") << "." << G4endl;
135 G4cout << "Number of events: " << numberOfEvent << G4endl;
136
137 G4cout << "Average number of Cerenkov photons created per event: "
138 << fCerenkovCounter << " +- " << rmsCerenkov << G4endl;
139 G4cout << "Average number of scintillation photons created per event: "
140 << fScintillationCounter << " +- " << rmsScint << G4endl;
141
142 G4cout << "Average number of optical Rayleigh interactions per event: "
143 << fRayleighCounter << " +- " << rmsRayleigh << G4endl;
144 G4cout << "Average number of optical absorption interactions per event: "
145 << fAbsorptionCounter << " +- " << rmsAbsorption << G4endl;
146 G4cout << "Average number of optical Mie interactions per event: "
147 << fMieCounter << " +- " << rmsMie << G4endl;
148 G4cout << "Average number of optical boundary interactions per event: "
149 << fBoundaryCounter << " +- " << rmsBoundary << G4endl;
150
151 G4cout << G4endl;
152 G4cout.precision(prec);
153}
Definition of the OpNoviceRun class.
G4double fScintillationCounter
G4double fEnergy
G4double fCerenkov2
void EndOfRun()
G4double fMie2
void Merge(const G4Run *) override
G4double fBoundaryCounter
G4double fRayleigh2
G4ParticleDefinition * fParticle
G4double fAbsorptionCounter
G4double fScintillation2
G4double fRayleighCounter
G4double fCerenkovCounter
G4double fAbsorption2
G4double fMieCounter
G4double fBoundary2
void SetPrimary(G4ParticleDefinition *particle, G4double energy)

Applications | User Support | Publications | Collaboration