BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
bdsim.cc
Go to the documentation of this file.
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*/
32#include "BDSIMClass.hh"
33#include "BDSException.hh"
34#include <iostream>
35
36int main(int argc, char** argv)
37{
38 BDSIM* bds = nullptr;
39 try
40 {
41 bds = new BDSIM(argc, argv);
42 if (!bds->Initialised())
43 {
44 if (bds->InitialisationResult() == 1)
45 {std::cout << "Initialisation failed" << std::endl; return 1;}
46 }
47 else
48 {bds->BeamOn();}
49 delete bds;
50 }
51 catch (const BDSException& exception)
52 {
53 std::cerr << std::endl << exception.what() << std::endl;
54 delete bds;
55 exit(1);
56 }
57 catch (const std::exception& exception)
58 {
59 std::cerr << std::endl << exception.what() << std::endl;
60 delete bds;
61 exit(1);
62 }
63 return 0;
64}
General exception with possible name of object and message.
const char * what() const noexcept override
Override message in std::exception.
Interface class to use BDSIM.
Definition BDSIMClass.hh:51
bool Initialised() const
Definition BDSIMClass.hh:72
void BeamOn(int nGenerate=-1)