Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

SwimDefStepper::DerivFunc Class Reference

#include <SwimDefStepper.h>

Inheritance diagram for SwimDefStepper::DerivFunc:

NmOdeDerivFunc List of all members.

Public Member Functions

 DerivFunc ()
 DerivFunc (double q, BField *f)
virtual ~DerivFunc ()
void SetChargeBField (double q, BField *b)
virtual void operator() (double x, const double *y, double *dydx)

Private Attributes

double fForceCoef
BFieldfBfield

Constructor & Destructor Documentation

SwimDefStepper::DerivFunc::DerivFunc  )  [inline]
 

Definition at line 50 of file SwimDefStepper.h.

References fBfield.

00050 : fBfield(0) {;}

SwimDefStepper::DerivFunc::DerivFunc double  q,
BField f
 

Definition at line 125 of file SwimDefStepper.cxx.

References SetChargeBField().

00126 {
00127   // Initialize force coeff. and BField
00128   this->SetChargeBField(q,b);
00129 }

virtual SwimDefStepper::DerivFunc::~DerivFunc  )  [inline, virtual]
 

Definition at line 52 of file SwimDefStepper.h.

00052 {;}


Member Function Documentation

void SwimDefStepper::DerivFunc::operator() double  x,
const double *  y,
double *  dydx
[virtual]
 

Implements NmOdeDerivFunc.

Definition at line 144 of file SwimDefStepper.cxx.

References fBfield, fForceCoef, and BField::GetBField().

00147 {
00148   //const double oneOverSqrt2 = 1./sqrt(2.);
00149   // y[0] - x coordinate (base length units)
00150   // y[1] - y coordinate (base length units)
00151   // y[2] - z coordinate (base length units)
00152   // y[3] - x momentum   (base momentum units)
00153   // y[4] - y momentum   (base momentum units)
00154   // y[5] - z momentum   (base momentum units)
00155   double ptotSqr = y[3]*y[3]+y[4]*y[4]+y[5]*y[5];
00156   if (ptotSqr != 0.0) {
00157     double oneOverPtot = 1.0/TMath::Sqrt(ptotSqr);      
00158     dydx[0] = y[3]*oneOverPtot; // (d/ds)x = Px/Ptot
00159     dydx[1] = y[4]*oneOverPtot; // (d/ds)y = Py/Ptot
00160     dydx[2] = y[5]*oneOverPtot; // (d/ds)z = Pz/Ptot
00161     
00162     //the point is passed in in xyz, even though the measurements are in uvz - 
00163     //the rotation is done in the fitter.
00164     TVector3 xyz(y[0],y[1],y[2]);
00165 
00166     //since the Bfield is also in xyz, we are all happy.
00167     TVector3 B = fBfield->GetBField(xyz);
00168 
00169     // Calculate derivatives
00170     double qOverE = fForceCoef*oneOverPtot;
00171     dydx[3] = (y[4]*B[2]-y[5]*B[1])*qOverE; // dP/ds = q*(p x B)/E/v
00172     dydx[4] = (y[5]*B[0]-y[3]*B[2])*qOverE; // dP/ds = q*(p x B)/E/v
00173     dydx[5] = (y[3]*B[1]-y[4]*B[0])*qOverE; // dP/ds = q*(p x B)/E/v
00174   }
00175   else {
00176     // Particle is stopped
00177     dydx[0] = 0.0;
00178     dydx[1] = 0.0;
00179     dydx[2] = 0.0;
00180     dydx[3] = 0.0;
00181     dydx[4] = 0.0;
00182     dydx[5] = 0.0;
00183   }
00184 }

void SwimDefStepper::DerivFunc::SetChargeBField double  q,
BField b
 

Definition at line 133 of file SwimDefStepper.cxx.

References fBfield, and fForceCoef.

Referenced by DerivFunc(), and SwimDefStepper::StepOnce().

00134 {
00135   // The units conversion is c[m/s]*[eV]/[GeV]
00136   static const double unitsC = 
00137     (Mphysical::c_light/(Munits::m/Munits::s))/1.0e9;
00138   fForceCoef = unitsC*q;
00139   fBfield    = b;
00140 }


Member Data Documentation

BField* SwimDefStepper::DerivFunc::fBfield [private]
 

Definition at line 57 of file SwimDefStepper.h.

Referenced by DerivFunc(), operator()(), and SetChargeBField().

double SwimDefStepper::DerivFunc::fForceCoef [private]
 

Definition at line 56 of file SwimDefStepper.h.

Referenced by operator()(), and SetChargeBField().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:21 2010 for loon by  doxygen 1.3.9.1