![]() |
|
|||
File indexing completed on 2025-04-10 08:06:46
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 scavenger/src/Run.cc 0027 /// \brief Implementation of the scavenger::Run class 0028 0029 #include "Run.hh" 0030 0031 #include "ScoreSpecies.hh" 0032 0033 #include "G4Event.hh" 0034 #include "G4HCofThisEvent.hh" 0035 #include "G4RunManager.hh" 0036 #include "G4SDManager.hh" 0037 #include "G4THitsMap.hh" 0038 0039 namespace scavenger 0040 { 0041 0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 0043 0044 Run::Run() : G4Run() 0045 { 0046 G4MultiFunctionalDetector* mfdet = dynamic_cast<G4MultiFunctionalDetector*>( 0047 G4SDManager::GetSDMpointer()->FindSensitiveDetector("mfDetector")); 0048 G4int CollectionIDspecies = G4SDManager::GetSDMpointer()->GetCollectionID("mfDetector/Species"); 0049 fScorerRun = mfdet->GetPrimitive(CollectionIDspecies); 0050 } 0051 0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 0053 0054 void Run::RecordEvent(const G4Event* event) 0055 { 0056 if (event->IsAborted()) { 0057 return; 0058 } 0059 G4int CollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("mfDetector/Species"); 0060 // Hits collections 0061 G4HCofThisEvent* pHCE = event->GetHCofThisEvent(); 0062 if (!pHCE) { 0063 return; 0064 } 0065 auto evtMap = dynamic_cast<G4THitsMap<G4double>*>(pHCE->GetHC(CollectionID)); 0066 auto map = evtMap->GetMap(); 0067 for (const auto& it : *map) { 0068 G4double edep = *(it.second); 0069 fSumEne += edep; 0070 } 0071 G4Run::RecordEvent(event); 0072 } 0073 0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 0075 0076 void Run::Merge(const G4Run* aRun) 0077 { 0078 if (aRun == this) { 0079 return; 0080 } 0081 const auto localRun = dynamic_cast<const Run*>(aRun); 0082 fSumEne += localRun->fSumEne; 0083 auto masterScorer = dynamic_cast<ScoreSpecies*>(this->fScorerRun); 0084 auto localScorer = dynamic_cast<ScoreSpecies*>(localRun->fScorerRun); 0085 masterScorer->AbsorbResultsFromWorkerScorer(localScorer); 0086 G4Run::Merge(aRun); 0087 } 0088 0089 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 0090 0091 } // namespace scavenger
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |