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