//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "SteppingAction.hh" #include "Run.hh" #include "EventAction.hh" #include "HistoManager.hh" #include "G4RunManager.hh" #include "G4ParticleDefinition.hh" #include "G4Gamma.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... SteppingAction::SteppingAction(EventAction* event) : G4UserSteppingAction(), fEventAction(event) { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... SteppingAction::~SteppingAction() { } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void SteppingAction::UserSteppingAction(const G4Step* aStep) { // count processes // const G4StepPoint* endPoint = aStep->GetPostStepPoint(); const G4VProcess* process = endPoint->GetProcessDefinedStep(); Run* run = static_cast( G4RunManager::GetRunManager()->GetNonConstCurrentRun()); run->CountProcesses(process); //kill particles leaving graphite const G4Track* aTrack = aStep->GetTrack(); const G4ParticleDefinition* particle = aTrack->GetParticleDefinition(); if (particle != G4Gamma::Gamma()) { const G4StepPoint* point1 = aStep->GetPreStepPoint(); const G4StepPoint* point2 = aStep->GetPostStepPoint(); G4String volumeName = point1->GetPhysicalVolume()->GetName(); if ((volumeName == "graphite")&&(point2->GetStepStatus() == fGeomBoundary)) { G4Track* track = (G4Track*)aTrack; track->SetTrackStatus(fStopAndKill); }; }; // energy deposit // G4double edepStep = aStep->GetTotalEnergyDeposit(); if (edepStep <= 0.) return; fEventAction->AddEdep(edepStep); //longitudinal profile of deposited energy // G4ThreeVector prePoint = aStep->GetPreStepPoint() ->GetPosition(); G4ThreeVector postPoint = aStep->GetPostStepPoint()->GetPosition(); G4ThreeVector point = prePoint + G4UniformRand()*(postPoint - prePoint); G4double r = point.mag(); G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); analysisManager->FillH1(2, r, edepStep); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......