Geant4  10.02.p03
G4FieldTrack Class Reference

#include <G4FieldTrack.hh>

Collaboration diagram for G4FieldTrack:

Public Types

enum  { ncompSVEC = 12 }
 

Public Member Functions

 G4FieldTrack (const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy, G4double restMass_c2, G4double charge, const G4ThreeVector &polarization, G4double magnetic_dipole_moment=0.0, G4double curve_length=0.0, G4double PDGspin=-1.0)
 
 G4FieldTrack (const G4FieldTrack &pFieldTrack)
 
 G4FieldTrack (char)
 
 ~G4FieldTrack ()
 
void UpdateState (const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy)
 
void UpdateFourMomentum (G4double kineticEnergy, const G4ThreeVector &momentumDirection)
 
void SetChargeAndMoments (G4double charge, G4double magnetic_dipole_moment=DBL_MAX, G4double electric_dipole_moment=DBL_MAX, G4double magnetic_charge=DBL_MAX)
 
void SetPDGSpin (G4double pdgSpin)
 
G4double GetPDGSpin ()
 
 G4FieldTrack (const G4ThreeVector &pPosition, const G4ThreeVector &pMomentumDirection, G4double curve_length, G4double kineticEnergy, const G4double restMass_c2, G4double velocity, G4double LaboratoryTimeOfFlight=0.0, G4double ProperTimeOfFlight=0.0, const G4ThreeVector *pPolarization=0, G4double PDGspin=-1.0)
 
G4FieldTrackoperator= (const G4FieldTrack &rStVec)
 
G4ThreeVector GetMomentum () const
 
G4ThreeVector GetPosition () const
 
const G4ThreeVectorGetMomentumDir () const
 
G4ThreeVector GetMomentumDirection () const
 
G4double GetCurveLength () const
 
G4ThreeVector GetPolarization () const
 
void SetPolarization (const G4ThreeVector &vecPol)
 
G4double GetLabTimeOfFlight () const
 
G4double GetProperTimeOfFlight () const
 
G4double GetKineticEnergy () const
 
G4double GetCharge () const
 
G4double GetRestMass () const
 
void SetPosition (G4ThreeVector nPos)
 
void SetMomentum (G4ThreeVector nMomDir)
 
void SetMomentumDir (G4ThreeVector nMomDir)
 
void SetRestMass (G4double Mass_c2)
 
void SetCurveLength (G4double nCurve_s)
 
void SetKineticEnergy (G4double nEnergy)
 
void SetLabTimeOfFlight (G4double tofLab)
 
void SetProperTimeOfFlight (G4double tofProper)
 
void DumpToArray (G4double valArr[ncompSVEC]) const
 
