![]() |
|
|||
File indexing completed on 2025-02-23 09:20:38
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // 0027 /// \file B3/B3b/src/Run.cc 0028 /// \brief Implementation of the B3b::Run class 0029 0030 #include "Run.hh" 0031 0032 #include "G4Event.hh" 0033 #include "G4HCofThisEvent.hh" 0034 #include "G4RunManager.hh" 0035 #include "G4SDManager.hh" 0036 #include "G4SystemOfUnits.hh" 0037 #include "G4THitsMap.hh" 0038 0039 namespace B3b 0040 { 0041 0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0043 0044 void Run::RecordEvent(const G4Event* event) 0045 { 0046 if (fCollID_cryst < 0) { 0047 fCollID_cryst = G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep"); 0048 // G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl; 0049 } 0050 0051 if (fCollID_patient < 0) { 0052 fCollID_patient = G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose"); 0053 // G4cout << " fCollID_patient: " << fCollID_patient << G4endl; 0054 } 0055 0056 G4int evtNb = event->GetEventID(); 0057 0058 if (evtNb % fPrintModulo == 0) { 0059 G4cout << G4endl << "---> end of event: " << evtNb << G4endl; 0060 } 0061 0062 // Hits collections 0063 // 0064 G4HCofThisEvent* HCE = event->GetHCofThisEvent(); 0065 if (!HCE) return; 0066 0067 // Energy in crystals : identify 'good events' 0068 // 0069 const G4double eThreshold = 500 * keV; 0070 G4int nbOfFired = 0; 0071 0072 auto evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst)); 0073 0074 for (auto& mapElement : (*evtMap->GetMap())) { 0075 auto edep = *(mapElement.second); 0076 if (edep > eThreshold) nbOfFired++; 0077 // auto copyNb = mapElement.first; 0078 // G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV "; 0079 } 0080 if (nbOfFired == 2) fGoodEvents++; 0081 0082 // Dose deposit in patient 0083 // 0084 G4double dose = 0.; 0085 0086 evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient)); 0087 0088 for (auto& mapElement : (*evtMap->GetMap())) { 0089 dose += *(mapElement.second); 0090 // auto copyNb = mapElement.first; 0091 // G4cout << "\n patient" << copyNb << ": " << G4BestUnit(dose,"Dose"); 0092 } 0093 fSumDose += dose; 0094 fStatDose += dose; 0095 0096 G4Run::RecordEvent(event); 0097 } 0098 0099 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0100 0101 void Run::Merge(const G4Run* run) 0102 { 0103 const Run* localRun = static_cast<const Run*>(run); 0104 fGoodEvents += localRun->fGoodEvents; 0105 fSumDose += localRun->fSumDose; 0106 fStatDose += localRun->fStatDose; 0107 G4Run::Merge(run); 0108 } 0109 0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0111 0112 } // namespace B3b
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |