Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMagneticFieldStepper Class Reference

DMagneticFieldStepper class. More...

#include <DMagneticFieldStepper.h>

Public Member Functions

 DMagneticFieldStepper (const DMagneticFieldMap *map, double q=1.0)
 
 DMagneticFieldStepper (const DMagneticFieldMap *map, double q, const DVector3 *x, const DVector3 *p)
 
 ~DMagneticFieldStepper ()
 
jerror_t SetStartingParams (double q, const DVector3 *x, const DVector3 *p)
 
jerror_t SetMagneticFieldMap (const DMagneticFieldMap *map)
 
jerror_t SetStepSize (double step)
 
void SetCharge (double q)
 
double Step (DVector3 *newpos=NULL, DVector3 *B=NULL, double stepsize=0.0)
 
double FastStep (double stepsize=0.0)
 
void GetDirs (DVector3 &xdir, DVector3 &ydir, DVector3 &zdir)
 
void GetBField (DVector3 &B)
 
void GetMomentum (DVector3 &mom)
 
void GetPosition (DVector3 &pos)
 
double GetCharge (void)
 
void GetPosMom (DVector3 &pos, DVector3 &mom)
 
bool SwimToPlane (DVector3 &pos, DVector3 &mom, const DVector3 &origin, const DVector3 &norm, double *pathlen=NULL)
 
bool DistToPlane (DVector3 &pos, const DVector3 &origin, const DVector3 &norm)
 
bool SwimToRadius (DVector3 &pos, DVector3 &mom, double R, double *pathlen=NULL)
 
bool DistToRadius (DVector3 &pos, double R)
 
double GetRo (void)
 
double Getdz_dphi (void)
 
double GetStepSize (void) const
 
bool SwimToPOCAtoBeamLine (double q, DVector3 &pos, DVector3 &mom)
 

Private Member Functions

void CalcDirs (double *Bvals=NULL)
 

Private Attributes

const DMagneticFieldMapbfield
 pointer to magnetic field map More...
 
double stepsize
 maximum distance(cm) to move particle when Step() is called More...
 
double last_stepsize
 stepsize (cm) used for last step More...
 
double q
 electric charge in units of e More...
 
DVector3 pos
 current position of particle More...
 
DVector3 mom
 current location of particle More...
 
DVector3 start_pos
 starting position of track More...
 
DVector3 start_mom
 starting momentum of track More...
 
DVector3 B
 
double Ro
 
double Rp
 
double cos_theta
 
double sin_theta
 
DVector3 xdir
 
DVector3 ydir
 
DVector3 zdir
 

Detailed Description

DMagneticFieldStepper class.

This class will step a particle track through a magnetic field. It has methods to find the point on the track which comes closest to a specified point in space.

Definition at line 22 of file DMagneticFieldStepper.h.

Constructor & Destructor Documentation

DMagneticFieldStepper::DMagneticFieldStepper ( const DMagneticFieldMap map,
double  q = 1.0 
)

Definition at line 18 of file DMagneticFieldStepper.cc.

DMagneticFieldStepper::DMagneticFieldStepper ( const DMagneticFieldMap map,
double  q,
const DVector3 x,
const DVector3 p 
)

Definition at line 31 of file DMagneticFieldStepper.cc.

References x.

DMagneticFieldStepper::~DMagneticFieldStepper ( )

Definition at line 44 of file DMagneticFieldStepper.cc.

Member Function Documentation

void DMagneticFieldStepper::CalcDirs ( double *  Bvals = NULL)
private

Calculate the directions of the "natural coordinates" (aka reference trajectory coordinate system) in the lab frame using the current momentum and magnetic field at the current position. The results are left in the private member fields, copies of which may be obtained by a subsequent call to the GetDirs(...) and GetRo() methods.

Definition at line 87 of file DMagneticFieldStepper.cc.

References qBr2p.

bool DMagneticFieldStepper::DistToPlane ( DVector3 pos,
const DVector3 origin,
const DVector3 norm 
)

Definition at line 517 of file DMagneticFieldStepper.cc.

bool DMagneticFieldStepper::DistToRadius ( DVector3 pos,
double  R 
)

Definition at line 710 of file DMagneticFieldStepper.cc.

double DMagneticFieldStepper::FastStep ( double  stepsize = 0.0)

Definition at line 160 of file DMagneticFieldStepper.cc.

References py, x, and y.

Referenced by DReferenceTrajectory::FastSwim(), and DReferenceTrajectory::FastSwimForHitSelection().

void DMagneticFieldStepper::GetBField ( DVector3 B)
inline
double DMagneticFieldStepper::GetCharge ( void  )
inline

Definition at line 41 of file DMagneticFieldStepper.h.

References q.

void DMagneticFieldStepper::GetDirs ( DVector3 xdir,
DVector3 ydir,
DVector3 zdir 
)
double DMagneticFieldStepper::Getdz_dphi ( void  )
inline

Definition at line 49 of file DMagneticFieldStepper.h.

References mom, Ro, ydir, and zdir.

void DMagneticFieldStepper::GetMomentum ( DVector3 mom)
inline
void DMagneticFieldStepper::GetPosition ( DVector3 pos)
inline

Definition at line 40 of file DMagneticFieldStepper.h.

References pos.

void DMagneticFieldStepper::GetPosMom ( DVector3 pos,
DVector3 mom 
)
inline
double DMagneticFieldStepper::GetRo ( void  )
inline
double DMagneticFieldStepper::GetStepSize ( void  ) const
inline

Definition at line 50 of file DMagneticFieldStepper.h.

References stepsize.

void DMagneticFieldStepper::SetCharge ( double  q)
inline

Definition at line 33 of file DMagneticFieldStepper.h.

References q.

