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 - 2023.
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
35#include <iostream>
36
37int main(int argc, char** argv)
38{
39 BDSIM* bds = nullptr;
40 try
41 {
42 bds = new BDSIM(argc, argv);
43 if (!bds->Initialised())
44 {
45 if (bds->InitialisationResult() == 1)
46 {std::cout << "Intialisation failed" << std::endl; return 1;}
47 }
48 else
49 {bds->BeamOn();}
50 delete bds;
51 }
52 catch (const BDSException& exception)
53 {
54 std::cerr << std::endl << exception.what() << std::endl;
55 delete bds;
56 exit(1);
57 }
58 catch (const std::exception& exception)
59 {
60 std::cerr << std::endl << exception.what() << std::endl;
61 delete bds;
62 exit(1);
63 }
64 return 0;
65}
General exception with possible name of object and message.
Definition: BDSException.hh:35
const char * what() const noexcept override
Override message in std::exception.
Definition: BDSException.hh:55
Interface class to use BDSIM.
Definition: BDSIMClass.hh:51
bool Initialised() const
Definition: BDSIMClass.hh:68
void BeamOn(int nGenerate=-1)
Definition: BDSIMClass.cc:369