#include <SensitiveDetector.hh>
Public Member Functions | |
SensitiveDetector (G4String SDname) | |
~SensitiveDetector () | |
G4bool | ProcessHits (G4Step *step, G4TouchableHistory *ROhist) |
Private Attributes | |
DetectorConstruction * | m_detector |
RunAction * | m_runAction |
Definition at line 8 of file SensitiveDetector.hh.
SensitiveDetector::SensitiveDetector | ( | G4String | SDname | ) |
Definition at line 9 of file SensitiveDetector.cc.
00010 : G4VSensitiveDetector(SDname) 00011 { 00012 // -- obtain detector construction and run action pointers through the run manager 00013 m_detector = (DetectorConstruction*)(G4RunManager::GetRunManager()->GetUserDetectorConstruction()); 00014 m_runAction = (RunAction*)(G4RunManager::GetRunManager()->GetUserRunAction()); 00015 }
SensitiveDetector::~SensitiveDetector | ( | ) |
G4bool SensitiveDetector::ProcessHits | ( | G4Step * | step, | |
G4TouchableHistory * | ROhist | |||
) |
Definition at line 20 of file SensitiveDetector.cc.
00021 { 00022 // ------------------------------- for first demo need (not to be kept !) --------------------- 00023 G4cout << std::setw( 5) << step->GetTrack()->GetCurrentStepNumber() 00024 << " ->> Sensitive detector `" << GetName() << "' ProcessHits(...) method called." << G4endl; 00025 // -------------------------------------------------------------------------------------------- 00026 00027 // ----------------- 00028 // -- skeleton code: 00029 // ----------------- 00030 00031 // energy deposit in this step 00032 G4double edep = step->GetTotalEnergyDeposit(); 00033 00034 if (edep <= 0.) return false; 00035 00036 // sum edep in RunAction (in SD vector): 00037 // -->> this is a new method of RunAction for this exercise : m_runAction->SumDepthDoseSD(zLocal,edep); 00038 00039 return true; 00040 00041 00042 // ------------------------------------------------------------------------ 00043 // -- Recalling of SteppingAction code -- 00044 // ------------------------------------------------------------------------ 00045 // o Adapt this code to the example need. 00046 // o Note : the pointers to the DetectorConstruction and RunAction 00047 // objects, m_detector and m_runAction, respectively are provided to you 00048 // (see this class constructor code). 00049 /* --->> 00050 00051 // in which volume is the step ? 00052 G4TouchableHandle touchable = step->GetPreStepPoint()->GetTouchableHandle(); 00053 G4VPhysicalVolume* volume = touchable->GetVolume(); 00054 00055 // energy deposit in this step 00056 G4double edep = step->GetTotalEnergyDeposit(); 00057 00058 // is astronaut ? 00059 if (volume == m_detector->GetAstronaut()) { 00060 ////G4cout << "--> edep in astronaut : " << edep/keV << " keV" << G4endl; 00061 00062 // sum edep in EventAction 00063 m_eventAction->AddEdep(edep); 00064 00065 //---------for depth dose distribution--------------------------------------- 00066 00067 // get step points in world coordinate system 00068 G4ThreeVector point1 = step->GetPreStepPoint()->GetPosition(); 00069 G4ThreeVector point2 = step->GetPostStepPoint()->GetPosition(); 00070 00071 // randomize point of energy deposition 00072 G4ThreeVector pointE = point1 + G4UniformRand()*(point2 - point1); 00073 // transform it in local coordinate system 00074 G4ThreeVector localPointE 00075 = touchable->GetHistory()->GetTopTransform().TransformPoint(pointE); 00076 00077 // extract z and offset 00078 G4double zLocal = 0.5*(m_detector->GetAstronautHeight()) - localPointE.z(); 00079 00080 // sum edep in RunAction 00081 m_runAction->SumDepthDose(zLocal,edep); 00082 00083 //----------end of depth dose distribution------------------------------------- 00084 } 00085 00086 <<--- */ 00087 00088 }
RunAction* SensitiveDetector::m_runAction [private] |