File indexing completed on 2025-01-18 09:16:09
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 #include "SteppingAction.hh"
0031
0032 #include "DetectorConstruction.hh"
0033 #include "EventAction.hh"
0034
0035 #include "G4Step.hh"
0036
0037
0038
0039 SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
0040 :G4UserSteppingAction(),detector(det),eventAct(evt)
0041 {
0042 first = true;
0043 lvol_world = lvol_module = lvol_layer = lvol_fiber = 0;
0044 }
0045
0046
0047
0048 SteppingAction::~SteppingAction()
0049 {}
0050
0051
0052
0053 void SteppingAction::UserSteppingAction(const G4Step* step )
0054 {
0055
0056
0057 if (first) {
0058 lvol_world = detector->GetLvolWorld();
0059 lvol_module = detector->GetLvolModule();
0060 lvol_layer = detector->GetLvolLayer();
0061 lvol_fiber = detector->GetLvolFiber();
0062 first = false;
0063 }
0064
0065
0066
0067 G4double edep = step->GetTotalEnergyDeposit();
0068
0069
0070
0071
0072 G4int iModule = 0;
0073 G4int iLayer = 0;
0074 G4int iFiber = 0;
0075
0076 G4TouchableHandle touch1 = step->GetPreStepPoint()->GetTouchableHandle();
0077 G4LogicalVolume* lvol = touch1->GetVolume()->GetLogicalVolume();
0078
0079 if (lvol == lvol_world) return;
0080 else if (lvol == lvol_module) { iModule = touch1->GetCopyNumber(0);}
0081 else if (lvol == lvol_layer) { iLayer = touch1->GetCopyNumber(0);
0082 iModule = touch1->GetCopyNumber(1);}
0083 else if (lvol == lvol_fiber) { iFiber = touch1->GetCopyNumber(0);
0084 iLayer = touch1->GetCopyNumber(1);
0085 iModule = touch1->GetCopyNumber(2);}
0086
0087
0088
0089 eventAct->SumDeStep(iModule, iLayer, iFiber, edep);
0090 }
0091
0092
0093
0094 G4double SteppingAction::BirksAttenuation(const G4Step* aStep)
0095 {
0096
0097
0098
0099 const G4Material* material = aStep->GetTrack()->GetMaterial();
0100 G4double birk1 = material->GetIonisation()->GetBirksConstant();
0101 G4double destep = aStep->GetTotalEnergyDeposit();
0102 G4double stepl = aStep->GetStepLength();
0103 G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
0104
0105 G4double response = destep;
0106 if (birk1*destep*stepl*charge != 0.)
0107 {
0108 response = destep/(1. + birk1*destep/stepl);
0109 }
0110 return response;
0111 }
0112
0113
0114