Referenced by DTrackCandidate_factory_FDCCathodes::GetTrackMatch().

jerror_t DMagneticFieldStepper::SetMagneticFieldMap ( const DMagneticFieldMap map)

Definition at line 66 of file DMagneticFieldStepper.cc.

jerror_t DMagneticFieldStepper::SetStartingParams ( double  q,
const DVector3 x,
const DVector3 p 
)
jerror_t DMagneticFieldStepper::SetStepSize ( double  step)
double DMagneticFieldStepper::Step ( DVector3 newpos = NULL,
DVector3 B = NULL,
double  stepsize = 0.0 
)
bool DMagneticFieldStepper::SwimToPlane ( DVector3 pos,
DVector3 mom,
const DVector3 origin,
const DVector3 norm,
double *  pathlen = NULL 
)

Swim the particle from the given position/momentum to the plane defined by origin and norm. "origin" should define a point somewhere in the plane and norm a vector normal to the plane. The charge of the particle is set by the constructor or last call to SetStartingParameters(...).

If a non-NULL value is passed for pathlen then the pathlength of the track from the given starting position to the intersection point is given.

THE FOLLOWING FEATURE IS CURRENTLY DISABLED! Note that a check is made that the particle is initially going toward the plane. If the particle appears to be going away from the plane, then the momentum is temporarily flipped as well as the charge so that the particle is swum backwards.

Particles will only be swum a distance of MAX_SWIM_DIST (currently hardwired to 20 meters) along their trajectory before returning boolean true indicating failure to intersect the plane.

On success, a value of false is returned and the values in pos and mom will be updated with the position and momentum at the point of intersection with the plane.

Definition at line 358 of file DMagneticFieldStepper.cc.

References alpha, MAX_SWIM_DIST, and sqrt().

Referenced by DTrackCandidate_factory_FDCCathodes::GetTrackMatch().

bool DMagneticFieldStepper::SwimToPOCAtoBeamLine ( double  q,
DVector3 pos,
DVector3 mom 
)

Routine to find the position-of-closest approach of a trajectory to the beam line. Upon entry, q, pos, and mom contain a point on a track pointing away from the beamline. (Beamline is assumed to be along z at x=y=0). At return, the pos and mom vectors will contain the position and momentum at the POCA. Upon success, a boolean "false" is returned. If the routine fails, then a boolean "true" is returned and the values of pos and mom are left to what they were upon entry.

Definition at line 526 of file DMagneticFieldStepper.cc.

bool DMagneticFieldStepper::SwimToRadius ( DVector3 pos,
DVector3 mom,
double  R,
double *  pathlen = NULL 
)

Swim the particle from the point specified by the given position and momentum until it crosses the specified radius R as measured from the beamline.

If a non-NULL value is passed for pathlen then the pathlength of the track from the given starting position to the intersection point is given.

Particles will only be swum a distance of MAX_SWIM_DIST (currently hardwired to 20 meters) along their trajectory before returning boolean true indicating failure to intersect the radius. This can happen if the particle's momentum is too low to reach the radius.

On success, a value of false is returned and the values in pos and mom will be updated with the position and momentum at the point of intersection with the radius.

Definition at line 626 of file DMagneticFieldStepper.cc.

References alpha, MAX_SWIM_DIST, and sqrt().

Member Data Documentation

DVector3 DMagneticFieldStepper::B
private

Definition at line 63 of file DMagneticFieldStepper.h.

Referenced by GetBField().

const DMagneticFieldMap* DMagneticFieldStepper::bfield
private

pointer to magnetic field map

Definition at line 55 of file DMagneticFieldStepper.h.

double DMagneticFieldStepper::cos_theta
private

Definition at line 65 of file DMagneticFieldStepper.h.

double DMagneticFieldStepper::last_stepsize
private

stepsize (cm) used for last step

Definition at line 57 of file DMagneticFieldStepper.h.

DVector3 DMagneticFieldStepper::mom
private

current location of particle

Definition at line 60 of file DMagneticFieldStepper.h.

Referenced by Getdz_dphi(), GetMomentum(), and GetPosMom().

DVector3 DMagneticFieldStepper::pos
private

current position of particle

Definition at line 59 of file DMagneticFieldStepper.h.

Referenced by GetPosition(), and GetPosMom().

double DMagneticFieldStepper::q
private

electric charge in units of e

Definition at line 58 of file DMagneticFieldStepper.h.

Referenced by GetCharge(), and SetCharge().

double DMagneticFieldStepper::Ro
private

Definition at line 64 of file DMagneticFieldStepper.h.

Referenced by Getdz_dphi(), and GetRo().

double DMagneticFieldStepper::Rp
private

Definition at line 64 of file DMagneticFieldStepper.h.

double DMagneticFieldStepper::sin_theta
private

Definition at line 65 of file DMagneticFieldStepper.h.

DVector3 DMagneticFieldStepper::start_mom
private

starting momentum of track

Definition at line 62 of file DMagneticFieldStepper.h.

DVector3 DMagneticFieldStepper::start_pos
private

starting position of track

Definition at line 61 of file DMagneticFieldStepper.h.

double DMagneticFieldStepper::stepsize
private

maximum distance(cm) to move particle when Step() is called

Definition at line 56 of file DMagneticFieldStepper.h.

Referenced by GetStepSize().

DVector3 DMagneticFieldStepper::xdir
private

Definition at line 67 of file DMagneticFieldStepper.h.

DVector3 DMagneticFieldStepper::ydir
private

Definition at line 67 of file DMagneticFieldStepper.h.

Referenced by Getdz_dphi().

DVector3 DMagneticFieldStepper::zdir
private

Definition at line 67 of file DMagneticFieldStepper.h.

Referenced by Getdz_dphi().


The documentation for this class was generated from the following files: