BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSBunchGauss.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
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 "BDSBunchGauss.hh"
20
21#include "parser/beam.h"
22
23#include "Randomize.hh"
24#include "CLHEP/RandomObjects/RandMultiGauss.h"
25
26#include <cmath>
27
28BDSBunchGauss::BDSBunchGauss():
29 BDSBunchGaussBase("gauss")
30{;}
31
33 const GMAD::Beam& beam,
34 const BDSBunchType& distrType,
35 G4Transform3D beamlineTransformIn,
36 const G4double beamlineSIn)
37{
38 BDSBunchGaussBase::SetOptions(beamParticle, beam, distrType, beamlineTransformIn, beamlineSIn);
39
40 sigmaGM[0][0] = std::pow(beam.sigmaX, 2);
41 sigmaGM[1][1] = std::pow(beam.sigmaXp,2);
42 sigmaGM[2][2] = std::pow(beam.sigmaY, 2);
43 sigmaGM[3][3] = std::pow(beam.sigmaYp,2);
44 sigmaGM[4][4] = std::pow(sigmaT, 2); // these are made slightly finite in BDSBunchGaussBase
45 sigmaGM[5][5] = std::pow(sigmaE, 2); // if 0 to ensure +ve definiteness
46
47 delete gaussMultiGen;
48 gaussMultiGen = CreateMultiGauss(*CLHEP::HepRandom::getTheEngine(),meansGM,sigmaGM);
49}
Common functionality for a 6D Gaussian distribution.
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
CLHEP::RandMultiGauss * gaussMultiGen
Randon number generator with sigma matrix and mean.
CLHEP::RandMultiGauss * CreateMultiGauss(CLHEP::HepRandomEngine &anEngine, const CLHEP::HepVector &mu, CLHEP::HepSymMatrix &sigma)
virtual void SetOptions(const BDSParticleDefinition *beamParticle, const GMAD::Beam &beam, const BDSBunchType &distrType, G4Transform3D beamlineTransformIn=G4Transform3D::Identity, const G4double beamlineS=0)
G4double sigmaE
Centre of distributions.
Definition BDSBunch.hh:184
G4double sigmaT
Centre of distributions.
Definition BDSBunch.hh:182
Wrapper for particle definition.
Improve type-safety of native enum data type in C++.
double sigmaX
for the gaussian beam distribution
Definition beamBase.h:95
double sigmaXp
for the gaussian beam distribution
Definition beamBase.h:95
double sigmaYp
for the gaussian beam distribution
Definition beamBase.h:95
double sigmaY
for the gaussian beam distribution
Definition beamBase.h:95
Beam class.
Definition beam.h:44