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) 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*/
31#include "BDSIMClass.hh"
32#include "BDSException.hh"
33#include <iostream>
34
35int main(int argc, char** argv)
36{
37 BDSIM* bds = nullptr;
38 try
39 {
40 bds = new BDSIM(argc, argv);
41 if (!bds->Initialised())
42 {
43 if (bds->InitialisationResult() == 1)
44 {std::cout << "Initialisation failed" << std::endl; return 1;}
45 }
46 else
47 {bds->BeamOn();}
48 delete bds;
49 }
50 catch (const BDSException& exception)
51 {
52 std::cerr << std::endl << exception.what() << std::endl;
53 delete bds;
54 exit(1);
55 }
56 catch (const std::exception& exception)
57 {
58 std::cerr << std::endl << exception.what() << std::endl;
59 delete bds;
60 exit(1);
61 }
62 return 0;
63}
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:50
bool Initialised() const
Definition BDSIMClass.hh:71
void BeamOn(int nGenerate=-1)