void LoadFromArray (const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
 
void InitialiseSpin (const G4ThreeVector &vecPolarization)
 
G4ThreeVector GetSpin () const
 
void SetSpin (G4ThreeVector vSpin)
 
const G4ChargeStateGetChargeState () const
 

Private Member Functions

G4FieldTrackSetCurvePnt (const G4ThreeVector &pPosition, const G4ThreeVector &pMomentum, G4double s_curve)
 

Private Attributes

G4double SixVector [6]
 
G4double fDistanceAlongCurve
 
G4double fKineticEnergy
 
G4double fRestMass_c2
 
G4double fLabTimeOfFlight
 
G4double fProperTimeOfFlight
 
G4ThreeVector fPolarization
 
G4ThreeVector fMomentumDir
 
G4ChargeState fChargeState
 

Friends

std::ostream & operator<< (std::ostream &os, const G4FieldTrack &SixVec)
 

Detailed Description

Definition at line 54 of file G4FieldTrack.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ncompSVEC 

Definition at line 149 of file G4FieldTrack.hh.

Constructor & Destructor Documentation

◆ G4FieldTrack() [1/4]

G4FieldTrack::G4FieldTrack ( const G4ThreeVector pPosition,
G4double  LaboratoryTimeOfFlight,
const G4ThreeVector pMomentumDirection,
G4double  kineticEnergy,
G4double  restMass_c2,
G4double  charge,
const G4ThreeVector polarization,
G4double  magnetic_dipole_moment = 0.0,
G4double  curve_length = 0.0,
G4double  PDGspin = -1.0 
)

Definition at line 72 of file G4FieldTrack.cc.

82 : fDistanceAlongCurve(curve_length),
83  fKineticEnergy(kineticEnergy),
84  fRestMass_c2(restMass_c2),
85  fLabTimeOfFlight(LaboratoryTimeOfFlight),
87  // fMomentumDir(pMomentumDirection),
88  fChargeState( charge, magnetic_dipole_moment, pdgSpin )
89  // fChargeState( charge, magnetic_dipole_moment ) ,
90  // fPDGSpin( pdgSpin )
91 {
92  UpdateFourMomentum( kineticEnergy, pMomentumDirection );
93  // Sets momentum direction as well.
94 
95  SetPosition( pPosition );
96 
97  SetPolarization( vecPolarization );
98 }
void SetPosition(G4ThreeVector nPos)
void SetPolarization(const G4ThreeVector &vecPol)
G4double fLabTimeOfFlight
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
G4double fDistanceAlongCurve
G4double fKineticEnergy
G4double fRestMass_c2
G4double fProperTimeOfFlight
G4ChargeState fChargeState
Here is the call graph for this function:
Here is the caller graph for this function:

◆ G4FieldTrack() [2/4]

G4FieldTrack::G4FieldTrack ( const G4FieldTrack pFieldTrack)

◆ G4FieldTrack() [3/4]

G4FieldTrack::G4FieldTrack ( char  )

Definition at line 128 of file G4FieldTrack.cc.

131 {
132  G4ThreeVector Zero(0.0, 0.0, 0.0);
133  SetCurvePnt( Zero, Zero, 0.0 );
134  SetPolarization( Zero );
135  // fInitialMomentumMag= 0.00; // Invalid
136  // fLastMomentumMag= 0.0;
137 }
void SetPolarization(const G4ThreeVector &vecPol)
G4double fLabTimeOfFlight
G4double fKineticEnergy
G4double fRestMass_c2
G4double fProperTimeOfFlight
#define DBL_MAX
Definition: templates.hh:83
G4FieldTrack & SetCurvePnt(const G4ThreeVector &pPosition, const G4ThreeVector &pMomentum, G4double s_curve)
G4ChargeState fChargeState
Here is the call graph for this function:

◆ ~G4FieldTrack()

G4FieldTrack::~G4FieldTrack ( )

◆ G4FieldTrack() [4/4]

G4FieldTrack::G4FieldTrack ( const G4ThreeVector pPosition,
const G4ThreeVector pMomentumDirection,
G4double  curve_length,
G4double  kineticEnergy,
const G4double  restMass_c2,
G4double  velocity,
G4double  LaboratoryTimeOfFlight = 0.0,
G4double  ProperTimeOfFlight = 0.0,
const G4ThreeVector pPolarization = 0,
G4double  PDGspin = -1.0 
)

Definition at line 100 of file G4FieldTrack.cc.

110  : fDistanceAlongCurve(curve_length),
111  fKineticEnergy(kineticEnergy),
112  fRestMass_c2(restMass_c2),
113  fLabTimeOfFlight(pLaboratoryTimeOfFlight),
114  fProperTimeOfFlight(pProperTimeOfFlight),
115  fChargeState( DBL_MAX, DBL_MAX, -1.0 ) // charge not set
116 {
117  UpdateFourMomentum( kineticEnergy, pMomentumDirection );
118  // Sets momentum direction as well.
119 
120  SetPosition( pPosition );
121  fChargeState.SetPDGSpin( pdgSpin );
122 
123  G4ThreeVector PolarVec(0.0, 0.0, 0.0);
124  if( pPolarization ) { PolarVec= *pPolarization; }
125  SetPolarization( PolarVec );
126 }
void SetPosition(G4ThreeVector nPos)
void SetPolarization(const G4ThreeVector &vecPol)
G4double fLabTimeOfFlight
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
G4double fDistanceAlongCurve
G4double fKineticEnergy
G4double fRestMass_c2
G4double fProperTimeOfFlight
#define DBL_MAX
Definition: templates.hh:83
G4ChargeState fChargeState
void SetPDGSpin(G4double spin)
Here is the call graph for this function:

Member Function Documentation

◆ DumpToArray()

void G4FieldTrack::DumpToArray ( G4double  valArr[ncompSVEC]) const
inline
Here is the caller graph for this function:

◆ GetCharge()

G4double G4FieldTrack::GetCharge ( ) const
inline
Here is the caller graph for this function:

◆ GetChargeState()

const G4ChargeState* G4FieldTrack::GetChargeState ( ) const
inline

Definition at line 185 of file G4FieldTrack.hh.

185 { return &fChargeState; }
G4ChargeState fChargeState
Here is the caller graph for this function:

◆ GetCurveLength()

G4double G4FieldTrack::GetCurveLength ( ) const
inline
Here is the caller graph for this function:

◆ GetKineticEnergy()

G4double G4FieldTrack::GetKineticEnergy ( ) const
inline
Here is the caller graph for this function:

◆ GetLabTimeOfFlight()

G4double G4FieldTrack::GetLabTimeOfFlight ( ) const
inline
Here is the caller graph for this function:

◆ GetMomentum()

G4ThreeVector G4FieldTrack::GetMomentum ( ) const
inline
Here is the caller graph for this function:

◆ GetMomentumDir()

const G4ThreeVector& G4FieldTrack::GetMomentumDir ( ) const
inline
Here is the caller graph for this function:

◆ GetMomentumDirection()

G4ThreeVector G4FieldTrack::GetMomentumDirection ( ) const
inline
Here is the caller graph for this function:

◆ GetPDGSpin()

G4double G4FieldTrack::GetPDGSpin ( )
inline

Definition at line 94 of file G4FieldTrack.hh.

94 { return fChargeState.GetPDGSpin(); }
G4double GetPDGSpin() const
G4ChargeState fChargeState
Here is the call graph for this function:

◆ GetPolarization()

G4ThreeVector G4FieldTrack::GetPolarization ( ) const
inline
Here is the caller graph for this function:

◆ GetPosition()

G4ThreeVector G4FieldTrack::GetPosition ( ) const
inline
Here is the caller graph for this function:

◆ GetProperTimeOfFlight()

G4double G4FieldTrack::GetProperTimeOfFlight ( ) const
inline
Here is the caller graph for this function:

◆ GetRestMass()

G4double G4FieldTrack::GetRestMass ( ) const
inline

Definition at line 126 of file G4FieldTrack.hh.

126 { return fRestMass_c2; }
G4double fRestMass_c2
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSpin()

G4ThreeVector G4FieldTrack::GetSpin ( ) const
inline

Definition at line 161 of file G4FieldTrack.hh.

161 { return GetPolarization(); }
G4ThreeVector GetPolarization() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitialiseSpin()

void G4FieldTrack::InitialiseSpin ( const G4ThreeVector vecPolarization)
inline

Definition at line 159 of file G4FieldTrack.hh.

160  { SetPolarization( vecPolarization ); }
void SetPolarization(const G4ThreeVector &vecPol)
Here is the call graph for this function:

◆ LoadFromArray()

void G4FieldTrack::LoadFromArray ( const G4double  valArr[ncompSVEC],
G4int  noVarsIntegrated 
)

Definition at line 166 of file G4FieldTrack.cc.

168 {
169  G4int i;
170 
171  // Fill the variables not integrated with zero -- so it's clear !!
172  G4double valArr[ncompSVEC];
173  for( i=0; i<noVarsIntegrated; i++){
174  valArr[i]= valArrIn[i];
175  }
176  for( i=noVarsIntegrated; i<ncompSVEC; i++) {
177  valArr[i]= 0.0;
178  }
179 
180  SixVector[0]=valArr[0];
181  SixVector[1]=valArr[1];
182  SixVector[2]=valArr[2];
183  SixVector[3]=valArr[3];
184  SixVector[4]=valArr[4];
185  SixVector[5]=valArr[5];
186 
187  G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
188 
189  G4double momentum_square= Momentum.mag2();
190  fMomentumDir= Momentum.unit();
191 
192  fKineticEnergy = momentum_square /
193  (std::sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
194  + fRestMass_c2 );
195  // The above equation is stable for small and large momenta
196 
197  // The following components may or may not be
198  // integrated over -- integration is optional
199  // fKineticEnergy= valArr[6];
200 
201  fLabTimeOfFlight=valArr[7];
202  fProperTimeOfFlight=valArr[8];
203  G4ThreeVector vecPolarization= G4ThreeVector(valArr[9],valArr[10],valArr[11]);
204  SetPolarization( vecPolarization );
205 
206  // fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
207  // fDistanceAlongCurve= valArr[];
208 }
G4double SixVector[6]
CLHEP::Hep3Vector G4ThreeVector
void SetPolarization(const G4ThreeVector &vecPol)
G4double fLabTimeOfFlight
int G4int
Definition: G4Types.hh:78
G4ThreeVector fMomentumDir
Hep3Vector unit() const
G4double fKineticEnergy
G4double fRestMass_c2
G4double fProperTimeOfFlight
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4FieldTrack& G4FieldTrack::operator= ( const G4FieldTrack rStVec)
inline
Here is the caller graph for this function:

◆ SetChargeAndMoments()

void G4FieldTrack::SetChargeAndMoments ( G4double  charge,
G4double  magnetic_dipole_moment = DBL_MAX,
G4double  electric_dipole_moment = DBL_MAX,
G4double  magnetic_charge = DBL_MAX 
)

Definition at line 140 of file G4FieldTrack.cc.

144 {
146  magnetic_dipole_moment,
147  electric_dipole_moment,
148  magnetic_charge );
149 
150  // NOTE: Leaves Spin unchanged !
151  //
152  // G4double pdgSpin= fChargeState.GetSpin(); // New Property of ChargeState (not well documented! )
153 
154  // IDEA: Improve the implementation using handles
155  // -- and handle to the old one (which can be shared by other copies) and
156  // must not be left to hang loose
157  //
158  // fpChargeState= new G4ChargeState( charge, magnetic_dipole_moment,
159  // electric_dipole_moment, magnetic_charge );
160 }
void SetChargesAndMoments(G4double charge, G4double magnetic_dipole_moment, G4double electric_dipole_moment, G4double magnetic_charge)
G4ChargeState fChargeState
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetCurveLength()

