BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSTransform3D.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#include "BDSTransform3D.hh"
20
21#include "G4RotationMatrix.hh"
22#include "G4String.hh"
23#include "G4ThreeVector.hh"
24#include "G4Types.hh"
25
26BDSTransform3D::BDSTransform3D(const G4String& nameIn,
27 G4double dxIn,
28 G4double dyIn,
29 G4double dzIn,
30 G4double dPhiIn,
31 G4double dThetaIn,
32 G4double dPsiIn):
33 BDSAcceleratorComponent(nameIn,0,0,"transform3d"),
34 rotationMatrix(G4RotationMatrix()),
35 dx(dxIn), dy(dyIn), dz(dzIn),
36 dPhi(dPhiIn), dTheta(dThetaIn), dPsi(dPsiIn),
37 angle(0)
38{
39 rotationMatrix.set(dPhiIn, dThetaIn, dPsiIn);
40 G4ThreeVector axis;
41 rotationMatrix.getAngleAxis(angle,axis); // sets the variables by reference
42 axisX = axis.x();
43 axisY = axis.y();
44 axisZ = axis.z();
45}
46
47BDSTransform3D::BDSTransform3D(const G4String& nameIn,
48 G4double dxIn,
49 G4double dyIn,
50 G4double dzIn,
51 G4double axisXIn,
52 G4double axisYIn,
53 G4double axisZIn,
54 G4double angleIn):
55 BDSAcceleratorComponent(nameIn,0,0,"transform3d"),
56 rotationMatrix(G4RotationMatrix()),
57 dx(dxIn), dy(dyIn), dz(dzIn),
58 axisX(axisXIn),
59 axisY(axisYIn),
60 axisZ(axisZIn),
61 angle(angleIn)
62{
63 G4ThreeVector axis(axisXIn, axisYIn, axisZIn);
64 rotationMatrix.set(axis,angle);
65 dPhi = rotationMatrix.getPhi();
66 dTheta = rotationMatrix.getTheta();
67 dPsi = rotationMatrix.getPsi();
68}
69
70BDSTransform3D::~BDSTransform3D()
71{;}
Abstract class that represents a component of an accelerator.