21 G4Step *theStep =
const_cast<G4Step *
>(myStep);
23 G4Track *theTrack = theStep->GetTrack();
27 G4TrackStatus isGood = theTrack->GetTrackStatus();
29 LogDebug(
"LaserAlignmentSimulationStepping")
30 <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: AC1CMS: "
31 "the PreStep Material = "
32 << theStep->GetPreStepPoint()->GetMaterial()->GetName()
33 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: "
34 "AC1CMS: The Track Status = "
36 if (isGood == fStopAndKill)
37 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: "
38 "AC1CMS: Track Status = fStopAndKill ";
40 if (theStep->GetPreStepPoint()->GetProcessDefinedStep() !=
nullptr)
41 LogDebug(
"LaserAlignmentSimulationStepping")
42 <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: "
43 "AC1CMS: PreStep Process = "
44 << theStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
45 if (theStep->GetPostStepPoint()->GetProcessDefinedStep() !=
nullptr)
46 LogDebug(
"LaserAlignmentSimulationStepping")
47 <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: "
48 "AC1CMS: PostStep Process = "
49 << theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
54 if ((theStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() ==
"OpAbsorption")) {
55 LogDebug(
"LaserAlignmentStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step*)>: Photon "
58 if (theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetSensitiveDetector()) {
63 if (((theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 &&
64 theStep->GetPreStepPoint()->GetPosition().z() < 1382.5) ||
65 (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 &&
66 theStep->GetPreStepPoint()->GetPosition().z() > -1382.5)) &&
67 (((theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 &&
68 theStep->GetPreStepPoint()->GetPosition().phi() < 1.295) ||
69 (theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 &&
70 theStep->GetPreStepPoint()->GetPosition().phi() < 1.86) ||
71 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 3.63 &&
72 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 3.66) ||
73 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.20 &&
74 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.23) ||
75 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.76 &&
76 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.80)))) {
77 theStep->AddTotalEnergyDeposit(EnergyLoss);
80 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1262.5 &&
81 theStep->GetPreStepPoint()->GetPosition().z() < 1382.5) ||
82 (theStep->GetPreStepPoint()->GetPosition().z() < -1262.5 &&
83 theStep->GetPreStepPoint()->GetPosition().z() > -1382.5)) {
84 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2 * 0.2 * 0.2));
87 else if (((theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 &&
88 theStep->GetPreStepPoint()->GetPosition().z() < 1522.5) ||
89 (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 &&
90 theStep->GetPreStepPoint()->GetPosition().z() > -1522.5)) &&
91 (((theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 &&
92 theStep->GetPreStepPoint()->GetPosition().phi() < 1.295) ||
93 (theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 &&
94 theStep->GetPreStepPoint()->GetPosition().phi() < 1.86) ||
95 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 3.63 &&
96 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 3.66) ||
97 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.20 &&
98 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.23) ||
99 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.76 &&
100 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.80)))) {
101 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2));
104 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1402.5 &&
105 theStep->GetPreStepPoint()->GetPosition().z() < 1522.5) ||
106 (theStep->GetPreStepPoint()->GetPosition().z() < -1402.5 &&
107 theStep->GetPreStepPoint()->GetPosition().z() > -1522.5)) {
108 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2 * 0.2));
111 else if (((theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 &&
112 theStep->GetPreStepPoint()->GetPosition().z() < 1662.5) ||
113 (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 &&
114 theStep->GetPreStepPoint()->GetPosition().z() > -1662.5)) &&
115 (((theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 &&
116 theStep->GetPreStepPoint()->GetPosition().phi() < 1.295) ||
117 (theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 &&
118 theStep->GetPreStepPoint()->GetPosition().phi() < 1.86) ||
119 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 3.63 &&
120 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 3.66) ||
121 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.20 &&
122 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.23) ||
123 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.76 &&
124 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.80)))) {
125 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2));
128 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1542.5 &&
129 theStep->GetPreStepPoint()->GetPosition().z() < 1662.5) ||
130 (theStep->GetPreStepPoint()->GetPosition().z() < -1542.5 &&
131 theStep->GetPreStepPoint()->GetPosition().z() > -1662.5)) {
132 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2));
135 else if (((theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 &&
136 theStep->GetPreStepPoint()->GetPosition().z() < 1802.5) ||
137 (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 &&
138 theStep->GetPreStepPoint()->GetPosition().z() > -1802.5)) &&
139 (((theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 &&
140 theStep->GetPreStepPoint()->GetPosition().phi() < 1.295) ||
141 (theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 &&
142 theStep->GetPreStepPoint()->GetPosition().phi() < 1.86) ||
143 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 3.63 &&
144 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 3.66) ||
145 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.20 &&
146 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.23) ||
147 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.76 &&
148 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.80)))) {
149 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2 * 0.2));
152 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1682.5 &&
153 theStep->GetPreStepPoint()->GetPosition().z() < 1802.5) ||
154 (theStep->GetPreStepPoint()->GetPosition().z() < -1682.5 &&
155 theStep->GetPreStepPoint()->GetPosition().z() > -1802.5)) {
156 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2));
159 else if (((theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 &&
160 theStep->GetPreStepPoint()->GetPosition().z() < 1942.5) ||
161 (theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 &&
162 theStep->GetPreStepPoint()->GetPosition().z() > -1942.5)) &&
163 (((theStep->GetPreStepPoint()->GetPosition().phi() > 1.285 &&
164 theStep->GetPreStepPoint()->GetPosition().phi() < 1.295) ||
165 (theStep->GetPreStepPoint()->GetPosition().phi() > 1.84 &&
166 theStep->GetPreStepPoint()->GetPosition().phi() < 1.86) ||
167 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 3.63 &&
168 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 3.66) ||
169 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.20 &&
170 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.23) ||
171 (theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI > 5.76 &&
172 theStep->GetPreStepPoint()->GetPosition().phi() + 2.0 *
M_PI < 5.80)))) {
173 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2 * 0.2 * 0.2));
176 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1822.5 &&
177 theStep->GetPreStepPoint()->GetPosition().z() < 1942.5) ||
178 (theStep->GetPreStepPoint()->GetPosition().z() < -1822.5 &&
179 theStep->GetPreStepPoint()->GetPosition().z() > -1942.5)) {
180 theStep->AddTotalEnergyDeposit(EnergyLoss);
183 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 1997.5 &&
184 theStep->GetPreStepPoint()->GetPosition().z() < 2117.5) ||
185 (theStep->GetPreStepPoint()->GetPosition().z() < -1997.5 &&
186 theStep->GetPreStepPoint()->GetPosition().z() > -2117.5)) {
187 theStep->AddTotalEnergyDeposit(EnergyLoss);
190 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 2187.5 &&
191 theStep->GetPreStepPoint()->GetPosition().z() < 2307.5) ||
192 (theStep->GetPreStepPoint()->GetPosition().z() < -2187.5 &&
193 theStep->GetPreStepPoint()->GetPosition().z() > -2307.5)) {
194 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2));
197 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 2392.5 &&
198 theStep->GetPreStepPoint()->GetPosition().z() < 2512.5) ||
199 (theStep->GetPreStepPoint()->GetPosition().z() < -2392.5 &&
200 theStep->GetPreStepPoint()->GetPosition().z() > -2512.5)) {
201 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2));
204 else if ((theStep->GetPreStepPoint()->GetPosition().z() > 2607.5 &&
205 theStep->GetPreStepPoint()->GetPosition().z() < 2727.5) ||
206 (theStep->GetPreStepPoint()->GetPosition().z() < -2607.5 &&
207 theStep->GetPreStepPoint()->GetPosition().z() > -2727.5)) {
208 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2 * 0.2));
211 else if ((theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
212 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
213 (theStep->GetPreStepPoint()->GetPosition().perp() > 500.0 &&
214 theStep->GetPreStepPoint()->GetPosition().perp() < 630.0)) {
215 theStep->AddTotalEnergyDeposit(EnergyLoss / (0.2 * 0.2));
221 theStep->ResetTotalEnergyDeposit();
231 else if (((theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TOB_Wafer") &&
232 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air"))) {
233 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
234 theTrack->SetTrackStatus(fStopAndKill);
235 }
else if ((theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
236 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
237 (theStep->GetPreStepPoint()->GetPosition().perp() > 630.0)) {
238 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
239 theTrack->SetTrackStatus(fStopAndKill);
244 else if (((theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TIB_Wafer") &&
245 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air"))) {
246 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
247 theTrack->SetTrackStatus(fStopAndKill);
248 }
else if ((theStep->GetPreStepPoint()->GetPosition().z() > -870.0 &&
249 theStep->GetPreStepPoint()->GetPosition().z() < 1050.0) &&
250 (theStep->GetPreStepPoint()->GetPosition().perp() < 500.0)) {
251 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! ";
252 theTrack->SetTrackStatus(fStopAndKill);
256 else if ((((theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TEC_Wafer") &&
257 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"T_Air")) ||
258 ((theStep->GetPreStepPoint()->GetMaterial()->GetName() ==
"TEC_Wafer") &&
259 (theStep->GetPostStepPoint()->GetMaterial()->GetName() ==
"Air"))) &&
260 (theStep->GetPreStepPoint()->GetMomentum().z() != theStep->GetPostStepPoint()->GetMomentum().z()) &&
261 (theStep->GetPostStepPoint()->GetPosition().z() == -1137.25)) {
262 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! photon in wrong direction";
263 theTrack->SetTrackStatus(fStopAndKill);
267 else if ((theStep->GetPostStepPoint()->GetPosition().z() > -1100.0) &&
268 (theStep->GetPostStepPoint()->GetPosition().z() < 1100.0) &&
269 (theStep->GetPostStepPoint()->GetMomentumDirection().z() > 0.8)) {
270 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping aborted! photon in wrong direction";
271 theTrack->SetTrackStatus(fStopAndKill);
273 LogDebug(
"LaserAlignmentSimulationStepping") <<
" AC1CMS: stepping continuous ... ";
278 if (theTrack->GetTrackStatus() != fAlive) {
279 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track "
280 "is not alive! -> return ";
285 if (theTrack->GetParentID() != 0) {
286 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: Track "
287 "is not a primary! -> return ";
293 G4ParticleDefinition *theOpticalType = theTrack->GetDefinition();
294 if (theOpticalType == G4OpticalPhoton::OpticalPhotonDefinition()) {
295 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: "
296 "Optical Photon found! ";
301 G4StepPoint *thePreStepPoint = theStep->GetPreStepPoint();
302 G4VPhysicalVolume *thePreStepPhysicalVolume = thePreStepPoint->GetPhysicalVolume();
303 G4String thePreStepPhysicalVolumeName = thePreStepPhysicalVolume->GetName();
304 G4Material *thePreStepMaterial = thePreStepPoint->GetMaterial();
306 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
307 "PreStep Position = "
308 << thePreStepPoint->GetPosition()
309 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
310 "PreStep Physical Volume = "
311 << thePreStepPhysicalVolumeName
312 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
314 << thePreStepMaterial->GetName();
316 G4StepPoint *thePostStepPoint = theStep->GetPostStepPoint();
317 G4VPhysicalVolume *thePostStepPhysicalVolume = thePostStepPoint->GetPhysicalVolume();
318 G4String thePostStepPhysicalVolumeName = thePostStepPhysicalVolume->GetName();
319 G4Material *thePostStepMaterial = thePostStepPoint->GetMaterial();
321 LogDebug(
"LaserAlignmentSimulationStepping") <<
"<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
322 "PostStep Position = "
323 << thePostStepPoint->GetPosition()
324 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
325 "PostStep Physical Volume = "
326 << thePostStepPhysicalVolumeName
327 <<
"\n<LaserSteppingAction::UserSteppingAction(const G4Step *)>: the "
328 "PostStep Material = "
329 << thePostStepMaterial->GetName();
double theEnergyLossScalingFactor