File indexing completed on 2025-01-31 09:22:36
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
0034
0035
0036
0037
0038
0039 #include "PurgMagSteppingAction.hh"
0040 #include "PurgMagRunAction.hh"
0041 #include "PurgMagDetectorConstruction.hh"
0042
0043 #include "G4SteppingManager.hh"
0044 #include "G4Electron.hh"
0045 #include "G4Gamma.hh"
0046 #include "G4Positron.hh"
0047 #include "G4VTouchable.hh"
0048 #include "G4VPhysicalVolume.hh"
0049 #include "G4AnalysisManager.hh"
0050
0051 #include "G4SystemOfUnits.hh"
0052
0053
0054
0055 PurgMagSteppingAction::PurgMagSteppingAction(const
0056 PurgMagDetectorConstruction* det)
0057 :Detector(det)
0058 { }
0059
0060
0061
0062 PurgMagSteppingAction::~PurgMagSteppingAction()
0063 { }
0064
0065
0066
0067 void PurgMagSteppingAction::UserSteppingAction(const G4Step* aStep)
0068
0069 {
0070 G4AnalysisManager* man = G4AnalysisManager::Instance();
0071
0072
0073
0074 if ((aStep->GetPreStepPoint()->GetPhysicalVolume() == Detector->GetWorld())&&
0075 (aStep->GetTrack()->GetNextVolume() == Detector->GetMeasureVolume())&&
0076
0077 (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() == "Transportation"))
0078 {
0079 G4double gx, gy, gz, ge, gpx, gpy, gpz, ex, ey, ez, ee;
0080 G4double epx, epy, epz, px, py, pz, pe, ppx, ppy, ppz;
0081
0082
0083 if(aStep->GetTrack()->GetDynamicParticle()->GetDefinition()
0084 == G4Electron::Definition())
0085 {
0086 ex = (aStep->GetTrack()->GetPosition().x())/cm;
0087 ey = (aStep->GetTrack()->GetPosition().y())/cm;
0088 ez = (aStep->GetTrack()->GetPosition().z())/cm;
0089
0090 ee = (aStep->GetTrack()->GetKineticEnergy())/MeV;
0091
0092 epx = aStep->GetTrack()->GetMomentum().x();
0093 epy = aStep->GetTrack()->GetMomentum().y();
0094 epz = aStep->GetTrack()->GetMomentum().z();
0095
0096
0097 man->FillNtupleDColumn(1,0, ex);
0098 man->FillNtupleDColumn(1,1, ey);
0099 man->FillNtupleDColumn(1,2, ez);
0100 man->FillNtupleDColumn(1,3, ee);
0101 man->FillNtupleDColumn(1,4, epx);
0102 man->FillNtupleDColumn(1,5, epy);
0103 man->FillNtupleDColumn(1,6, epz);
0104 man->AddNtupleRow(1);
0105 }
0106
0107
0108 if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ==
0109 G4Gamma::Definition())
0110 {
0111
0112
0113 gx = (aStep->GetTrack()->GetPosition().x())/cm;
0114 gy = (aStep->GetTrack()->GetPosition().y())/cm;
0115 gz = (aStep->GetTrack()->GetPosition().z())/cm;
0116
0117
0118 ge = (aStep->GetTrack()->GetKineticEnergy())/MeV;
0119
0120
0121 gpx = aStep->GetTrack()->GetMomentum().x();
0122 gpy = aStep->GetTrack()->GetMomentum().y();
0123 gpz = aStep->GetTrack()->GetMomentum().z();
0124
0125
0126 man->FillNtupleDColumn(2,0, gx);
0127 man->FillNtupleDColumn(2,1, gy);
0128 man->FillNtupleDColumn(2,2, gz);
0129 man->FillNtupleDColumn(2,3, ge);
0130 man->FillNtupleDColumn(2,4, gpx);
0131 man->FillNtupleDColumn(2,5, gpy);
0132 man->FillNtupleDColumn(2,6, gpz);
0133 man->AddNtupleRow(2);
0134 }
0135
0136
0137
0138 if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition() ==
0139 G4Positron::Definition())
0140 {
0141
0142
0143 px = (aStep->GetTrack()->GetPosition().x())/cm;
0144 py = (aStep->GetTrack()->GetPosition().y())/cm;
0145 pz = (aStep->GetTrack()->GetPosition().z())/cm;
0146
0147
0148 pe = (aStep->GetTrack()->GetKineticEnergy())/MeV;
0149
0150
0151 ppx = aStep->GetTrack()->GetMomentum().x();
0152 ppy = aStep->GetTrack()->GetMomentum().y();
0153 ppz = aStep->GetTrack()->GetMomentum().z();
0154
0155
0156 man->FillNtupleDColumn(3,0, px);
0157 man->FillNtupleDColumn(3,1, py);
0158 man->FillNtupleDColumn(3,2, pz);
0159 man->FillNtupleDColumn(3,3, pe);
0160 man->FillNtupleDColumn(3,4, ppx);
0161 man->FillNtupleDColumn(3,5, ppy);
0162 man->FillNtupleDColumn(3,6, ppz);
0163 man->AddNtupleRow(3);
0164 }
0165 }
0166 }
0167