Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file OpNovice/src/OpNoviceRun.cc 27 /// \brief Implementation of the OpNoviceRun c 28 // 29 // 30 // 31 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 #include "OpNoviceRun.hh" 35 36 #include "G4ParticleDefinition.hh" 37 #include "G4Run.hh" 38 #include "G4UnitsTable.hh" 39 40 //....oooOO0OOooo........oooOO0OOooo........oo 41 42 void OpNoviceRun::SetPrimary(G4ParticleDefinit 43 { 44 fParticle = particle; 45 fEnergy = energy; 46 } 47 48 //....oooOO0OOooo........oooOO0OOooo........oo 49 50 void OpNoviceRun::Merge(const G4Run* run) 51 { 52 const auto localRun = static_cast<const OpNo 53 54 fParticle = localRun->fParticle; 55 fEnergy = localRun->fEnergy; 56 57 fCerenkovCounter += localRun->fCerenkovCount 58 fCerenkov2 += localRun->fCerenkov2; 59 fScintillationCounter += localRun->fScintill 60 fScintillation2 += localRun->fScintillation2 61 62 fRayleighCounter += localRun->fRayleighCount 63 fRayleigh2 += localRun->fRayleigh2; 64 fAbsorptionCounter += localRun->fAbsorptionC 65 fAbsorption2 += localRun->fAbsorption2; 66 fMieCounter += localRun->fMieCounter; 67 fMie2 += localRun->fMie2; 68 fBoundaryCounter += localRun->fBoundaryCount 69 fBoundary2 += localRun->fBoundary2; 70 71 G4Run::Merge(run); 72 } 73 74 //....oooOO0OOooo........oooOO0OOooo........oo 75 void OpNoviceRun::EndOfRun() 76 { 77 if (numberOfEvent == 0) return; 78 auto TotNbofEvents = G4double(numberOfEvent) 79 80 fCerenkovCounter /= TotNbofEvents; 81 fCerenkov2 /= TotNbofEvents; 82 G4double rmsCerenkov = fCerenkov2 - fCerenko 83 if (rmsCerenkov > 0.) 84 rmsCerenkov = std::sqrt(rmsCerenkov); 85 else 86 rmsCerenkov = 0.; 87 88 fScintillationCounter /= TotNbofEvents; 89 fScintillation2 /= TotNbofEvents; 90 G4double rmsScint = fScintillation2 - fScint 91 if (rmsScint > 0.) 92 rmsScint = std::sqrt(rmsScint); 93 else 94 rmsScint = 0.; 95 96 fRayleighCounter /= TotNbofEvents; 97 fRayleigh2 /= TotNbofEvents; 98 G4double rmsRayleigh = fRayleigh2 - fRayleig 99 if (rmsRayleigh > 0.) 100 rmsRayleigh = std::sqrt(rmsRayleigh); 101 else 102 rmsRayleigh = 0.; 103 104 fAbsorptionCounter /= TotNbofEvents; 105 fAbsorption2 /= TotNbofEvents; 106 G4double rmsAbsorption = fAbsorption2 - fAbs 107 if (rmsAbsorption > 0.) 108 rmsAbsorption = std::sqrt(rmsAbsorption); 109 else 110 rmsAbsorption = 0.; 111 112 fMieCounter /= TotNbofEvents; 113 fMie2 /= TotNbofEvents; 114 G4double rmsMie = fMie2 - fMieCounter * fMie 115 if (rmsMie > 0.) 116 rmsMie = std::sqrt(rmsMie); 117 else 118 rmsMie = 0.; 119 120 fBoundaryCounter /= TotNbofEvents; 121 fBoundary2 /= TotNbofEvents; 122 G4double rmsBoundary = fBoundary2 - fBoundar 123 if (rmsBoundary > 0.) 124 rmsBoundary = std::sqrt(rmsBoundary); 125 else 126 rmsBoundary = 0.; 127 128 G4int prec = G4cout.precision(3); 129 G4cout << "\n ======================== run s 130 131 G4cout << "Primary particle was: " << fParti 132 << G4BestUnit(fEnergy, "Energy") << " 133 G4cout << "Number of events: " << numberOfEv 134 135 G4cout << "Average number of Cerenkov photon 136 << rmsCerenkov << G4endl; 137 G4cout << "Average number of scintillation p 138 << " +- " << rmsScint << G4endl; 139 140 G4cout << "Average number of optical Rayleig 141 << " +- " << rmsRayleigh << G4endl; 142 G4cout << "Average number of optical absorpt 143 << " +- " << rmsAbsorption << G4endl; 144 G4cout << "Average number of optical Mie int 145 << rmsMie << G4endl; 146 G4cout << "Average number of optical boundar 147 << " +- " << rmsBoundary << G4endl; 148 149 G4cout << G4endl; 150 G4cout.precision(prec); 151 } 152