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 /// \file Run.cc 26 /// \file Run.cc 27 /// \brief Implementation of the Run class 27 /// \brief Implementation of the Run class 28 28 29 #include "Run.hh" 29 #include "Run.hh" 30 << 31 #include "Scorer.hh" << 32 << 33 #include "G4Event.hh" 30 #include "G4Event.hh" 34 #include "G4HCofThisEvent.hh" 31 #include "G4HCofThisEvent.hh" 35 #include "G4RunManager.hh" 32 #include "G4RunManager.hh" 36 #include "G4SDManager.hh" 33 #include "G4SDManager.hh" 37 << 34 #include "Scorer.hh" 38 #include <map> 35 #include <map> 39 36 40 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 41 38 42 Run::Run() : G4Run() << 39 Run::Run() : G4Run() { 43 { << 40 auto mfdet = dynamic_cast<G4MultiFunctionalDetector *>( 44 auto mfdet = dynamic_cast<G4MultiFunctionalD << 41 G4SDManager::GetSDMpointer()->FindSensitiveDetector("mfDetector")); 45 G4SDManager::GetSDMpointer()->FindSensitiv << 42 fpDose = mfdet->GetPrimitive(0);//Dose 46 fpDose = mfdet->GetPrimitive(0); // Dose << 43 fpGvalues = mfdet->GetPrimitive(1);//G-values 47 fpGvalues = mfdet->GetPrimitive(1); // G-va << 48 } 44 } 49 45 50 //....oooOO0OOooo........oooOO0OOooo........oo 46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 51 47 52 void Run::RecordEvent(const G4Event* event) << 48 void Run::RecordEvent(const G4Event *event) { 53 { << 54 if (event->IsAborted()) { 49 if (event->IsAborted()) { 55 return; 50 return; 56 } 51 } 57 // Hits collections 52 // Hits collections 58 // 53 // 59 G4HCofThisEvent* pHCE = event->GetHCofThisEv << 54 G4HCofThisEvent *pHCE = event->GetHCofThisEvent(); 60 if (!pHCE) { 55 if (!pHCE) { 61 return; 56 return; 62 } 57 } 63 58 64 auto evtMap = dynamic_cast<Scorer<Gvalues>*> << 59 auto evtMap = dynamic_cast<Scorer<Gvalues> *>(fpGvalues)->GetEventMap(); 65 60 66 std::map<G4int, G4double*>::iterator itr; << 61 std::map<G4int, G4double *>::iterator itr; 67 62 68 for (itr = evtMap->GetMap()->begin(); itr != 63 for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) { 69 G4double edep = *(itr->second); 64 G4double edep = *(itr->second); 70 fSumEne += edep; 65 fSumEne += edep; 71 } 66 } 72 G4Run::RecordEvent(event); 67 G4Run::RecordEvent(event); 73 } 68 } 74 69 75 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 76 71 77 void Run::Merge(const G4Run* aRun) << 72 void Run::Merge(const G4Run *aRun) { 78 { << 79 if (aRun == this) { 73 if (aRun == this) { 80 return; 74 return; 81 } 75 } 82 const Run* localRun = dynamic_cast<const Run << 76 const Run *localRun = dynamic_cast<const Run *>(aRun); 83 fSumEne += localRun->fSumEne; 77 fSumEne += localRun->fSumEne; 84 auto masterScorer = dynamic_cast<Scorer<Gval << 78 auto masterScorer = dynamic_cast<Scorer<Gvalues> *>(this->fpGvalues); 85 auto localScorer = dynamic_cast<Scorer<Gvalu << 79 auto localScorer = dynamic_cast<Scorer<Gvalues> *>(localRun->fpGvalues); 86 masterScorer->AbsorbResultsFromWorkerScorer( 80 masterScorer->AbsorbResultsFromWorkerScorer(localScorer); 87 G4Run::Merge(aRun); 81 G4Run::Merge(aRun); 88 } 82 } 89 83 90 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 91 85