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) 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 "BDSTransform3D.hh"
19
20#include "G4RotationMatrix.hh"
21#include "G4String.hh"
22#include "G4ThreeVector.hh"
23#include "G4Types.hh"
24
25BDSTransform3D::BDSTransform3D(const G4String& nameIn,
26 G4double dxIn,
27 G4double dyIn,
28 G4double dzIn,
29 G4double dPhiIn,
30 G4double dThetaIn,
31 G4double dPsiIn):
32 BDSAcceleratorComponent(nameIn,0,0,"transform3d"),
33 rotationMatrix(G4RotationMatrix()),
34 dx(dxIn), dy(dyIn), dz(dzIn),
35 dPhi(dPhiIn), dTheta(dThetaIn), dPsi(dPsiIn),
36 angle(0)
37{
38 rotationMatrix.set(dPhiIn, dThetaIn, dPsiIn);
39 G4ThreeVector axis;
40 rotationMatrix.getAngleAxis(angle,axis); // sets the variables by reference
41 axisX = axis.x();
42 axisY = axis.y();
43 axisZ = axis.z();
44}
45
46BDSTransform3D::BDSTransform3D(const G4String& nameIn,
47 G4double dxIn,
48 G4double dyIn,
49 G4double dzIn,
50 G4double axisXIn,
51 G4double axisYIn,
52 G4double axisZIn,
53 G4double angleIn):
54 BDSAcceleratorComponent(nameIn,0,0,"transform3d"),
55 rotationMatrix(G4RotationMatrix()),
56 dx(dxIn), dy(dyIn), dz(dzIn),
57 axisX(axisXIn),
58 axisY(axisYIn),
59 axisZ(axisZIn),
60 angle(angleIn)
61{
62 G4ThreeVector axis(axisXIn, axisYIn, axisZIn);
63 rotationMatrix.set(axis,angle);
64 dPhi = rotationMatrix.getPhi();
65 dTheta = rotationMatrix.getTheta();
66 dPsi = rotationMatrix.getPsi();
67}
68
69BDSTransform3D::~BDSTransform3D()
70{;}
Abstract class that represents a component of an accelerator.