Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UltraRunAction.cc
Go to the documentation of this file.
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 // --------------------------------------------------------------
28 // GEANT 4 - ULTRA experiment example
29 // --------------------------------------------------------------
30 //
31 // Code developed by:
32 // B. Tome, M.C. Espirito-Santo, A. Trindade, P. Rodrigues
33 //
34 // ****************************************************
35 // * UltraRunAction.cc
36 // ****************************************************
37 //
38 // RunAction class for Ultra; it has also a Messenger Class
39 //
40 #include "UltraRunAction.hh"
41 #include "G4Run.hh"
42 #include "G4RunManager.hh"
43 #include "G4UImanager.hh"
44 #include "G4VVisManager.hh"
45 #include "G4ios.hh"
47 #include "Randomize.hh"
48 #ifdef G4ANALYSIS_USE
49 #include "UltraAnalysisManager.hh"
50 #endif
51 
52 #include "Randomize.hh"
53 #include "G4ios.hh"
54 
55 // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
58 {
59 
60  G4int seed = 1; // RANLUX seed
61  G4int luxury = 3; // RANLUX luxury level (3 is default)
62  CLHEP::HepRandom::setTheSeed(seed,luxury);
64 
65  theRunActMessenger = new UltraRunActionMessenger(this);
66 }
67 
68 // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
69 
71 {
72  delete theRunActMessenger;
73 }
74 
75 // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
76 
78 {
79 
80 #ifdef G4ANALYSIS_USE
81  UltraAnalysisManager* analysis = UltraAnalysisManager::getInstance();
82  analysis->book();
83 #endif
84 
85  G4cout << "### Run " << aRun->GetRunID() << " start..." << G4endl;
86 
87  // save Rndm status
88  if (saveRndm > 0)
90  CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
91  }
92 
93 }
94 
95 // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
96 
98 {
99 
100  // save Rndm status
101  if (saveRndm == 1)
103  CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
104  }
105 
106  // Write histograms to file
107  G4cout << "Close and Save Histograms" << G4endl;
108  G4cout << "### Run " << aRun->GetRunID() << " ended." << G4endl;
109 
110 #ifdef G4ANALYSIS_USE
111  UltraAnalysisManager* analysis = UltraAnalysisManager::getInstance();
112  analysis->finish();
113 #endif
114 
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
118 
120 {
121  runID = myrun ;
122 }