|
|
|||
File indexing completed on 2026-09-20 08:29:26
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 /// \file EventAction.cc 0027 /// \brief Implementation of the B3a::EventAction class 0028 0029 #include "EventAction.hh" 0030 0031 #include "RunAction.hh" 0032 0033 #include "G4Event.hh" 0034 #include "G4HCofThisEvent.hh" 0035 #include "G4SDManager.hh" 0036 #include "G4SystemOfUnits.hh" 0037 #include "G4THitsMap.hh" 0038 // #include "G4UnitsTable.hh" 0039 0040 namespace B3a 0041 { 0042 0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0044 0045 EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {} 0046 0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0048 0049 void EventAction::BeginOfEventAction(const G4Event* /*evt*/) {} 0050 0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0052 0053 void EventAction::EndOfEventAction(const G4Event* evt) 0054 { 0055 // Hits collections 0056 // 0057 G4HCofThisEvent* HCE = evt->GetHCofThisEvent(); 0058 if (!HCE) return; 0059 0060 // Get hits collections IDs 0061 if (fCollID_cryst < 0) { 0062 G4SDManager* SDMan = G4SDManager::GetSDMpointer(); 0063 fCollID_cryst = SDMan->GetCollectionID("crystal/edep"); 0064 fCollID_patient = SDMan->GetCollectionID("patient/dose"); 0065 } 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) fRunAction->CountEvent(); 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 if (dose > 0.) fRunAction->SumDose(dose); 0094 } 0095 0096 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0097 0098 } // 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 |
|