Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file optical/wls/src/WLSRun.cc 27 /// \file optical/wls/src/WLSRun.cc 28 /// \brief Implementation of the WLSRun class 28 /// \brief Implementation of the WLSRun class 29 // 29 // 30 // 30 // 31 31 32 #include "WLSRun.hh" 32 #include "WLSRun.hh" 33 33 34 //....oooOO0OOooo........oooOO0OOooo........oo 34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 35 35 >> 36 WLSRun::WLSRun() >> 37 : G4Run() >> 38 { >> 39 fNTIR = 0.; >> 40 fNTIR2 = 0.; >> 41 fNExiting = 0.; >> 42 fNExiting2 = 0.; >> 43 fEscapedEnd = 0.; >> 44 fEscapedEnd2 = 0.; >> 45 fEscapedMid = 0.; >> 46 fEscapedMid2 = 0.; >> 47 fBounce = 0.; >> 48 fBounce2 = 0.; >> 49 fWLSBounce = 0.; >> 50 fWLSBounce2 = 0.; >> 51 fClad1Bounce = 0.; >> 52 fClad1Bounce2 = 0.; >> 53 fClad2Bounce = 0.; >> 54 fClad2Bounce2 = 0.; >> 55 fReflected = 0.; >> 56 fReflected2 = 0.; >> 57 fDetected = 0.; >> 58 fDetected2 = 0.; >> 59 fEscaped = 0.; >> 60 fEscaped2 = 0.; >> 61 fMirror = 0.; >> 62 fMirror2 = 0.; >> 63 fDetectorHits = 0.; >> 64 fDetectorHits2 = 0.; >> 65 } >> 66 >> 67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 68 >> 69 WLSRun::~WLSRun() {} >> 70 >> 71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 72 36 void WLSRun::Merge(const G4Run* run) 73 void WLSRun::Merge(const G4Run* run) 37 { 74 { 38 const auto localRun = static_cast<const WLSR << 75 const WLSRun* localRun = static_cast<const WLSRun*>(run); 39 76 40 fNTIR += localRun->fNTIR; 77 fNTIR += localRun->fNTIR; 41 fNTIR2 += localRun->fNTIR2; 78 fNTIR2 += localRun->fNTIR2; 42 fNExiting += localRun->fNExiting; 79 fNExiting += localRun->fNExiting; 43 fNExiting2 += localRun->fNExiting2; 80 fNExiting2 += localRun->fNExiting2; 44 fEscapedEnd += localRun->fEscapedEnd; 81 fEscapedEnd += localRun->fEscapedEnd; 45 fEscapedEnd2 += localRun->fEscapedEnd2; 82 fEscapedEnd2 += localRun->fEscapedEnd2; 46 fEscapedMid += localRun->fEscapedMid; 83 fEscapedMid += localRun->fEscapedMid; 47 fEscapedMid2 += localRun->fEscapedMid2; 84 fEscapedMid2 += localRun->fEscapedMid2; 48 fBounce += localRun->fBounce; 85 fBounce += localRun->fBounce; 49 fBounce2 += localRun->fBounce2; 86 fBounce2 += localRun->fBounce2; 50 fWLSBounce += localRun->fWLSBounce; 87 fWLSBounce += localRun->fWLSBounce; 51 fWLSBounce2 += localRun->fWLSBounce2; 88 fWLSBounce2 += localRun->fWLSBounce2; 52 fClad1Bounce += localRun->fClad1Bounce; 89 fClad1Bounce += localRun->fClad1Bounce; 53 fClad1Bounce2 += localRun->fClad1Bounce2; 90 fClad1Bounce2 += localRun->fClad1Bounce2; 54 fClad2Bounce += localRun->fClad2Bounce; 91 fClad2Bounce += localRun->fClad2Bounce; 55 fClad2Bounce2 += localRun->fClad2Bounce2; 92 fClad2Bounce2 += localRun->fClad2Bounce2; 56 fReflected += localRun->fReflected; 93 fReflected += localRun->fReflected; 57 fReflected2 += localRun->fReflected2; 94 fReflected2 += localRun->fReflected2; >> 95 fDetected += localRun->fDetected; >> 96 fDetected2 += localRun->fDetected2; 58 fEscaped += localRun->fEscaped; 97 fEscaped += localRun->fEscaped; 59 fEscaped2 += localRun->fEscaped2; 98 fEscaped2 += localRun->fEscaped2; 60 fMirror += localRun->fMirror; 99 fMirror += localRun->fMirror; 61 fMirror2 += localRun->fMirror2; 100 fMirror2 += localRun->fMirror2; 62 fDetectorHits += localRun->fDetectorHits; 101 fDetectorHits += localRun->fDetectorHits; 63 fDetectorHits2 += localRun->fDetectorHits2; 102 fDetectorHits2 += localRun->fDetectorHits2; 64 103 65 G4Run::Merge(run); 104 G4Run::Merge(run); 66 } 105 } 67 106 68 //....oooOO0OOooo........oooOO0OOooo........oo 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 69 108 70 void WLSRun::EndOfRun() 109 void WLSRun::EndOfRun() 71 { 110 { 72 if (numberOfEvent == 0) return; << 111 if(numberOfEvent == 0) 73 auto TotNbofEvents = G4double(numberOfEvent) << 112 return; >> 113 G4double TotNbofEvents = G4double(numberOfEvent); 74 114 75 fNTIR = fNTIR / TotNbofEvents; << 115 fNTIR = fNTIR / TotNbofEvents; 76 fNTIR2 = fNTIR2 / TotNbofEvents; << 116 fNTIR2 = fNTIR2 / TotNbofEvents; 77 G4double rmsTIR = fNTIR2 - fNTIR * fNTIR; 117 G4double rmsTIR = fNTIR2 - fNTIR * fNTIR; 78 if (rmsTIR > 0.) << 118 if(rmsTIR > 0.) 79 rmsTIR = std::sqrt(rmsTIR); 119 rmsTIR = std::sqrt(rmsTIR); 80 else 120 else 81 rmsTIR = 0.; 121 rmsTIR = 0.; 82 122 83 fNExiting = fNExiting / TotNbofEvents; << 123 fNExiting = fNExiting / TotNbofEvents; 84 fNExiting2 = fNExiting2 / TotNbofEvents; << 124 fNExiting2 = fNExiting2 / TotNbofEvents; 85 G4double rmsExiting = fNExiting2 - fNExiting 125 G4double rmsExiting = fNExiting2 - fNExiting * fNExiting; 86 if (rmsExiting > 0.) << 126 if(rmsExiting > 0.) 87 rmsExiting = std::sqrt(rmsExiting); 127 rmsExiting = std::sqrt(rmsExiting); 88 else 128 else 89 rmsExiting = 0.; 129 rmsExiting = 0.; 90 130 91 fEscapedEnd = fEscapedEnd / TotNbofEvents; << 131 fEscapedEnd = fEscapedEnd / TotNbofEvents; 92 fEscapedEnd2 = fEscapedEnd2 / TotNbofEvents; << 132 fEscapedEnd2 = fEscapedEnd2 / TotNbofEvents; 93 G4double rmsEscapedEnd = fEscapedEnd2 - fEsc 133 G4double rmsEscapedEnd = fEscapedEnd2 - fEscapedEnd * fEscapedEnd; 94 if (rmsEscapedEnd > 0.) << 134 if(rmsEscapedEnd > 0.) 95 rmsEscapedEnd = std::sqrt(rmsEscapedEnd); 135 rmsEscapedEnd = std::sqrt(rmsEscapedEnd); 96 else 136 else 97 rmsEscapedEnd = 0.; 137 rmsEscapedEnd = 0.; 98 138 99 fEscapedMid = fEscapedMid / TotNbofEvents; << 139 fEscapedMid = fEscapedMid / TotNbofEvents; 100 fEscapedMid2 = fEscapedMid2 / TotNbofEvents; << 140 fEscapedMid2 = fEscapedMid2 / TotNbofEvents; 101 G4double rmsEscapedMid = fEscapedMid2 - fEsc 141 G4double rmsEscapedMid = fEscapedMid2 - fEscapedMid * fEscapedMid; 102 if (rmsEscapedMid > 0.) << 142 if(rmsEscapedMid > 0.) 103 rmsEscapedMid = std::sqrt(rmsEscapedMid); 143 rmsEscapedMid = std::sqrt(rmsEscapedMid); 104 else 144 else 105 rmsEscapedMid = 0.; 145 rmsEscapedMid = 0.; 106 146 107 fBounce = fBounce / TotNbofEvents; << 147 fBounce = fBounce / TotNbofEvents; 108 fBounce2 = fBounce2 / TotNbofEvents; << 148 fBounce2 = fBounce2 / TotNbofEvents; 109 G4double rmsBounce = fBounce2 - fBounce * fB 149 G4double rmsBounce = fBounce2 - fBounce * fBounce; 110 if (rmsBounce > 0.) << 150 if(rmsBounce > 0.) 111 rmsBounce = std::sqrt(rmsBounce); 151 rmsBounce = std::sqrt(rmsBounce); 112 else 152 else 113 rmsBounce = 0.; 153 rmsBounce = 0.; 114 154 115 fWLSBounce = fWLSBounce / TotNbofEvents; << 155 fWLSBounce = fWLSBounce / TotNbofEvents; 116 fWLSBounce2 = fWLSBounce2 / TotNbofEvents; << 156 fWLSBounce2 = fWLSBounce2 / TotNbofEvents; 117 G4double rmsWLSBounce = fWLSBounce2 - fWLSBo 157 G4double rmsWLSBounce = fWLSBounce2 - fWLSBounce * fWLSBounce; 118 if (rmsWLSBounce > 0.) << 158 if(rmsWLSBounce > 0.) 119 rmsWLSBounce = std::sqrt(rmsWLSBounce); 159 rmsWLSBounce = std::sqrt(rmsWLSBounce); 120 else 160 else 121 rmsWLSBounce = 0.; 161 rmsWLSBounce = 0.; 122 162 123 fClad1Bounce = fClad1Bounce / TotNbofEvents; << 163 fClad1Bounce = fClad1Bounce / TotNbofEvents; 124 fClad1Bounce2 = fClad1Bounce2 / TotNbofEvent << 164 fClad1Bounce2 = fClad1Bounce2 / TotNbofEvents; 125 G4double rmsClad1Bounce = fClad1Bounce2 - fC 165 G4double rmsClad1Bounce = fClad1Bounce2 - fClad1Bounce * fClad1Bounce; 126 if (rmsClad1Bounce > 0.) << 166 if(rmsClad1Bounce > 0.) 127 rmsClad1Bounce = std::sqrt(rmsClad1Bounce) 167 rmsClad1Bounce = std::sqrt(rmsClad1Bounce); 128 else 168 else 129 rmsClad1Bounce = 0.; 169 rmsClad1Bounce = 0.; 130 170 131 fClad2Bounce = fClad2Bounce / TotNbofEvents; << 171 fClad2Bounce = fClad2Bounce / TotNbofEvents; 132 fClad2Bounce2 = fClad2Bounce2 / TotNbofEvent << 172 fClad2Bounce2 = fClad2Bounce2 / TotNbofEvents; 133 G4double rmsClad2Bounce = fClad2Bounce2 - fC 173 G4double rmsClad2Bounce = fClad2Bounce2 - fClad2Bounce * fClad2Bounce; 134 if (rmsClad2Bounce > 0.) << 174 if(rmsClad2Bounce > 0.) 135 rmsClad2Bounce = std::sqrt(rmsClad2Bounce) 175 rmsClad2Bounce = std::sqrt(rmsClad2Bounce); 136 else 176 else 137 rmsClad2Bounce = 0.; 177 rmsClad2Bounce = 0.; 138 178 139 fReflected = fReflected / TotNbofEvents; << 179 fReflected = fReflected / TotNbofEvents; 140 fReflected2 = fReflected2 / TotNbofEvents; << 180 fReflected2 = fReflected2 / TotNbofEvents; 141 G4double rmsReflected = fReflected2 - fRefle 181 G4double rmsReflected = fReflected2 - fReflected * fReflected; 142 if (rmsReflected > 0.) << 182 if(rmsReflected > 0.) 143 rmsReflected = std::sqrt(rmsReflected); 183 rmsReflected = std::sqrt(rmsReflected); 144 else 184 else 145 rmsReflected = 0.; 185 rmsReflected = 0.; 146 186 147 fEscaped = fEscaped / TotNbofEvents; << 187 fDetected = fDetected / TotNbofEvents; 148 fEscaped2 = fEscaped2 / TotNbofEvents; << 188 fDetected2 = fDetected2 / TotNbofEvents; >> 189 G4double rmsDetected = fDetected2 - fDetected * fDetected; >> 190 if(rmsDetected > 0.) >> 191 rmsDetected = std::sqrt(rmsDetected); >> 192 else >> 193 rmsDetected = 0.; >> 194 >> 195 fEscaped = fEscaped / TotNbofEvents; >> 196 fEscaped2 = fEscaped2 / TotNbofEvents; 149 G4double rmsEscaped = fEscaped2 - fEscaped * 197 G4double rmsEscaped = fEscaped2 - fEscaped * fEscaped; 150 if (rmsEscaped > 0.) << 198 if(rmsEscaped > 0.) 151 rmsEscaped = std::sqrt(rmsEscaped); 199 rmsEscaped = std::sqrt(rmsEscaped); 152 else 200 else 153 rmsEscaped = 0.; 201 rmsEscaped = 0.; 154 202 155 fMirror = fMirror / TotNbofEvents; << 203 fMirror = fMirror / TotNbofEvents; 156 fMirror2 = fMirror2 / TotNbofEvents; << 204 fMirror2 = fMirror2 / TotNbofEvents; 157 G4double rmsMirror = fMirror2 - fMirror * fM 205 G4double rmsMirror = fMirror2 - fMirror * fMirror; 158 if (rmsMirror > 0.) << 206 if(rmsMirror > 0.) 159 rmsMirror = std::sqrt(rmsMirror); 207 rmsMirror = std::sqrt(rmsMirror); 160 else 208 else 161 rmsMirror = 0.; 209 rmsMirror = 0.; 162 210 163 fDetectorHits = fDetectorHits / TotNbofEvent << 211 fDetectorHits = fDetectorHits / TotNbofEvents; 164 fDetectorHits2 = fDetectorHits2 / TotNbofEve << 212 fDetectorHits2 = fDetectorHits2 / TotNbofEvents; 165 G4double rmsDetectorHits = fDetectorHits2 - 213 G4double rmsDetectorHits = fDetectorHits2 - fDetectorHits * fDetectorHits; 166 if (rmsDetectorHits > 0.) << 214 if(rmsDetectorHits > 0.) 167 rmsDetectorHits = std::sqrt(rmsDetectorHit 215 rmsDetectorHits = std::sqrt(rmsDetectorHits); 168 else 216 else 169 rmsDetectorHits = 0.; 217 rmsDetectorHits = 0.; 170 218 171 G4int prec = G4cout.precision(3); 219 G4int prec = G4cout.precision(3); 172 G4cout << "\n ======================== run s 220 G4cout << "\n ======================== run summary =====================\n"; 173 G4cout << "Average number per event:" << G4e 221 G4cout << "Average number per event:" << G4endl; 174 G4cout << " TIR: " << fNTIR << " +- 222 G4cout << " TIR: " << fNTIR << " +- " << rmsTIR << G4endl 175 << " Exiting: " << fNExiting << 223 << " Exiting: " << fNExiting << " +- " << rmsExiting << G4endl 176 << " Escaped Mid: " << fEscapedMid < << 224 << " Escaped Mid: " << fEscapedMid << " +- " << rmsEscapedMid 177 << " Escaped End: " << fEscapedEnd < << 225 << G4endl << " Escaped End: " << fEscapedEnd << " +- " 178 << " Bounced: " << fBounce << " << 226 << rmsEscapedEnd << G4endl << " Bounced: " << fBounce << " +- " 179 << " WLS Bounce: " << fWLSBounce << << 227 << rmsBounce << G4endl << " WLS Bounce: " << fWLSBounce << " +- " 180 << " Clad1 Bounce: " << fClad1Bounce << 228 << rmsWLSBounce << G4endl << " Clad1 Bounce: " << fClad1Bounce 181 << " Clad2 Bounce: " << fClad2Bounce << 229 << " +- " << rmsClad1Bounce << G4endl 182 << " Reflected: " << fReflected << << 230 << " Clad2 Bounce: " << fClad2Bounce << " +- " << rmsClad2Bounce 183 << " Escaped: " << fEscaped << " << 231 << G4endl << " Reflected: " << fReflected << " +- " << rmsReflected 184 << " Mirror: " << fMirror << " << 232 << G4endl << " Detected: " << fDetected << " +- " << rmsDetected 185 << " Detector hit: " << fDetectorHits << 233 << G4endl << " Escaped: " << fEscaped << " +- " << rmsEscaped >> 234 << G4endl << " Mirror: " << fMirror << " +- " << rmsMirror >> 235 << G4endl << " Detector hit: " << fDetectorHits << " +- " >> 236 << rmsDetectorHits << G4endl; 186 237 187 G4cout << G4endl; 238 G4cout << G4endl; 188 G4cout.precision(prec); 239 G4cout.precision(prec); 189 } 240 } 190 241