Warning, file /geant4/examples/extended/polarisation/Pol01/src/SteppingAction.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include "SteppingAction.hh"
0034
0035 #include "DetectorConstruction.hh"
0036 #include "PrimaryGeneratorAction.hh"
0037 #include "RunAction.hh"
0038
0039 #include "G4PolarizationHelper.hh"
0040 #include "G4RunManager.hh"
0041
0042
0043
0044 SteppingAction::SteppingAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
0045 RunAction* ruAct)
0046 : G4UserSteppingAction(), fDetector(det), fPrimary(prim), fRunAction(ruAct)
0047 {}
0048
0049
0050
0051 SteppingAction::~SteppingAction() {}
0052
0053
0054
0055 void SteppingAction::UserSteppingAction(const G4Step* aStep)
0056 {
0057 G4StepPoint* prePoint = aStep->GetPreStepPoint();
0058 G4StepPoint* endPoint = aStep->GetPostStepPoint();
0059
0060 G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
0061 fRunAction->CountProcesses(procName);
0062
0063 if (prePoint->GetTouchableHandle()->GetVolume() == fDetector->GetBox()
0064 && endPoint->GetTouchableHandle()->GetVolume() == fDetector->GetWorld())
0065 {
0066 G4Track* aTrack = aStep->GetTrack();
0067 const G4ParticleDefinition* part = aTrack->GetDynamicParticle()->GetDefinition();
0068
0069 G4ThreeVector position = endPoint->GetPosition();
0070 G4ThreeVector direction = endPoint->GetMomentumDirection();
0071 G4double kinEnergy = endPoint->GetKineticEnergy();
0072
0073 G4ThreeVector beamDirection = fPrimary->GetParticleGun()->GetParticleMomentumDirection();
0074 G4double polZ = endPoint->GetPolarization().z();
0075
0076 G4double costheta = direction * beamDirection;
0077
0078 G4double xdir = direction * G4PolarizationHelper::GetParticleFrameX(beamDirection);
0079 G4double ydir = direction * G4PolarizationHelper::GetParticleFrameY(beamDirection);
0080
0081 G4double phi = std::atan2(ydir, xdir);
0082 fRunAction->FillData(part, kinEnergy, costheta, phi, polZ);
0083 }
0084 }
0085
0086