|Message: Re: How to set up magnetic and gravity field||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
> I have an existing simulation, which simulates the transport of ultra > cold neutrons in a gravity field. I have to implement spin tracking in a > magnetic field to this existing simulation.
> As far as I know, the current geant version (9.6) supports spintracking > for UCN out of the box. My problem is, that I don't know how to > implement the magnetic field and keep the gravity field.
Currently, in version 9.6, we provide for only the situation of either tracking in the gravity field or spin tracking in a EM field but not both. So, you'll have to write your own derived G4EquationOfMotion and G4Field classes. The two have to have an 'agreed convention' as to which components of the field correspond to gravity and magnetic field. You can recycle the code found in:
G4EqGravityField, G4Mag_SpinEqRhs and G4UniformGravityField, G4MagneticField
with the convention, for example, that in Field [0-2] is the magn. field and [3-5] is the gravity field (similar to G4EqEMFieldWithSpin and G4ElectroMagneticField for B and E fields).
> Do I have to create a second fieldmanager and asign it to a logic volume > (e.g. logicworld)?
> Or is it possible to just create one field, which is > magnetic and gravity at once?
> A link to an example where two fields are > implemented would probably also help; I didn't find an example...
I am attaching some code that won't work with 9.6 as it is already developed with the next release in mind, but you'll get the idea what you'll need to be coding. This is the full blown all possibilities/options version of the EofM, including:
// Force due to B field - Field[0,1,2] // add force due to E field - Field[3,4,5] // add force due to gravity field - Field[6,7,8] // add force due to grad(µ⋅B) == (µ⋅grad)B when (gradxB) = 0
and spin tracking.
Hope this helps, Peter