Geant4 Cross Reference |
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/LXe/src/LXeRun.cc 28 /// \brief Implementation of the LXeRun class 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 #include "LXeRun.hh" 34 35 #include "G4SystemOfUnits.hh" 36 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 39 void LXeRun::Merge(const G4Run* run) 40 { 41 const auto localRun = static_cast<const LXeRun*>(run); 42 43 fHitCount += localRun->fHitCount; 44 fHitCount2 += localRun->fHitCount2; 45 fPMTsAboveThreshold += localRun->fPMTsAboveThreshold; 46 fPMTsAboveThreshold2 += localRun->fPMTsAboveThreshold2; 47 fPhotonCount_Scint += localRun->fPhotonCount_Scint; 48 fPhotonCount_Scint2 += localRun->fPhotonCount_Scint2; 49 fPhotonCount_Ceren += localRun->fPhotonCount_Ceren; 50 fPhotonCount_Ceren2 += localRun->fPhotonCount_Ceren2; 51 fAbsorptionCount += localRun->fAbsorptionCount; 52 fAbsorptionCount2 += localRun->fAbsorptionCount2; 53 fBoundaryAbsorptionCount += localRun->fBoundaryAbsorptionCount; 54 fBoundaryAbsorptionCount2 += localRun->fBoundaryAbsorptionCount2; 55 fTotE += localRun->fTotE; 56 fTotE2 += localRun->fTotE2; 57 58 G4Run::Merge(run); 59 } 60 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 63 void LXeRun::EndOfRun() 64 { 65 G4cout << "\n ======================== run summary ======================\n"; 66 67 G4int prec = G4cout.precision(); 68 69 auto n_evt = (G4double)numberOfEvent; 70 G4cout << "The run was " << numberOfEvent << " events." << G4endl; 71 72 G4cout.precision(4); 73 G4double hits = G4double(fHitCount) / n_evt; 74 G4double hits2 = G4double(fHitCount2) / n_evt; 75 G4double rms_hits = hits2 - hits * hits; 76 if (rms_hits > 0.) 77 rms_hits = std::sqrt(rms_hits / n_evt); 78 else 79 rms_hits = 0.; 80 G4cout << "Number of hits per event:\t " << hits << " +- " << rms_hits << G4endl; 81 82 G4double hitsAbove = G4double(fPMTsAboveThreshold) / n_evt; 83 G4double hitsAbove2 = G4double(fPMTsAboveThreshold2) / n_evt; 84 G4double rms_hitsAbove = hitsAbove2 - hitsAbove * hitsAbove; 85 if (rms_hitsAbove > 0.) 86 rms_hitsAbove = std::sqrt(rms_hitsAbove / n_evt); 87 else 88 rms_hitsAbove = 0.; 89 90 G4cout << "Number of hits per event above threshold:\t " << hitsAbove << " +- " << rms_hitsAbove 91 << G4endl; 92 93 G4double scint = G4double(fPhotonCount_Scint) / n_evt; 94 G4double scint2 = G4double(fPhotonCount_Scint2) / n_evt; 95 G4double rms_scint = scint2 - scint * scint; 96 if (rms_scint > 0.) 97 rms_scint = std::sqrt(rms_scint / n_evt); 98 else 99 rms_scint = 0.; 100 101 G4cout << "Number of scintillation photons per event :\t " << scint << " +- " << rms_scint 102 << G4endl; 103 104 G4double ceren = G4double(fPhotonCount_Ceren) / n_evt; 105 G4double ceren2 = G4double(fPhotonCount_Ceren2) / n_evt; 106 G4double rms_ceren = ceren2 - ceren * ceren; 107 if (rms_ceren > 0.) 108 rms_ceren = std::sqrt(rms_ceren / n_evt); 109 else 110 rms_ceren = 0.; 111 112 G4cout << "Number of Cerenkov photons per event:\t " << ceren << " +- " << rms_ceren << G4endl; 113 114 G4double absorb = G4double(fAbsorptionCount) / n_evt; 115 G4double absorb2 = G4double(fAbsorptionCount2) / n_evt; 116 G4double rms_absorb = absorb2 - absorb * absorb; 117 if (rms_absorb > 0.) 118 rms_absorb = std::sqrt(rms_absorb / n_evt); 119 else 120 rms_absorb = 0.; 121 122 G4cout << "Number of absorbed photons per event :\t " << absorb << " +- " << rms_absorb << G4endl; 123 124 G4double bdry = G4double(fBoundaryAbsorptionCount) / n_evt; 125 G4double bdry2 = G4double(fBoundaryAbsorptionCount2) / n_evt; 126 G4double rms_bdry = bdry2 - bdry * bdry; 127 if (rms_bdry > 0.) 128 rms_bdry = std::sqrt(rms_bdry / n_evt); 129 else 130 rms_bdry = 0.; 131 132 G4cout << "Number of photons absorbed at boundary per event:\t " << bdry << " +- " << rms_bdry 133 << G4endl; 134 135 G4double en = fTotE / n_evt; 136 G4double en2 = fTotE2 / n_evt; 137 G4double rms_en = en2 - en * en; 138 if (rms_en > 0.) 139 rms_en = std::sqrt(rms_en / n_evt); 140 else 141 rms_en = 0.; 142 143 G4cout << "Total energy deposition in scintillator per event:\t " << en / keV << " +- " 144 << rms_en / keV << " keV." << G4endl; 145 146 G4cout << G4endl; 147 G4cout.precision(prec); 148 } 149