1 | #include "ELYSE/SteppingAction.hh" |
---|
2 | |
---|
3 | //GEANT 4 |
---|
4 | #include "G4SteppingManager.hh" |
---|
5 | #include "G4SDManager.hh" |
---|
6 | #include "G4EventManager.hh" |
---|
7 | #include "G4ProcessManager.hh" |
---|
8 | #include "G4Track.hh" |
---|
9 | #include "G4Step.hh" |
---|
10 | #include "G4Event.hh" |
---|
11 | #include "G4StepPoint.hh" |
---|
12 | #include "G4TrackStatus.hh" |
---|
13 | #include "G4VPhysicalVolume.hh" |
---|
14 | #include "G4ParticleDefinition.hh" |
---|
15 | #include "G4ParticleTypes.hh" |
---|
16 | #include "G4OpBoundaryProcess.hh" |
---|
17 | |
---|
18 | //ELYSE |
---|
19 | #include "ELYSE/EventAction.hh" |
---|
20 | #include "ELYSE/TrackingAction.hh" |
---|
21 | #include "ELYSE/Trajectory.hh" |
---|
22 | //#include "ELYSE/TrappingVolume.hh" |
---|
23 | #include "ELYSE/TrackInformation.hh" |
---|
24 | |
---|
25 | |
---|
26 | ELYSE::SteppingAction::SteppingAction() { |
---|
27 | }//Ctor |
---|
28 | |
---|
29 | //--------------------------------------------------------------------------------------------------- |
---|
30 | |
---|
31 | ELYSE::SteppingAction::~SteppingAction() { |
---|
32 | }//Dtor |
---|
33 | |
---|
34 | //--------------------------------------------------------------------------------------------------- |
---|
35 | void ELYSE::SteppingAction::UserSteppingAction(const G4Step * theStep){ |
---|
36 | |
---|
37 | G4Track* theTrack = theStep->GetTrack(); |
---|
38 | |
---|
39 | G4StepPoint* thePostPoint = theStep->GetPostStepPoint(); |
---|
40 | G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume(); |
---|
41 | |
---|
42 | |
---|
43 | //JEC START debug Optical surface properties |
---|
44 | // G4StepPoint* pPreStepPoint = theStep->GetPreStepPoint(); |
---|
45 | // G4cout << "(JEC): UserSteppingAction PrePoint Volume:" << pPreStepPoint->GetPhysicalVolume()->GetName() |
---|
46 | // << " PostPoint Volume: " << thePostPV->GetName() |
---|
47 | // << G4endl; |
---|
48 | // G4LogicalSurface* Surface = |
---|
49 | // G4LogicalSkinSurface::GetSurface(pPreStepPoint->GetPhysicalVolume()->GetLogicalVolume()); |
---|
50 | // G4OpticalSurface* OpticalSurface = 0; |
---|
51 | // if (Surface) OpticalSurface = (G4OpticalSurface*) Surface->GetSurfaceProperty(); |
---|
52 | // if (OpticalSurface) { |
---|
53 | // G4cout << "(JEC) UserSteppingAction: Optical Surface Found" << G4endl; |
---|
54 | // OpticalSurface->DumpInfo(); |
---|
55 | // G4MaterialPropertiesTable* aMaterialPropertiesTable; |
---|
56 | // G4MaterialPropertyVector* Rindex; |
---|
57 | // aMaterialPropertiesTable = OpticalSurface->GetMaterialPropertiesTable(); |
---|
58 | |
---|
59 | // if (aMaterialPropertiesTable) { |
---|
60 | // Rindex = aMaterialPropertiesTable->GetProperty("RINDEX"); |
---|
61 | // if (Rindex) { |
---|
62 | // G4cout << "(JEC) Found RINDEX properties: " << G4endl; |
---|
63 | // Rindex->DumpVector(); |
---|
64 | // } else { |
---|
65 | // G4cout << "(JEC) NO RINDEX properties " << G4endl; |
---|
66 | // } |
---|
67 | // } else { |
---|
68 | // G4cout << "(JEC) NO MATERIAL properties " << G4endl; |
---|
69 | // } |
---|
70 | // } else { |
---|
71 | // G4cout << "(JEC) NO OpticalSurface " << G4endl; |
---|
72 | // } |
---|
73 | |
---|
74 | G4OpBoundaryProcessStatus boundaryStatus=Undefined; |
---|
75 | static G4OpBoundaryProcess* boundary=NULL; |
---|
76 | |
---|
77 | if(!thePostPV){//out of world |
---|
78 | return;} |
---|
79 | |
---|
80 | G4ParticleDefinition* particleType = theTrack->GetDefinition(); |
---|
81 | G4String particleName = particleType->GetParticleName(); |
---|
82 | |
---|
83 | //-----------only optical photons |
---|
84 | |
---|
85 | if(particleName == "opticalphoton") { |
---|
86 | |
---|
87 | //------------find the boundary process only once |
---|
88 | if( !boundary ) { |
---|
89 | G4ProcessManager* pm = theStep->GetTrack()->GetDefinition()->GetProcessManager(); |
---|
90 | G4int nprocesses = pm->GetProcessListLength(); |
---|
91 | G4ProcessVector* pv = pm->GetProcessList(); |
---|
92 | G4int i; |
---|
93 | for( i=0;i<nprocesses;i++){ |
---|
94 | if((*pv)[i]->GetProcessName()=="OpBoundary"){ |
---|
95 | boundary = (G4OpBoundaryProcess*)(*pv)[i]; |
---|
96 | break; |
---|
97 | } |
---|
98 | } |
---|
99 | }//set boundary once |
---|
100 | |
---|
101 | //if the OpticalBoundary process is not registered for Optical Photon => FATAL error |
---|
102 | if(!boundary) { |
---|
103 | G4cout << "(JEC) UserSteppingAction: FATAL: NO OpBoundary FOUND" << G4endl; |
---|
104 | exit(0); |
---|
105 | } |
---|
106 | |
---|
107 | //------------Kill photons entering expHall |
---|
108 | |
---|
109 | // G4cout << "(JEC) UserSteppingAction: Post Volume " << thePostPV->GetName() |
---|
110 | // << G4endl; |
---|
111 | |
---|
112 | if(thePostPV->GetName()=="expHall") { |
---|
113 | theTrack->SetTrackStatus(fStopAndKill);} |
---|
114 | |
---|
115 | //----------- |
---|
116 | |
---|
117 | boundaryStatus = boundary->GetStatus(); |
---|
118 | |
---|
119 | // Check to see if the particle was actually at a boundary |
---|
120 | // Otherwise the boundary status may not be valid |
---|
121 | // Prior to Geant4.6.0-p1 this would not have been enough to check |
---|
122 | |
---|
123 | if(thePostPoint->GetStepStatus()==fGeomBoundary) { |
---|
124 | |
---|
125 | //possible G4OpBoundaryProcessStatus { Undefined, |
---|
126 | // FresnelRefraction, FresnelReflection, |
---|
127 | // TotalInternalReflection, |
---|
128 | // LambertianReflection, LobeReflection, |
---|
129 | // SpikeReflection, BackScattering, |
---|
130 | // Absorption, Detection, NotAtBoundary, |
---|
131 | // SameMaterial, StepTooSmall, NoRINDEX} |
---|
132 | // switch(boundaryStatus){ |
---|
133 | // case FresnelRefraction: |
---|
134 | // G4cout << "(JEC) Status of PostPoint: FresnelRefraction" << G4endl; break; |
---|
135 | // case FresnelReflection: |
---|
136 | // G4cout << "(JEC) Status of PostPoint: FresnelReflection" << G4endl; break; |
---|
137 | // case TotalInternalReflection: |
---|
138 | // G4cout << "(JEC) Status of PostPoint: TotalInternalReflection" << G4endl; break; |
---|
139 | // case LambertianReflection: |
---|
140 | // G4cout << "(JEC) Status of PostPoint: LambertianReflection" << G4endl; break; |
---|
141 | // case LobeReflection: |
---|
142 | // G4cout << "(JEC) Status of PostPoint: LobeReflection" << G4endl; break; |
---|
143 | // case SpikeReflection: |
---|
144 | // G4cout << "(JEC) Status of PostPoint: SpikeReflection" << G4endl; break; |
---|
145 | // case Absorption: |
---|
146 | // G4cout << "(JEC) Status of PostPoint: Absorption" << G4endl; break; |
---|
147 | // case Detection: |
---|
148 | // G4cout << "(JEC) Status of PostPoint: Detection" << G4endl; break; |
---|
149 | // case NotAtBoundary: |
---|
150 | // G4cout << "(JEC) Status of PostPoint: NotAtBoundary" << G4endl; break; |
---|
151 | // case SameMaterial: |
---|
152 | // G4cout << "(JEC) Status of PostPoint: SameMaterial" << G4endl; break; |
---|
153 | // case StepTooSmall: |
---|
154 | // G4cout << "(JEC) Status of PostPoint: StepTooSmall" << G4endl; break; |
---|
155 | // case NoRINDEX: |
---|
156 | // G4cout << "(JEC) Status of PostPoint: NoRINDEX" << G4endl; break; |
---|
157 | |
---|
158 | // default: |
---|
159 | // break; |
---|
160 | |
---|
161 | // }//eo switch on boundary values |
---|
162 | |
---|
163 | }//test on GeomBoundary |
---|
164 | |
---|
165 | }//Optical photon |
---|
166 | |
---|
167 | |
---|
168 | }//UserSteppingAction |
---|
169 | |
---|
170 | |
---|
171 | |
---|
172 | |
---|
173 | |
---|
174 | |
---|
175 | |
---|
176 | |
---|
177 | |
---|
178 | |
---|
179 | |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | |
---|
185 | |
---|
186 | |
---|