| [807] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: AnaEx01.cc,v 1.14 2006/06/29 16:33:13 gunter Exp $
|
|---|
| [1230] | 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| [807] | 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 - AnaEx01
|
|---|
| 33 | //
|
|---|
| 34 | // --------------------------------------------------------------
|
|---|
| 35 | // Comments
|
|---|
| 36 | // Example of histogram and tuple manipulations using an AIDA compliant
|
|---|
| 37 | // system. All analysis manipulations (hooking an AIDA implementation,
|
|---|
| 38 | // histo booking, filling, etc...) are concentrated in one
|
|---|
| 39 | // class : AnaEx01AnalysisManager.
|
|---|
| 40 | // See the README file within the same directory to have more infos.
|
|---|
| 41 | // --------------------------------------------------------------
|
|---|
| 42 |
|
|---|
| 43 | // Geant4 :
|
|---|
| 44 | #include "G4RunManager.hh"
|
|---|
| 45 | #include "G4UImanager.hh"
|
|---|
| 46 |
|
|---|
| 47 | #include "Randomize.hh"
|
|---|
| 48 |
|
|---|
| 49 | // AIDA :
|
|---|
| 50 | #ifdef G4ANALYSIS_USE
|
|---|
| 51 | #include <AIDA/IAnalysisFactory.h>
|
|---|
| 52 | #endif
|
|---|
| 53 |
|
|---|
| 54 | // AnaEx01 :
|
|---|
| 55 | #include "AnaEx01AnalysisManager.hh"
|
|---|
| 56 | #include "AnaEx01DetectorConstruction.hh"
|
|---|
| 57 | #include "AnaEx01PhysicsList.hh"
|
|---|
| 58 | #include "AnaEx01PrimaryGeneratorAction.hh"
|
|---|
| 59 | #include "AnaEx01RunAction.hh"
|
|---|
| 60 | #include "AnaEx01EventAction.hh"
|
|---|
| 61 | #include "AnaEx01SteppingAction.hh"
|
|---|
| 62 | #include "AnaEx01SteppingVerbose.hh"
|
|---|
| 63 |
|
|---|
| 64 | int main(int,char**) {
|
|---|
| 65 |
|
|---|
| 66 | // choose the Random engine
|
|---|
| 67 | CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
|
|---|
| 68 |
|
|---|
| 69 | //my Verbose output class
|
|---|
| 70 | G4VSteppingVerbose::SetInstance(new AnaEx01SteppingVerbose);
|
|---|
| 71 |
|
|---|
| 72 | // Construct the default run manager
|
|---|
| 73 | G4RunManager * runManager = new G4RunManager;
|
|---|
| 74 |
|
|---|
| 75 | // set mandatory initialization classes
|
|---|
| 76 | AnaEx01DetectorConstruction* detector = new AnaEx01DetectorConstruction;
|
|---|
| 77 | runManager->SetUserInitialization(detector);
|
|---|
| 78 | runManager->SetUserInitialization(new AnaEx01PhysicsList);
|
|---|
| 79 |
|
|---|
| 80 | runManager->SetUserAction(new AnaEx01PrimaryGeneratorAction(detector));
|
|---|
| 81 |
|
|---|
| 82 | AnaEx01AnalysisManager* analysisManager = 0;
|
|---|
| 83 | #ifdef G4ANALYSIS_USE
|
|---|
| 84 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
|
|---|
| 85 | analysisManager = new AnaEx01AnalysisManager(aida);
|
|---|
| 86 | #endif
|
|---|
| 87 | runManager->SetUserAction(new AnaEx01RunAction(analysisManager));
|
|---|
| 88 | runManager->SetUserAction(new AnaEx01EventAction(analysisManager));
|
|---|
| 89 | runManager->SetUserAction(new AnaEx01SteppingAction(analysisManager));
|
|---|
| 90 |
|
|---|
| 91 | //Initialize G4 kernel
|
|---|
| 92 | runManager->Initialize();
|
|---|
| 93 |
|
|---|
| 94 | // get the pointer to the User Interface manager
|
|---|
| 95 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 96 |
|
|---|
| 97 | // Batch mode
|
|---|
| 98 | UI->ApplyCommand("/control/execute run.mac");
|
|---|
| 99 |
|
|---|
| 100 | // job termination
|
|---|
| 101 | #ifdef G4ANALYSIS_USE
|
|---|
| 102 | delete analysisManager;
|
|---|
| 103 | #endif
|
|---|
| 104 | delete runManager;
|
|---|
| 105 |
|
|---|
| 106 | #ifdef G4ANALYSIS_USE
|
|---|
| 107 | delete aida;
|
|---|
| 108 | #endif
|
|---|
| 109 |
|
|---|
| 110 | return 0;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|