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 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "RunAction.hh"
34 #include "DetectorConstruction.hh"
35 #include "PrimaryGeneratorAction.hh"
36 #include "HistoManager.hh"
37 
38 #include "Run.hh"
39 #include "G4Run.hh"
40 #include "G4RunManager.hh"
41 #include "G4UnitsTable.hh"
42 #include "G4EmCalculator.hh"
43 #include "G4Electron.hh"
44 
45 #include "G4SystemOfUnits.hh"
46 #include "Randomize.hh"
47 #include <iomanip>
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 :fDetector(det),fKinematic(kin),fRun(0),fHistoManager(0)
53 {
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61  delete fHistoManager;
62 }
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 {
68  return fRun;
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
73 void RunAction::BeginOfRunAction(const G4Run* aRun)
74 {
75  // do not save Rndm status
77  if (isMaster)
78  {
80  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
81  }
82 
83  //G4int NbofEvents = aRun->GetNumberOfEventToBeProcessed();
84  //if (NbofEvents == 0) return;
85 
86 
87  //run conditions
88  //
89  G4ParticleDefinition* particleGun
91  G4String partName = particleGun->GetParticleName();
92  //G4double energyGun = fKinematic->GetParticleGun()->GetParticleEnergy();
93 
94 
95  //histograms
96  //
97 /*
98 
99  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
100  if ( analysisManager->IsActive() ) {
101  analysisManager->OpenFile();
102  }
103 */
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107 
108 void RunAction::EndOfRunAction(const G4Run* )
109 {
110  // compute and print statistic
111  if (isMaster) fRun->EndOfRun();
112 
113  // save histograms
114  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
115  if ( analysisManager->IsActive() ) {
116  analysisManager->Write();
117  analysisManager->CloseFile();
118  }
119 
120  // show Rndm status
122 }
123 
124 
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......