| [286] | 1 | // Geant4:
|
|---|
| 2 | #include "G4ios.hh"
|
|---|
| 3 | #include "G4RunManager.hh"
|
|---|
| 4 | #include "G4UImanager.hh"
|
|---|
| 5 |
|
|---|
| 6 | //ELYSE:
|
|---|
| 7 | #include "ELYSE/Analysis.hh"
|
|---|
| 8 | #include "ELYSE/SteppingVerbose.hh"
|
|---|
| 9 | #include "ELYSE/DetectorConstruction.hh"
|
|---|
| 10 | #include "ELYSE/PhysicsList.hh"
|
|---|
| 11 | #include "ELYSE/PrimaryGeneratorAction.hh"
|
|---|
| 12 | #include "ELYSE/EventAction.hh"
|
|---|
| 13 | #include "ELYSE/RunAction.hh"
|
|---|
| 14 | #include "ELYSE/StackingAction.hh"
|
|---|
| 15 | #include "ELYSE/TrackingAction.hh"
|
|---|
| 16 | #include "ELYSE/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 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 29 | int main(
|
|---|
| 30 | int aArgc
|
|---|
| 31 | ,char** aArgv
|
|---|
| 32 | )
|
|---|
| 33 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 34 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
|
|---|
| 35 | {
|
|---|
| 36 | std::string arg1 = (aArgc>=2?aArgv[1]:"");
|
|---|
| 37 |
|
|---|
| 38 | //AIDA Analysis factory
|
|---|
| 39 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
|
|---|
| 40 | if(!aida) {
|
|---|
| 41 | std::cout << "ELYSE_batch :"
|
|---|
| 42 | << " AIDA not found." << std::endl;
|
|---|
| 43 | }
|
|---|
| 44 | //Book all the histo, tuple
|
|---|
| 45 | ELYSE::Analysis* analysis = new ELYSE::Analysis(aida,arg1);
|
|---|
| 46 |
|
|---|
| 47 | // User Verbose output class
|
|---|
| 48 | //
|
|---|
| 49 | G4VSteppingVerbose* verbosity = new ELYSE::SteppingVerbose;
|
|---|
| 50 | G4VSteppingVerbose::SetInstance(verbosity);
|
|---|
| 51 |
|
|---|
| 52 | // Construct the default run manager
|
|---|
| 53 | G4RunManager* runManager = new G4RunManager;
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | // UserInitialization classes (mandatory)
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | ELYSE::DetectorConstruction* ELYSEdetector = new ELYSE::DetectorConstruction();
|
|---|
| 60 |
|
|---|
| 61 | runManager->SetUserInitialization(ELYSEdetector);
|
|---|
| 62 |
|
|---|
| 63 | runManager->SetUserInitialization(new ELYSE::PhysicsList);
|
|---|
| 64 |
|
|---|
| 65 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 66 | if (UI) {
|
|---|
| 67 | std::string file =
|
|---|
| 68 | Lib::System::getenv("ELYSEROOT")+"/scripts/Geant4/jobOptions.mac"; //JEC FIXME this comes from JHF
|
|---|
| 69 | UI->ApplyCommand("/control/execute "+file);
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 | // Set user action classes
|
|---|
| 74 | ELYSE::PrimaryGeneratorAction* myGeneratorAction = new ELYSE::PrimaryGeneratorAction();
|
|---|
| 75 | runManager->SetUserAction(myGeneratorAction);
|
|---|
| 76 |
|
|---|
| 77 | ELYSE::RunAction* myRunAction = new ELYSE::RunAction();
|
|---|
| 78 | runManager->SetUserAction(myRunAction);
|
|---|
| 79 |
|
|---|
| 80 | runManager->SetUserAction(new ELYSE::EventAction(*analysis,
|
|---|
| 81 | myRunAction,
|
|---|
| 82 | ELYSEdetector,
|
|---|
| 83 | myGeneratorAction));
|
|---|
| 84 | runManager->SetUserAction(new ELYSE::TrackingAction);
|
|---|
| 85 |
|
|---|
| 86 | runManager->SetUserAction(new ELYSE::StackingAction);
|
|---|
| 87 | runManager->SetUserAction(new ELYSE::SteppingAction);
|
|---|
| 88 |
|
|---|
| 89 | // Initialize G4 kernel
|
|---|
| 90 | runManager->Initialize();
|
|---|
| 91 |
|
|---|
| 92 | if (UI) {
|
|---|
| 93 | std::string file =
|
|---|
| 94 | Lib::System::getenv("ELYSEROOT")+"/scripts/Geant4/init.g4m";
|
|---|
| 95 | UI->ApplyCommand("/control/execute "+file);
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 | runManager->BeamOn(1);
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | delete runManager;
|
|---|
| 103 | delete analysis;
|
|---|
| 104 | delete aida;
|
|---|
| 105 | return 0;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|