void G4FieldTrack::SetCurveLength ( G4double  nCurve_s)
inline
Here is the caller graph for this function:

◆ SetCurvePnt()

G4FieldTrack& G4FieldTrack::SetCurvePnt ( const G4ThreeVector pPosition,
const G4ThreeVector pMomentum,
G4double  s_curve 
)
inlineprivate
Here is the caller graph for this function:

◆ SetKineticEnergy()

void G4FieldTrack::SetKineticEnergy ( G4double  nEnergy)
inline
Here is the caller graph for this function:

◆ SetLabTimeOfFlight()

void G4FieldTrack::SetLabTimeOfFlight ( G4double  tofLab)
inline
Here is the caller graph for this function:

◆ SetMomentum()

void G4FieldTrack::SetMomentum ( G4ThreeVector  nMomDir)
inline
Here is the caller graph for this function:

◆ SetMomentumDir()

void G4FieldTrack::SetMomentumDir ( G4ThreeVector  nMomDir)
inline
Here is the caller graph for this function:

◆ SetPDGSpin()

void G4FieldTrack::SetPDGSpin ( G4double  pdgSpin)
inline

Definition at line 93 of file G4FieldTrack.hh.

93 { fChargeState.SetPDGSpin(pdgSpin); }
G4ChargeState fChargeState
void SetPDGSpin(G4double spin)
Here is the call graph for this function:

