FairShip
Loading...
Searching...
No Matches
BeamSmearingUtils.cxx
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-or-later
2
// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3
// Collaboration
4
5
#include "
BeamSmearingUtils.h
"
6
7
#include "TMath.h"
8
#include "TRandom.h"
9
10
std::pair<Double_t, Double_t>
CalculateBeamOffset
(Double_t smearBeam,
11
Double_t paintBeam) {
12
Double_t dx = 0.0;
13
Double_t dy = 0.0;
14
15
// Gaussian beam smearing
16
if
(smearBeam > 0) {
17
dx = gRandom->Gaus(0, smearBeam);
18
dy = gRandom->Gaus(0, smearBeam);
19
}
20
21
// Uniform circular beam painting
22
if
(paintBeam > 0) {
23
Double_t phi = gRandom->Uniform(0., 2 * TMath::Pi());
24
dx += paintBeam * TMath::Cos(phi);
25
dy += paintBeam * TMath::Sin(phi);
26
}
27
28
return
{dx, dy};
29
}
CalculateBeamOffset
std::pair< Double_t, Double_t > CalculateBeamOffset(Double_t smearBeam, Double_t paintBeam)
Definition
BeamSmearingUtils.cxx:10
BeamSmearingUtils.h
shipgen
BeamSmearingUtils.cxx
Generated by
Doxygen
1.15.0