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