◆ SetPolarization()

void G4FieldTrack::SetPolarization ( const G4ThreeVector vecPol)
inline
Here is the caller graph for this function:

◆ SetPosition()

void G4FieldTrack::SetPosition ( G4ThreeVector  nPos)
inline
Here is the caller graph for this function:

◆ SetProperTimeOfFlight()

void G4FieldTrack::SetProperTimeOfFlight ( G4double  tofProper)
inline
Here is the caller graph for this function:

◆ SetRestMass()

void G4FieldTrack::SetRestMass ( G4double  Mass_c2)
inline

Definition at line 136 of file G4FieldTrack.hh.

136 { fRestMass_c2= Mass_c2; }
G4double fRestMass_c2
Here is the call graph for this function:

◆ SetSpin()

void G4FieldTrack::SetSpin ( G4ThreeVector  vSpin)
inline

Definition at line 162 of file G4FieldTrack.hh.

162 { SetPolarization(vSpin); }
void SetPolarization(const G4ThreeVector &vecPol)
Here is the call graph for this function:

◆ UpdateFourMomentum()

void G4FieldTrack::UpdateFourMomentum ( G4double  kineticEnergy,
const G4ThreeVector momentumDirection 
)
inline
Here is the caller graph for this function:

◆ UpdateState()

