Loading...
Searching...
No Matches
WLSRun.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//
27/// \file optical/wls/src/WLSRun.cc
28/// \brief Implementation of the WLSRun class
29//
30//
31
32#include "WLSRun.hh"
33
34//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35
36void WLSRun::Merge(const G4Run* run)
37{
38 const auto localRun = static_cast<const WLSRun*>(run);
39
40 fNTIR += localRun->fNTIR;
41 fNTIR2 += localRun->fNTIR2;
42 fNExiting += localRun->fNExiting;
43 fNExiting2 += localRun->fNExiting2;
44 fEscapedEnd += localRun->fEscapedEnd;
45 fEscapedEnd2 += localRun->fEscapedEnd2;
46 fEscapedMid += localRun->fEscapedMid;
47 fEscapedMid2 += localRun->fEscapedMid2;
48 fBounce += localRun->fBounce;
49 fBounce2 += localRun->fBounce2;
50 fWLSBounce += localRun->fWLSBounce;
51 fWLSBounce2 += localRun->fWLSBounce2;
52 fClad1Bounce += localRun->fClad1Bounce;
53 fClad1Bounce2 += localRun->fClad1Bounce2;
54 fClad2Bounce += localRun->fClad2Bounce;
55 fClad2Bounce2 += localRun->fClad2Bounce2;
56 fReflected += localRun->fReflected;
57 fReflected2 += localRun->fReflected2;
58 fEscaped += localRun->fEscaped;
59 fEscaped2 += localRun->fEscaped2;
60 fMirror += localRun->fMirror;
61 fMirror2 += localRun->fMirror2;
62 fDetectorHits += localRun->fDetectorHits;
63 fDetectorHits2 += localRun->fDetectorHits2;
64
65 G4Run::Merge(run);
66}
67
68//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
71{
72 if(numberOfEvent == 0)
73 return;
74 auto TotNbofEvents = G4double(numberOfEvent);
75
76 fNTIR = fNTIR / TotNbofEvents;
77 fNTIR2 = fNTIR2 / TotNbofEvents;
78 G4double rmsTIR = fNTIR2 - fNTIR * fNTIR;
79 if(rmsTIR > 0.)
80 rmsTIR = std::sqrt(rmsTIR);
81 else
82 rmsTIR = 0.;
83
84 fNExiting = fNExiting / TotNbofEvents;
85 fNExiting2 = fNExiting2 / TotNbofEvents;
86 G4double rmsExiting = fNExiting2 - fNExiting * fNExiting;
87 if(rmsExiting > 0.)
88 rmsExiting = std::sqrt(rmsExiting);
89 else
90 rmsExiting = 0.;
91
92 fEscapedEnd = fEscapedEnd / TotNbofEvents;
93 fEscapedEnd2 = fEscapedEnd2 / TotNbofEvents;
94 G4double rmsEscapedEnd = fEscapedEnd2 - fEscapedEnd * fEscapedEnd;
95 if(rmsEscapedEnd > 0.)
96 rmsEscapedEnd = std::sqrt(rmsEscapedEnd);
97 else
98 rmsEscapedEnd = 0.;
99
100 fEscapedMid = fEscapedMid / TotNbofEvents;
101 fEscapedMid2 = fEscapedMid2 / TotNbofEvents;
102 G4double rmsEscapedMid = fEscapedMid2 - fEscapedMid * fEscapedMid;
103 if(rmsEscapedMid > 0.)
104 rmsEscapedMid = std::sqrt(rmsEscapedMid);
105 else
106 rmsEscapedMid = 0.;
107
108 fBounce = fBounce / TotNbofEvents;
109 fBounce2 = fBounce2 / TotNbofEvents;
110 G4double rmsBounce = fBounce2 - fBounce * fBounce;
111 if(rmsBounce > 0.)
112 rmsBounce = std::sqrt(rmsBounce);
113 else
114 rmsBounce = 0.;
115
116 fWLSBounce = fWLSBounce / TotNbofEvents;
117 fWLSBounce2 = fWLSBounce2 / TotNbofEvents;
118 G4double rmsWLSBounce = fWLSBounce2 - fWLSBounce * fWLSBounce;
119 if(rmsWLSBounce > 0.)
120 rmsWLSBounce = std::sqrt(rmsWLSBounce);
121 else
122 rmsWLSBounce = 0.;
123
124 fClad1Bounce = fClad1Bounce / TotNbofEvents;
125 fClad1Bounce2 = fClad1Bounce2 / TotNbofEvents;
126 G4double rmsClad1Bounce = fClad1Bounce2 - fClad1Bounce * fClad1Bounce;
127 if(rmsClad1Bounce > 0.)
128 rmsClad1Bounce = std::sqrt(rmsClad1Bounce);
129 else
130 rmsClad1Bounce = 0.;
131
132 fClad2Bounce = fClad2Bounce / TotNbofEvents;
133 fClad2Bounce2 = fClad2Bounce2 / TotNbofEvents;
134 G4double rmsClad2Bounce = fClad2Bounce2 - fClad2Bounce * fClad2Bounce;
135 if(rmsClad2Bounce > 0.)
136 rmsClad2Bounce = std::sqrt(rmsClad2Bounce);
137 else
138 rmsClad2Bounce = 0.;
139
140 fReflected = fReflected / TotNbofEvents;
141 fReflected2 = fReflected2 / TotNbofEvents;
142 G4double rmsReflected = fReflected2 - fReflected * fReflected;
143 if(rmsReflected > 0.)
144 rmsReflected = std::sqrt(rmsReflected);
145 else
146 rmsReflected = 0.;
147
148 fEscaped = fEscaped / TotNbofEvents;
149 fEscaped2 = fEscaped2 / TotNbofEvents;
150 G4double rmsEscaped = fEscaped2 - fEscaped * fEscaped;
151 if(rmsEscaped > 0.)
152 rmsEscaped = std::sqrt(rmsEscaped);
153 else
154 rmsEscaped = 0.;
155
156 fMirror = fMirror / TotNbofEvents;
157 fMirror2 = fMirror2 / TotNbofEvents;
158 G4double rmsMirror = fMirror2 - fMirror * fMirror;
159 if(rmsMirror > 0.)
160 rmsMirror = std::sqrt(rmsMirror);
161 else
162 rmsMirror = 0.;
163
164 fDetectorHits = fDetectorHits / TotNbofEvents;
165 fDetectorHits2 = fDetectorHits2 / TotNbofEvents;
166 G4double rmsDetectorHits = fDetectorHits2 - fDetectorHits * fDetectorHits;
167 if(rmsDetectorHits > 0.)
168 rmsDetectorHits = std::sqrt(rmsDetectorHits);
169 else
170 rmsDetectorHits = 0.;
171
172 G4int prec = G4cout.precision(3);
173 G4cout << "\n ======================== run summary =====================\n";
174 G4cout << "Average number per event:" << G4endl;
175 G4cout << " TIR: " << fNTIR << " +- " << rmsTIR << G4endl
176 << " Exiting: " << fNExiting << " +- " << rmsExiting << G4endl
177 << " Escaped Mid: " << fEscapedMid << " +- " << rmsEscapedMid
178 << G4endl << " Escaped End: " << fEscapedEnd << " +- "
179 << rmsEscapedEnd << G4endl << " Bounced: " << fBounce << " +- "
180 << rmsBounce << G4endl << " WLS Bounce: " << fWLSBounce << " +- "
181 << rmsWLSBounce << G4endl << " Clad1 Bounce: " << fClad1Bounce
182 << " +- " << rmsClad1Bounce << G4endl
183 << " Clad2 Bounce: " << fClad2Bounce << " +- " << rmsClad2Bounce
184 << G4endl << " Reflected: " << fReflected << " +- " << rmsReflected
185 << G4endl << " Escaped: " << fEscaped << " +- " << rmsEscaped
186 << G4endl << " Mirror: " << fMirror << " +- " << rmsMirror
187 << G4endl << " Detector hit: " << fDetectorHits << " +- "
188 << rmsDetectorHits << G4endl;
189
190 G4cout << G4endl;
191 G4cout.precision(prec);
192}
Definition of the WLSRun class.
G4double fBounce
Definition WLSRun.hh:130
G4double fDetectorHits2
Definition WLSRun.hh:145
void Merge(const G4Run *) override
Definition WLSRun.cc:36
G4double fBounce2
Definition WLSRun.hh:131
G4double fNExiting
Definition WLSRun.hh:124
G4double fClad2Bounce2
Definition WLSRun.hh:137
G4double fDetectorHits
Definition WLSRun.hh:144
G4double fEscapedMid2
Definition WLSRun.hh:129
G4double fWLSBounce
Definition WLSRun.hh:132
G4double fClad2Bounce
Definition WLSRun.hh:136
void EndOfRun()
Definition WLSRun.cc:70
G4double fNTIR2
Definition WLSRun.hh:123
G4double fWLSBounce2
Definition WLSRun.hh:133
G4double fClad1Bounce
Definition WLSRun.hh:134
G4double fClad1Bounce2
Definition WLSRun.hh:135
G4double fMirror2
Definition WLSRun.hh:143
G4double fEscapedEnd
Definition WLSRun.hh:126
G4double fNTIR
Definition WLSRun.hh:122
G4double fEscapedMid
Definition WLSRun.hh:128
G4double fNExiting2
Definition WLSRun.hh:125
G4double fEscaped2
Definition WLSRun.hh:141
G4double fEscaped
Definition WLSRun.hh:140
G4double fEscapedEnd2
Definition WLSRun.hh:127
G4double fReflected
Definition WLSRun.hh:138
G4double fReflected2
Definition WLSRun.hh:139
G4double fMirror
Definition WLSRun.hh:142

Applications | User Support | Publications | Collaboration