File indexing completed on 2025-01-31 09:22:34
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 #include "SteppingAction.hh"
0036 #include "RunAction.hh"
0037 #include "DetectorConstruction.hh"
0038 #include "G4AnalysisManager.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "G4SteppingManager.hh"
0041 #include "G4Alpha.hh"
0042 #include "G4Electron.hh"
0043
0044 SteppingAction::SteppingAction(RunAction* run,const DetectorConstruction* det)
0045 :fRun(run),fDetector(det)
0046 {}
0047
0048 SteppingAction::~SteppingAction()
0049 {}
0050
0051 void SteppingAction::UserSteppingAction(const G4Step* aStep)
0052
0053 {
0054
0055
0056 G4AnalysisManager* man = G4AnalysisManager::Instance();
0057
0058
0059
0060 fMyCellParameterisation = CellParameterisation::Instance();
0061
0062
0063
0064 G4int matVoxelPRE = -1;
0065 G4int matVoxelPOST = -1;
0066
0067 const G4StepPoint* preStep = aStep->GetPreStepPoint();
0068 const G4StepPoint* postStep = aStep->GetPostStepPoint();
0069 const G4Track* track = aStep->GetTrack();
0070
0071 const G4LogicalVolume* preVolume =
0072 preStep->GetPhysicalVolume()->GetLogicalVolume();
0073
0074 const G4LogicalVolume* postVolume = nullptr;
0075 if(postStep->GetPhysicalVolume())
0076 {
0077 postVolume = postStep->GetPhysicalVolume()->GetLogicalVolume();
0078 }
0079 const G4ParticleDefinition* particle =
0080 track->GetDynamicParticle()->GetDefinition();
0081
0082 G4int preReplicaNumber = preStep->GetTouchableHandle()->GetReplicaNumber();
0083 G4double edep = aStep->GetTotalEnergyDeposit();
0084
0085 if (preReplicaNumber>0)
0086 {
0087 matVoxelPRE = fMyCellParameterisation->GetTissueType(preReplicaNumber);
0088 }
0089
0090 if(postVolume)
0091 {
0092 G4int postReplicaNumber = postStep->GetTouchableHandle()->GetReplicaNumber();
0093 if (postReplicaNumber>0)
0094 {
0095 matVoxelPOST = fMyCellParameterisation->GetTissueType(postReplicaNumber);
0096 }
0097 }
0098
0099
0100
0101 if (particle == G4Alpha::AlphaDefinition())
0102 {
0103 if(postVolume == fDetector->GetLogicalIsobutane() &&
0104 ((preVolume == fDetector->GetLogicalCollDetYoke())
0105 ||
0106 (preVolume == fDetector->GetLogicalCollDetGap4())
0107 ||
0108 (preVolume == fDetector->GetLogicalCollDetGap4())))
0109 {
0110 fRun->AddNbOfHitsGas();
0111 }
0112
0113
0114 if(preVolume == fDetector->GetLogicalPolyprop() &&
0115 ( (postVolume == fDetector->GetLogicalKgm()) ||
0116 (matVoxelPOST == 1)) )
0117 {
0118 G4double deltaE = preStep->GetKineticEnergy()
0119 - postStep->GetKineticEnergy();
0120 if(deltaE > 0.0)
0121 {
0122
0123 man->FillNtupleDColumn(1,0,preStep->GetKineticEnergy()/keV);
0124 man->FillNtupleDColumn(1,1,deltaE*micrometer/(keV*aStep->GetStepLength()));
0125 man->AddNtupleRow(1);
0126 }
0127
0128
0129 G4ThreeVector coord1 = preStep->GetPosition();
0130 const G4AffineTransform transformation1 =
0131 preStep->GetTouchable()->GetHistory()->GetTopTransform();
0132 G4ThreeVector localPosition1 = transformation1.TransformPoint(coord1);
0133
0134 G4ThreeVector coord2 = postStep->GetPosition();
0135 const G4AffineTransform transformation2 =
0136 postStep->GetTouchable()->GetHistory()->GetTopTransform();
0137 G4ThreeVector localPosition2 = transformation2.TransformPoint(coord2);
0138
0139 G4ThreeVector localPosition =
0140 localPosition1 + G4UniformRand()*(localPosition2-localPosition1);
0141
0142
0143 man->FillNtupleDColumn(2,0,localPosition.x()/micrometer);
0144 man->FillNtupleDColumn(2,1,localPosition.y()/micrometer);
0145 man->AddNtupleRow(2);
0146 }
0147
0148
0149 if (postStep->GetKineticEnergy() < eV &&
0150 ( (matVoxelPOST==1) ||
0151 (postVolume == fDetector->GetLogicalKgm()) ||
0152 (matVoxelPOST==2) ) )
0153 {
0154
0155 man->FillNtupleDColumn(3,0,postStep->GetPosition().x()/micrometer);
0156 man->FillNtupleDColumn(3,1,postStep->GetPosition().y()/micrometer);
0157 man->FillNtupleDColumn(3,2,postStep->GetPosition().z()/micrometer);
0158 man->AddNtupleRow(3);
0159 }
0160
0161
0162
0163 }
0164
0165 if (matVoxelPRE == 2)
0166 {
0167 G4double dose = (edep/joule)/(fRun->GetMassNucleus()/kg);
0168 fRun->AddDoseN(dose);
0169 fRun->AddDoseBox(preReplicaNumber, edep/eV);
0170 }
0171 else if (matVoxelPRE == 1)
0172 {
0173 G4double dose = (edep/joule)/(fRun->GetMassCytoplasm()/kg);
0174 fRun->AddDoseC(dose);
0175 fRun->AddDoseBox(preReplicaNumber, edep/eV);
0176 }
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190 }