![]() |
|
|||
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/B3a/src/EventAction.cc 0028 /// \brief Implementation of the B3a::EventAction class 0029 0030 #include "EventAction.hh" 0031 0032 #include "RunAction.hh" 0033 0034 #include "G4Event.hh" 0035 #include "G4HCofThisEvent.hh" 0036 #include "G4SDManager.hh" 0037 #include "G4SystemOfUnits.hh" 0038 #include "G4THitsMap.hh" 0039 // #include "G4UnitsTable.hh" 0040 0041 namespace B3a 0042 { 0043 0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0045 0046 EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {} 0047 0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0049 0050 void EventAction::BeginOfEventAction(const G4Event* /*evt*/) {} 0051 0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0053 0054 void EventAction::EndOfEventAction(const G4Event* evt) 0055 { 0056 // Hits collections 0057 // 0058 G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); 0059 if (!HCE) return; 0060 0061 // Get hits collections IDs 0062 if (fCollID_cryst < 0) { 0063 G4SDManager* SDMan = G4SDManager::GetSDMpointer(); 0064 fCollID_cryst = SDMan->GetCollectionID("crystal/edep"); 0065 fCollID_patient = SDMan->GetCollectionID("patient/dose"); 0066 } 0067 0068 // Energy in crystals : identify 'good events' 0069 // 0070 const G4double eThreshold = 500 * keV; 0071 G4int nbOfFired = 0; 0072 0073 auto evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst)); 0074 0075 for (auto& mapElement : (*evtMap->GetMap())) { 0076 auto edep = *(mapElement.second); 0077 if (edep > eThreshold) ++nbOfFired; 0078 // auto copyNb = mapElement.first; 0079 // G4cout << "\n cryst" << copyNb << ": " << edep/keV << " keV "; 0080 } 0081 if (nbOfFired == 2) fRunAction->CountEvent(); 0082 0083 // Dose deposit in patient 0084 // 0085 G4double dose = 0.; 0086 0087 evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient)); 0088 0089 for (auto& mapElement : (*evtMap->GetMap())) { 0090 dose += *(mapElement.second); 0091 // auto copyNb = mapElement.first; 0092 // G4cout << "\n patient" << copyNb << ": " << G4BestUnit(dose,"Dose"); 0093 } 0094 if (dose > 0.) fRunAction->SumDose(dose); 0095 } 0096 0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0098 0099 } // namespace B3a
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |