00001 // 00002 // $Id: SteppingAction.cc 170 2008-09-17 09:20:45Z maire $ 00003 // 00004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00016 00017 SteppingAction::SteppingAction(DetectorConstruction* det, RunAction* run, 00018 EventAction* event) 00019 :m_detector(det),m_runAction(run),m_eventAction(event) 00020 { } 00021 00022 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00023 00024 SteppingAction::~SteppingAction() 00025 { } 00026 00027 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00028 00029 void SteppingAction::UserSteppingAction(const G4Step* step) 00030 { 00031 // in which volume is the step ? 00032 G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle(); 00033 G4VPhysicalVolume* volume = touchable->GetVolume(); 00034 00035 // energy deposit in this step 00036 G4double edep = step->GetTotalEnergyDeposit(); 00037 00038 // is astronaut ? 00039 if (volume == m_detector->GetAstronaut()) { 00040 ////G4cout << "--> edep in astronaut : " << edep/keV << " keV" << G4endl; 00041 00042 // sum edep in EventAction 00043 m_eventAction->AddEdep(edep); 00044 00045 /*---------for depth dose distribution--------------------------------------- 00046 00047 // get step points in world coordinate system 00048 G4ThreeVector point1 = step->GetPreStepPoint()->GetPosition(); 00049 G4ThreeVector point2 = step->GetPostStepPoint()->GetPosition(); 00050 00051 // randomize point of energy deposition 00052 G4ThreeVector pointE = point1 + G4UniformRand()*(point2 - point1); 00053 // transform it in local coordinate system 00054 G4ThreeVector localPointE 00055 = touchable->GetHistory()->GetTopTransform().TransformPoint(pointE); 00056 00057 // extract z and offset 00058 G4double zLocal = 0.5*(m_detector->GetAstronautHeight()) - localPointE.z(); 00059 00060 // sum edep in RunAction 00061 m_runAction->SumDepthDose(zLocal,edep); 00062 00063 ----------end of depth dose distribution-------------------------------------*/ 00064 } 00065 } 00066 00067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......