void G4FieldTrack::UpdateState ( const G4ThreeVector pPosition,
G4double  LaboratoryTimeOfFlight,
const G4ThreeVector pMomentumDirection,
G4double  kineticEnergy 
)
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const G4FieldTrack SixVec 
)
friend

Definition at line 33 of file G4FieldTrack.cc.

34 {
35  const G4double *SixV = SixVec.SixVector;
36  const int precPos= 9; // For position
37  const int precEp= 9; // For Energy / momentum
38  const int precLen= 12; // For Length along track
39  const int precSpin= 9; // For polarisation
40  const int precTime= 6; // For time of flight
41  const int oldpr= os.precision(precPos);
42  os << " ( ";
43  os << " X= " << SixV[0] << " " << SixV[1] << " "
44  << SixV[2] << " "; // Position
45  os.precision(precEp);
46  os << " P= " << SixV[3] << " " << SixV[4] << " "
47  << SixV[5] << " "; // Momentum
48  os << " Pmag= "
49  << G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude
50  os << " Ekin= " << SixVec.fKineticEnergy ;
51  os.precision(precLen);
52  os << " l= " << SixVec.GetCurveLength();
53  os.precision(6);
54  os << " m0= " << SixVec.fRestMass_c2;
55  os << " (Pdir-1)= " << SixVec.fMomentumDir.mag()-1.0;
56  if( SixVec.fLabTimeOfFlight > 0.0 ) os.precision(precTime);
57  else os.precision(3);
58  os << " t_lab= " << SixVec.fLabTimeOfFlight;
59  os << " t_proper= " << SixVec.fProperTimeOfFlight ;
60  G4ThreeVector pol= SixVec.GetPolarization();
61  if( pol.mag2() > 0.0 ){
62  os.precision(precSpin);
63  os << " PolV= " << pol; // SixVec.GetPolarization();
64  }else{
65  os << " PolV= (0,0,0) ";
66  }
67  os << " ) ";
68  os.precision(oldpr);
69  return os;
70 }
G4double SixVector[6]
CLHEP::Hep3Vector G4ThreeVector
G4ThreeVector GetPolarization() const
G4double fLabTimeOfFlight
double mag2() const
G4ThreeVector fMomentumDir
double mag() const
G4double fKineticEnergy
G4double fRestMass_c2
G4double fProperTimeOfFlight
double G4double
Definition: G4Types.hh:76
G4double GetCurveLength() const

Member Data Documentation

◆ fChargeState

G4ChargeState G4FieldTrack::fChargeState
private

Definition at line 181 of file G4FieldTrack.hh.

◆ fDistanceAlongCurve

G4double G4FieldTrack::fDistanceAlongCurve
private

Definition at line 171 of file G4FieldTrack.hh.

◆ fKineticEnergy

G4double G4FieldTrack::fKineticEnergy
private

Definition at line 172 of file G4FieldTrack.hh.

◆ fLabTimeOfFlight

G4double G4FieldTrack::fLabTimeOfFlight
private

Definition at line 174 of file G4FieldTrack.hh.

◆ fMomentumDir

G4ThreeVector G4FieldTrack::fMomentumDir
private

Definition at line 177 of file G4FieldTrack.hh.

◆ fPolarization

G4ThreeVector G4FieldTrack::fPolarization
private

Definition at line 176 of file G4FieldTrack.hh.

◆ fProperTimeOfFlight

G4double G4FieldTrack::fProperTimeOfFlight
private

Definition at line 175 of file G4FieldTrack.hh.

◆ fRestMass_c2

G4double G4FieldTrack::fRestMass_c2
private

Definition at line 173 of file G4FieldTrack.hh.

◆ SixVector

G4double G4FieldTrack::SixVector[6]
private

Definition at line 170 of file G4FieldTrack.hh.


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