Message: Trajectories in a Magnetic field. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Trajectories in a Magnetic field. 

Forum: Fields: Magnetic and Otherwise
Re: None How to make custom magnetic field class? (Tim Chambers)
Date: 31 Jul, 2006
From: Ryan Romero <ryan3523@neo.tamu.edu>

Hi. I was hoping someone could help me with a few questions about magenetic fields. I think I have one defined, I've included that code below.

Have I propely defined a field that exists within a particular rectangular region and drops off with first power distance from the z axis? Just to keep things simple I only care about distance along a single axis(y).

Supposing I've defined the magnetic field as I like it, how do I incorporate it into my code so that it will affect trajectories? I saw a method AddTrajectory() but I didn't see it implemented in the N02 code. I assume its defined in the source code for GEant4 but I want to avoid altering that if possible.

Thanks for any help.

#include "ExN01Field.hh"

ExN01Field::ExN01Field()
{
  BzMax = 6.87*tesla;
  rmax_sq = sqr(50.*cm);
  zmax = 450.*cm;
  xmax= 50.*cm;
  ymax= 275.*cm;
  ymin=250.*cm;
}

ExN01Field::~ExN01Field() {;}

void ExN01Field::GetFieldValue(const double Point[3],double *Bfield) const
{
  Bfield[0] = 0.;
  Bfield[1] = 0.;
  if(std::abs(Point[2])<zmax && std::abs(Point[0])<xmax &&
  std::abs(Point[1]-525.*cm)<ymax )
  { Bfield[2] = BzMax*ymin/Point[1]; }
  else
  { Bfield[2] = 0.; }
}

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Trajectories in a Magnetic field."

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]