141{
142 G4double geometryStepLength;
144
145
146
147
148
149
150
151
152
153
155
156
157
158 const G4DynamicParticle* pParticle =
track.GetDynamicParticle() ;
159 G4ParticleDefinition* pParticleDef = pParticle->GetDefinition() ;
160 G4ThreeVector startPosition =
track.GetPosition() ;
161
162
163
164
165
166
167
169 G4double MagSqShift = OriginShift.mag2() ;
171 {
172 currentSafety = 0.0 ;
173 }
174 else
175 {
177 }
178
179
180
181 G4double particleCharge = pParticle->GetCharge() ;
182
183
184
185
186
187
189 if (fieldMgr != 0) {
190
191 fieldMgr->ConfigureForTrack( &track );
192 } else {
193 G4Exception("QuirkTransportation::AlongStepGetPhysicalInteractionLength", "QuirkNoFieldMgr", RunMustBeAborted, "no field manager");
194 }
195
196
197 Quirk* quirkDef = dynamic_cast<Quirk*>(pParticleDef);
198 if (quirkDef == 0) {
199 G4Exception("QuirkTransportation::AlongStepGetPhysicalInteractionLength", "NonQuirk", FatalErrorInArgument, "QuirkTransportation run on non-quirk particle");
200 std::abort();
201 }
202 HyperbolaStepper quirkStepper(
204 track,
205 fieldMgr->DoesFieldExist() ? fieldMgr->GetDetectorField() : 0
206 );
207
208
209 G4ChordFinder* oldChordFinder = fieldMgr->GetChordFinder();
210 G4ChordFinder quirkChordFinder(
211 new G4MagInt_Driver(0.0, &quirkStepper, quirkStepper.GetNumberOfVariables())
212 );
213 fieldMgr->SetChordFinder(&quirkChordFinder);
214
215 G4double momentumMagnitude = pParticle->GetTotalMomentum() ;
216 G4ThreeVector EndUnitMomentum ;
217 G4double restMass = pParticleDef->GetPDGMass() ;
218
219#if G4VERSION_NUMBER > 1009
220
221 G4ChargeState chargeState(particleCharge,
222 quirkDef->GetPDGSpin(),
223 0,
224 0,
225 0);
226 G4EquationOfMotion* equationOfMotion = (
m_fieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetStepper())->GetEquationOfMotion();
227 equationOfMotion->SetChargeMomentumMass( chargeState,
228 momentumMagnitude,
229 restMass ) ;
230#else
232 momentumMagnitude,
233 restMass ) ;
234#endif
235
236 G4ThreeVector
spin =
track.GetPolarization() ;
237 G4FieldTrack aFieldTrack = G4FieldTrack( startPosition,
238 track.GetMomentumDirection(),
239 0.0,
240 track.GetKineticEnergy(),
241 restMass,
243 track.GetGlobalTime(),
244 0.0,
246
247
248
249
250
251
252
253
254
255
257 quirkStepper.SetDebug(dbg);
258 if (dbg) G4cout << "QuirkTransportation: start = " << aFieldTrack.GetPosition() << G4endl;
259 if (dbg) G4cout << "QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
260 if (dbg) G4cout << "QuirkTransportation: maxlength = " << quirkStepper.GetMaxLength() << G4endl;
261 currentMinimumStep = std::min(currentMinimumStep, quirkStepper.GetMaxLength());
262 if (dbg) G4cout << "QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
263 if( currentMinimumStep > 0 )
264 {
265
267 currentMinimumStep,
268 currentSafety,
269 track.GetVolume() ) ;
270 if (dbg) G4cout << "QuirkTransportation: moved " << lengthAlongCurve << G4endl;
273 geometryStepLength = lengthAlongCurve ;
274 } else {
275 geometryStepLength = currentMinimumStep ;
276 }
277
279 }
280 else
281 {
282 geometryStepLength = 0.0 ;
284 }
285 if (dbg) G4cout << "QuirkTransportation: moved " << aFieldTrack.GetCurveLength() << G4endl;
286 if (dbg) G4cout << "QuirkTransportation: end = " << aFieldTrack.GetPosition() << " [" << aFieldTrack.GetProperTimeOfFlight() << "]" << G4endl;
287
288
289
292
293
294
295 geometryStepLength = aFieldTrack.GetCurveLength();
304
305
306
307
308 if( currentMinimumStep == 0.0 )
309 {
311 }
312
313
314
315
317 {
318 G4double endSafety =
320 currentSafety = endSafety ;
324
325
326
327
329
330#ifdef G4DEBUG_TRANSPORT
331 G4cout.precision(12) ;
332 G4cout << "***QuirkTransportation::AlongStepGPIL ** " << G4endl ;
334 << " and it returned safety= " << endSafety << G4endl ;
336 << " to obtain pseudo-safety= " << currentSafety << G4endl ;
337#endif
338 }
339
341
342
343 fieldMgr->SetChordFinder(oldChordFinder);
344
345 return geometryStepLength ;
346}
Scalar mag() const
mag method
const InfracolorForce & GetStringIn() const
const std::string selection