ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RunAction.cc
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 //
29 //
30 // -------------------------------------------------------------
31 //
32 // GEANT4
33 //
34 // -------------------------------------------------------------
35 
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
38 
39 #include "RunAction.hh"
40 #include "DetectorConstruction.hh"
41 #include "PrimaryGeneratorAction.hh"
42 #include "HistoManager.hh"
43 #include "Run.hh"
44 
45 #include "Randomize.hh"
46 #include "globals.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
51  :G4UserRunAction(),fDetector(det), fPrimary(kin), fRun(0), fHistoManager(0)
52 {
53  // Book predefined histograms
55  fHistoManager->Update(det);
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
61 {
62 #ifdef G4MULTITHREADED
63  if (isMaster) delete fPrimary;
64 #endif
65  delete fHistoManager;
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
73  return fRun;
74 }
75 
76 
78 {
79  // save Rndm status
81  // if (isMaster) G4Random::showEngineStatus();
82 
84 
85  //histograms
86  //
88  if ( analysisManager->IsActive() ) {
89  analysisManager->OpenFile();
90  }
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
96 {
97  // print Run summary
98  //
99  if (isMaster) fRun->EndOfRun();
100 
101  // save histograms
102  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
103  if ( analysisManager->IsActive() ) {
104  analysisManager->Write();
105  analysisManager->CloseFile();
106  }
107 
108  // show Rndm status
109  if (isMaster) G4Random::showEngineStatus();
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113