BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSIntegratorDrift.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "BDSIntegratorDrift.hh"
19
20#include "G4ThreeVector.hh"
21
22BDSIntegratorDrift::BDSIntegratorDrift()
23{;}
24
25BDSIntegratorDrift::~BDSIntegratorDrift()
26{;}
27
28void BDSIntegratorDrift::AdvanceDriftMag(const G4double yIn[],
29 const G4double h,
30 G4double yOut[],
31 G4double yErr[]) const
32{
33 G4ThreeVector unitMomentum = G4ThreeVector(yIn[3],yIn[4],yIn[5]).unit();
34
35 AdvanceDriftMag(yIn, unitMomentum, h, yOut, yErr);
36}
37
38void BDSIntegratorDrift::AdvanceDriftMag(const G4double yIn[],
39 const G4ThreeVector& unitMomentum,
40 const G4double h,
41 G4double yOut[],
42 G4double yErr[]) const
43{
44 for (G4int i = 0; i < 3; i++)
45 {
46 yOut[i] = yIn[i] + h * unitMomentum[i]; // update position
47 yOut[i+3] = yIn[i+3]; // momentum doesn't change
48 yErr[i] = 0;
49 yErr[i+3] = 0;
50 }
51}
void AdvanceDriftMag(const G4double yIn[], const G4double h, G4double yOut[], G4double yErr[]) const
Error array [6] all 0.