G4FieldTrack.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4FieldTrack.cc 69786 2013-05-15 09:38:51Z gcosmo $
00028 //
00029 // -------------------------------------------------------------------
00030 
00031 #include "G4FieldTrack.hh"
00032 
00033 std::ostream& operator<<( std::ostream& os, const G4FieldTrack& SixVec)
00034 {
00035      const G4double *SixV = SixVec.SixVector;
00036      os << " ( ";
00037      os << " X= " << SixV[0] << " " << SixV[1] << " "
00038                   << SixV[2] << " ";  // Position
00039      os << " V= " << SixV[3] << " " << SixV[4] << " "
00040                   << SixV[5] << " ";  // Momentum
00041      os << " v2= "
00042         << G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude
00043      os << " mdm= " << SixVec.fMomentumDir.mag(); 
00044      os << " l= " << SixVec.GetCurveLength();
00045      os << " ) ";
00046      return os;
00047 }
00048 
00049 G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition, 
00050                                   G4double       LaboratoryTimeOfFlight,
00051                             const G4ThreeVector& pMomentumDirection,
00052                                   G4double       kineticEnergy,
00053                                   G4double       restMass_c2,
00054                                   G4double       charge, 
00055                             const G4ThreeVector& Spin,
00056                                   G4double       magnetic_dipole_moment,
00057                                   G4double       curve_length )
00058 :  fDistanceAlongCurve(curve_length),
00059    fKineticEnergy(kineticEnergy),
00060    fRestMass_c2(restMass_c2),
00061    fLabTimeOfFlight(LaboratoryTimeOfFlight), 
00062    fProperTimeOfFlight(0.),
00063    // fMomentumDir(pMomentumDirection),
00064    fChargeState(  charge, magnetic_dipole_moment ) 
00065 {
00066   UpdateFourMomentum( kineticEnergy, pMomentumDirection ); 
00067       // Sets momentum direction as well.
00068 
00069   SetPosition( pPosition ); 
00070 
00071   InitialiseSpin( Spin ); 
00072 }
00073 
00074 G4FieldTrack::G4FieldTrack( const G4ThreeVector& pPosition, 
00075                             const G4ThreeVector& pMomentumDirection,    
00076                                   G4double       curve_length, 
00077                                   G4double       kineticEnergy,
00078                             const G4double       restMass_c2,
00079                                   G4double,   // velocity
00080                                   G4double       pLaboratoryTimeOfFlight,
00081                                   G4double       pProperTimeOfFlight,
00082                             const G4ThreeVector* pSpin)
00083  : fDistanceAlongCurve(curve_length),
00084    fKineticEnergy(kineticEnergy),
00085    fRestMass_c2(restMass_c2),
00086    fLabTimeOfFlight(pLaboratoryTimeOfFlight), 
00087    fProperTimeOfFlight(pProperTimeOfFlight),
00088    // fMomentumDir(pMomentumDirection), 
00089    fChargeState( DBL_MAX ) //  charge not set 
00090 {
00091   UpdateFourMomentum( kineticEnergy, pMomentumDirection ); 
00092       // Sets momentum direction as well.
00093     
00094   SetPosition( pPosition );    
00095    
00096   G4ThreeVector Spin(0.0, 0.0, 0.0); 
00097   if( pSpin )   Spin= *pSpin;
00098   InitialiseSpin( Spin ); 
00099 }
00100 
00101 G4FieldTrack::G4FieldTrack( char )                  //  Nothing is set !!
00102   : fKineticEnergy(0.), fRestMass_c2(0.), fLabTimeOfFlight(0.),
00103     fProperTimeOfFlight(0.), fChargeState( DBL_MAX )
00104 {
00105   G4ThreeVector Zero(0.0, 0.0, 0.0);
00106   SetCurvePnt( Zero, Zero, 0.0 );
00107   InitialiseSpin( Zero ); 
00108   // fInitialMomentumMag= 0.00; // Invalid
00109   // fLastMomentumMag= 0.0; 
00110 }
00111 
00112 void G4FieldTrack::
00113      SetChargeAndMoments(G4double charge, 
00114                          G4double magnetic_dipole_moment, // default= DBL_MAX - do not change
00115                          G4double electric_dipole_moment, //   ditto
00116                          G4double magnetic_charge )       //   ditto
00117 {
00118   fChargeState.SetChargeAndMoments( charge,  magnetic_dipole_moment, 
00119                       electric_dipole_moment,  magnetic_charge ); 
00120 
00121   // fpChargeState->SetChargeAndMoments( charge,  magnetic_dipole_moment, 
00122   //          electric_dipole_moment,  magnetic_charge ); 
00123 
00124   // TO-DO: Improve the implementation using handles
00125   //   -- and handle to the old one (which can be shared by other copies) and
00126   //      must not be left to hang loose 
00127   // 
00128   // fpChargeState= new G4ChargeState(  charge, magnetic_dipole_moment, 
00129   //                         electric_dipole_moment, magnetic_charge  ); 
00130 }

Generated on Mon May 27 17:48:16 2013 for Geant4 by  doxygen 1.4.7