![]() |
Precalibrated Ion Beam Identification Detector Simulation 1.0
A pilot study detector simulation, written in C++ with Geant4.
|
00001 #include "AllAccumulatedStatistics.hh" 00002 00003 AllAccumulatedStatistics::AllAccumulatedStatistics(G4double numberOfScintillatorTubes, G4double summationTime) 00004 :scintillatorTubes(numberOfScintillatorTubes),sumTime(summationTime) 00005 { 00006 00007 } 00008 00009 AllAccumulatedStatistics::~AllAccumulatedStatistics() 00010 { 00011 00012 } 00013 00014 bool AllAccumulatedStatistics::timeCheck(G4double time) 00015 { 00016 if(eventHits.empty() || time > (eventHits.back().time + sumTime )) 00017 { 00018 eventHits.push_back(EventHit(scintillatorTubes,time)); 00019 return true; 00020 } 00021 return false; 00022 } 00023 00024 void AllAccumulatedStatistics::AddScintillatorTubeEvent(G4int ScintillatorID, G4double time, G4double energy) 00025 { 00026 if(energy>0.1*eV) //don't add non-existent energies. 00027 { 00028 timeCheck(time); 00029 eventHits.back().scintillatorTubeEnergies.at(ScintillatorID)+=energy; 00030 } 00031 } 00032 00033 void AllAccumulatedStatistics::AddGeDetectorEvent(G4double time, G4double energy) 00034 { 00035 if(energy>0.1*eV) //don't add non-existent energies. 00036 { 00037 timeCheck(time); 00038 eventHits.back().geDetectorEnergy+=energy; 00039 } 00040 } 00041 00042 void AllAccumulatedStatistics::AddScintillatorPlateEvent(ScintillatorPlate plate, G4double time, G4double energy) 00043 { 00044 if(energy>0.1*eV) //don't add non-existent energies. 00045 { 00046 timeCheck(time); 00047 if(plate==UpperFront) 00048 eventHits.back().upperFrontScintillatorPanelEnergy+=energy; 00049 if(plate==LowerFront) 00050 eventHits.back().lowerFrontScintillatorPanelEnergy+=energy; 00051 if(plate==Back) 00052 eventHits.back().backScintillatorPanelEnergy+=energy; 00053 } 00054 } 00055 00056 std::vector<EventHit> AllAccumulatedStatistics::GetEventHits() 00057 { 00058 return eventHits; 00059 }