Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:14

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4EquationOfMotion inline methods implementation 
0027 //
0028 // Created: J.Apostolakis, 1998
0029 // -------------------------------------------------------------------
0030 
0031 inline
0032 const G4Field* G4EquationOfMotion::GetFieldObj() const
0033 {
0034     return itsField;
0035 }
0036 
0037 inline
0038 G4Field* G4EquationOfMotion::GetFieldObj()
0039 {
0040     return itsField;
0041 }
0042 
0043 inline
0044 void G4EquationOfMotion::SetFieldObj(G4Field* pField)
0045 {
0046     itsField = pField;
0047 }
0048 
0049 inline
0050 void G4EquationOfMotion::GetFieldValue(const G4double Point[4],
0051                                              G4double Field[]) const
0052 {
0053     itsField->GetFieldValue(Point, Field);
0054 }
0055 
0056 inline
0057 void G4EquationOfMotion::RightHandSide(const G4double y[],
0058                                              G4double dydx[]) const
0059 {
0060     G4double Field[G4Field::MAX_NUMBER_OF_COMPONENTS];
0061     G4double PositionAndTime[4];
0062 
0063     // Position
0064     PositionAndTime[0] = y[0];
0065     PositionAndTime[1] = y[1];
0066     PositionAndTime[2] = y[2];
0067     // Global Time
0068     PositionAndTime[3] = y[7];  // See G4FieldTrack::LoadFromArray
0069 
0070     GetFieldValue(PositionAndTime, Field);
0071     EvaluateRhsGivenB(y, Field, dydx);
0072 }
0073 
0074 inline
0075 void G4EquationOfMotion::EvaluateRhsReturnB( const G4double y[],
0076                                                    G4double dydx[],
0077                                                    G4double Field[] ) const
0078 {
0079      G4double  PositionAndTime[4];
0080 
0081      // Position
0082      PositionAndTime[0] = y[0];
0083      PositionAndTime[1] = y[1];
0084      PositionAndTime[2] = y[2];
0085      // Global Time
0086      PositionAndTime[3] = y[7];  // See G4FieldTrack::LoadFromArray
0087 
0088      GetFieldValue(PositionAndTime, Field) ;
0089      EvaluateRhsGivenB( y, Field, dydx );
0090 }