source: MEMPHYS/HEAD/applications/MEMPHYS_batch.cxx @ 70

Last change on this file since 70 was 70, checked in by campagne, 18 years ago

simplification of the names

File size: 2.6 KB
Line 
1// Geant4:
2#include "G4ios.hh"
3#include "G4RunManager.hh"
4#include "G4UImanager.hh"
5
6//MEMPHYS:
7#include "MEMPHYS/Analysis.hh"
8#include "MEMPHYS/DetectorConstruction.hh"
9#include "MEMPHYS/PhysicsList.hh"
10#include "MEMPHYS/PhysicsMessenger.hh"
11#include "MEMPHYS/PrimaryGeneratorAction.hh"
12#include "MEMPHYS/EventAction.hh"
13#include "MEMPHYS/RunAction.hh"
14#include "MEMPHYS/StackingAction.hh"
15#include "MEMPHYS/TrackingAction.hh"
16#include "MEMPHYS/SteppingAction.hh"
17
18
19//JEC AIDA :
20#include <AIDA/IAnalysisFactory.h>
21
22// std::
23#include <iostream>
24
25//JEC Lib :
26#include <Lib/System.h>
27
28/////////////////////////////////////////////////////////////////
29int main(
30         int //aArgc
31         , char** //aArgv
32         )
33{
34  //AIDA Analysis factory
35  AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
36  if(!aida) {
37    std::cout << "MEMPHYS_batch :"
38              << " AIDA not found." << std::endl;
39    return 0;
40  }
41  //Book all the histo, tuple
42  MEMPHYS::Analysis* analysis = new MEMPHYS::Analysis(*aida);
43
44
45  // Construct the default run manager
46  G4RunManager* runManager = new G4RunManager;
47
48  // UserInitialization classes (mandatory)
49
50
51
52  //JEC 18/11/05 give the "analysis" to fill geometry ITuple
53  MEMPHYS::DetectorConstruction* MEMPHYSdetector = 
54    new MEMPHYS::DetectorConstruction(*analysis); 
55
56  runManager->SetUserInitialization(MEMPHYSdetector);
57
58  runManager->SetUserInitialization(new MEMPHYS::PhysicsList);
59
60  G4UImanager* UI = G4UImanager::GetUIpointer();
61  if (UI) {
62    std::string file = 
63      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/jobOptions.mac"; //JEC FIXME this comes from JHF
64    UI->ApplyCommand("/control/execute "+file); 
65  }
66
67
68
69  // Set user action classes
70  MEMPHYS::PrimaryGeneratorAction* myGeneratorAction = new MEMPHYS::PrimaryGeneratorAction(MEMPHYSdetector);
71  runManager->SetUserAction(myGeneratorAction);
72
73  MEMPHYS::RunAction* myRunAction = new MEMPHYS::RunAction();
74
75  runManager->SetUserAction(myRunAction);
76
77
78  runManager->SetUserAction(new MEMPHYS::EventAction(*analysis,
79                                                   myRunAction, 
80                                                   MEMPHYSdetector,
81                                                   myGeneratorAction));
82  runManager->SetUserAction(new MEMPHYS::TrackingAction);
83
84  runManager->SetUserAction(new MEMPHYS::StackingAction);
85  runManager->SetUserAction(new MEMPHYS::SteppingAction); //JEC 15/12/05 Add user SteppingAction
86
87  // Initialize G4 kernel
88  runManager->Initialize();
89
90  if (UI) {
91    std::string file = 
92      Lib::System::getenv("MEMPHYSROOT")+"/scripts/Geant4/init.g4m"; //JEC FIXME this comes from JHF
93    UI->ApplyCommand("/control/execute "+file); 
94  }
95
96  runManager->BeamOn(1);
97
98
99  //JEC interactive session  delete visManager;
100
101  delete runManager;
102  delete analysis;
103  delete aida;
104  return 0;
105}
106
107
Note: See TracBrowser for help on using the repository browser.