BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSModulatorTopHatT.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 "BDSDebug.hh"
19#include "BDSException.hh"
20#include "BDSModulatorTopHatT.hh"
21
22#include "G4String.hh"
23
24#include <string>
25
26BDSModulatorTopHatT::BDSModulatorTopHatT(G4double T0In,
27 G4double T1In,
28 G4double amplitudeScaleIn):
29 T0(T0In),
30 T1(T1In),
31 scale(amplitudeScaleIn)
32{
33 if (T1 < T0)
34 {
35 G4String msg = "T1 (" + std::to_string(T1) + ") must be greater equal than T0 (";
36 msg += std::to_string(T0) + ")";
37 throw BDSException(__METHOD_NAME__, msg);
38 }
39}
40
41G4double BDSModulatorTopHatT::Factor(const G4ThreeVector& /*xyz*/,
42 G4double T) const
43{
44 return T <= T1 && T >= T0 ? scale : 0;
45}
46
48{
49 G4double dT = T1 - T0;
50 return dT / 20;
51}
General exception with possible name of object and message.
virtual G4double RecommendedMaxStepLength() const
Return difference in T0, T1 / 20.
virtual G4double Factor(const G4ThreeVector &xyz, G4double T) const
Returns value of equation in brief at the top of this file.