| Summary: | Spin Tracking using G4Mag_SpinEqRhs sets Track polarization to 0 | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Chris Rogers <chris.rogers> |
| Component: | geometry/magneticfield | Assignee: | gum |
| Status: | RESOLVED INVALID | ||
| Severity: | trivial | ||
| Priority: | P5 | ||
| Version: | other | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Chris Rogers
2014-03-11 18:14:44 CET
Apologies, I should add that I am using G4.9.6.p02 Dear Chris, Thank you for reporting this. The examples for the propagation in field are potentially not clear enough, but the correct value for the number of variables required is 12. To be certain, you can refer to the "G4FieldTrack" class and its method DumpToArray which turns the information from data members of a class into variables which will be integrated by the stepper. You can see that the polarization (called spin) resides in elements 9-11, so the size must be at least 12: valArr[9]=fSpin.x(); valArr[10]=fSpin.y(); valArr[11]=fSpin.z(); Here is a link to the relevant lines of code in release 10.0. http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/include/G4FieldTrack.icc?v=10.0#L213 ( This code has been stable for an extended period of time. ) Best regards, John There is a chapter specifically for 'spin tracking' in the Application Developer's Guide: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s03.html#sect.EMField.Spin In it, you'll find: In order to track the spin of a particle in a magnetic field, you need to code the following: 1. in your DetectorConstruction #include "G4Mag_SpinEqRhs.hh" G4Mag_EqRhs* fEquation = new G4Mag_SpinEqRhs(magField); G4MagIntegratorStepper* pStepper = new G4ClassicalRK4(fEquation,12); notice the 12 The 'notice the 12' is in bold letters. |