4c039060 |
1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
3 | * * |
4 | * Author: The ALICE Off-line Project. * |
5 | * Contributors are mentioned in the code where appropriate. * |
6 | * * |
7 | * Permission to use, copy, modify and distribute this software and its * |
8 | * documentation strictly for non-commercial purposes is hereby granted * |
9 | * without fee, provided that the above copyright notice appears in all * |
10 | * copies and that both the copyright notice and this permission notice * |
11 | * appear in the supporting documentation. The authors make no claims * |
12 | * about the suitability of this software for any purpose. It is * |
13 | * provided "as is" without express or implied warranty. * |
14 | **************************************************************************/ |
15 | |
803d1ab0 |
16 | /* $Id$ */ |
4c039060 |
17 | |
fe4da5cc |
18 | ////////////////////////////////////////////////////////////////////////// |
19 | // // |
20 | // aliroot // |
21 | // // |
22 | // Main program used to create aliroot application. // |
23 | // // |
24 | // // |
25 | // To be able to communicate between the FORTRAN code of GEANT and the // |
26 | // ROOT data structure, a number of interface routines have been // |
27 | // developed. // |
28 | //Begin_Html |
29 | /* |
1439f98e |
30 | <img src="picts/newg.gif"> |
fe4da5cc |
31 | */ |
32 | //End_Html |
33 | ////////////////////////////////////////////////////////////////////////// |
34 | |
35 | //Standard Root includes |
36 | #include <TROOT.h> |
37 | #include <TRint.h> |
38 | #include <TFile.h> |
39 | #include <AliRun.h> |
bc5ed32d |
40 | #include "Riostream.h" |
41 | #include "ARVersion.h" |
be0d1a8d |
42 | // STD |
43 | #include <iostream> |
44 | #include <algorithm> |
45 | #include <sstream> |
46 | #include <stdexcept> |
47 | #include <functional> |
48 | #include <AliLog.h> |
49 | |
fe4da5cc |
50 | |
51 | #if defined __linux |
52 | //On linux Fortran wants this, so we give to it! |
53 | int xargv=0; |
54 | int xargc=0; |
55 | #endif |
56 | |
6a612904 |
57 | #ifdef FORTRAN_G95 |
58 | extern "C" void g95_runtime_start(); |
59 | #endif |
60 | |
fe4da5cc |
61 | #if defined WIN32 |
62 | extern "C" int __fastflag=0; |
63 | extern "C" int _pctype=0; |
64 | extern "C" int __mb_cur_max=0; |
65 | #endif |
66 | |
c82bb898 |
67 | using std::cout; |
68 | using std::endl; |
e742b9b0 |
69 | using std::exception; |
70 | using std::cerr; |
c82bb898 |
71 | |
fe4da5cc |
72 | //_____________________________________________________________________________ |
73 | int main(int argc, char **argv) |
74 | { |
75 | // |
76 | // gAlice main program. |
77 | // It creates the main Geant3 and AliRun objects. |
78 | // |
79 | // The Hits are written out after each track in a ROOT Tree structure TreeH, |
80 | // of the file galice.root. There is one such tree per event. The kinematics |
81 | // of all the particles that produce hits, together with their genealogy up |
82 | // to the primary tracks is stared in the galice.root file in an other tree |
83 | // TreeK of which exists one per event. Finally the information of the events |
84 | // in the run is stored in the same file in the tree TreeE, containing the |
85 | // run and event number, the number of vertices, tracks and primary tracks |
86 | // in the event. |
fe4da5cc |
87 | |
bc5ed32d |
88 | for ( int i = 1; i < argc; ++i ) |
89 | { |
90 | TString argument(argv[i]); |
91 | |
92 | if (argument=="--version") |
93 | { |
5420ed56 |
94 | cout << "aliroot " << ALIROOT_REVISION << " " << ALIROOT_VERSION << endl; |
bc5ed32d |
95 | return 0; |
96 | } |
97 | } |
98 | |
9e1a0ddb |
99 | // Create new configuration |
9e1a0ddb |
100 | |
101 | new AliRun("gAlice","The ALICE Off-line Simulation Framework"); |
be0d1a8d |
102 | AliLog::GetRootLogger(); // force AliLog to initialize at start time |
fe4da5cc |
103 | // Start interactive geant |
104 | |
4a87c8b6 |
105 | TRint *theApp = new TRint("aliroot", &argc, argv); |
6a612904 |
106 | #ifdef FORTRAN_G95 |
107 | g95_runtime_start(); |
108 | #endif |
fe4da5cc |
109 | |
27f3d82e |
110 | // --- Start the event loop --- |
be0d1a8d |
111 | // run.Info("Start AliRoot"); |
112 | try{ |
113 | theApp->Run(); |
114 | } catch(const exception &e){ |
115 | cerr << "Excception catched" << e.what() << endl; |
116 | AliLog::Message(0, "Exception catched", "ROOT", NULL, "Exception catched", NULL, 0); |
117 | } |
fe4da5cc |
118 | |
fe4da5cc |
119 | return(0); |
120 | } |
fe4da5cc |
121 | |