00001
00002
00003
00004
00005
00006 #include "SteppingAction.hh"
00007 #include "DetectorConstruction.hh"
00008 #include "RunAction.hh"
00009 #include "EventAction.hh"
00010
00011 #include "G4Step.hh"
00012 #include "G4Navigator.hh"
00013 #include "Randomize.hh"
00014
00015 #ifdef G4ANALYSIS_USE
00016 #include "AIDA/IHistogram1D.h"
00017 #endif
00018
00019
00020
00021 SteppingAction::SteppingAction(DetectorConstruction* det, RunAction* run,
00022 EventAction* event)
00023 :m_detector(det),m_runAction(run),m_eventAction(event)
00024 { }
00025
00026
00027
00028 SteppingAction::~SteppingAction()
00029 { }
00030
00031
00032
00033 void SteppingAction::UserSteppingAction(const G4Step* step)
00034 {
00035
00036 G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle();
00037 G4VPhysicalVolume* volume = touchable->GetVolume();
00038
00039
00040 G4double edep = step->GetTotalEnergyDeposit();
00041
00042
00043 if (volume == m_detector->GetAstronaut()) {
00044
00045
00046 m_eventAction->AddEdep(edep);
00047
00048
00049 G4ThreeVector point1 = step->GetPreStepPoint()->GetPosition();
00050 G4ThreeVector point2 = step->GetPostStepPoint()->GetPosition();
00051
00052
00053 G4ThreeVector pointE = point1 + G4UniformRand()*(point2 - point1);
00054
00055 G4ThreeVector localPointE
00056 = touchable->GetHistory()->GetTopTransform().TransformPoint(pointE);
00057
00058
00059 G4double zLocal = 0.5*(m_detector->GetAstronautHeight()) - localPointE.z();
00060
00061
00062 m_runAction->SumDepthDose(zLocal,edep);
00063 #ifdef G4ANALYSIS_USE
00064 m_runAction->GetHisto(1)->fill(zLocal, edep);
00065 #endif
00066 }
00067 }
00068
00069