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 | // Code developed by: |
---|
27 | // S.Larsson |
---|
28 | // |
---|
29 | // ****************************** |
---|
30 | // * * |
---|
31 | // * PurgMagRunAction.cc * |
---|
32 | // * * |
---|
33 | // ****************************** |
---|
34 | // |
---|
35 | // $Id: PurgMagRunAction.cc,v 1.4 2006/06/29 16:06:19 gunter Exp $ |
---|
36 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
37 | // |
---|
38 | |
---|
39 | #include "PurgMagRunAction.hh" |
---|
40 | |
---|
41 | #include "G4SteppingManager.hh" |
---|
42 | |
---|
43 | #include "G4Run.hh" |
---|
44 | #include "G4Material.hh" |
---|
45 | #include "G4UImanager.hh" |
---|
46 | #include "G4VVisManager.hh" |
---|
47 | #include "G4ios.hh" |
---|
48 | #include "G4UnitsTable.hh" |
---|
49 | |
---|
50 | #include "Randomize.hh" |
---|
51 | #include <iomanip> |
---|
52 | |
---|
53 | #ifdef G4ANALYSIS_USE |
---|
54 | #include "PurgMagAnalysisManager.hh" |
---|
55 | #endif |
---|
56 | |
---|
57 | #include <assert.h> |
---|
58 | |
---|
59 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
60 | |
---|
61 | PurgMagRunAction::PurgMagRunAction(PurgMagDetectorConstruction* det) |
---|
62 | :Detector(det) |
---|
63 | { |
---|
64 | saveRndm = 1; |
---|
65 | } |
---|
66 | |
---|
67 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
68 | |
---|
69 | PurgMagRunAction::~PurgMagRunAction() |
---|
70 | {} |
---|
71 | |
---|
72 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
73 | |
---|
74 | void PurgMagRunAction::BeginOfRunAction(const G4Run* aRun) |
---|
75 | { |
---|
76 | |
---|
77 | #ifdef G4ANALYSIS_USE |
---|
78 | PurgMagAnalysisManager* analysis = PurgMagAnalysisManager::getInstance(); |
---|
79 | analysis->book(); |
---|
80 | #endif |
---|
81 | |
---|
82 | G4cout << "---> Run " << aRun->GetRunID() << " start." << G4endl; |
---|
83 | |
---|
84 | |
---|
85 | // save Rndm status |
---|
86 | if (saveRndm > 0) |
---|
87 | { CLHEP::HepRandom::showEngineStatus(); |
---|
88 | CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm"); |
---|
89 | } |
---|
90 | |
---|
91 | |
---|
92 | //Drawing |
---|
93 | // |
---|
94 | if (G4VVisManager::GetConcreteInstance()) |
---|
95 | { |
---|
96 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
97 | UI->ApplyCommand("/vis/scene/notifyHandlers"); |
---|
98 | } |
---|
99 | } |
---|
100 | |
---|
101 | |
---|
102 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
103 | |
---|
104 | void PurgMagRunAction::EndOfRunAction(const G4Run* aRun) |
---|
105 | { |
---|
106 | |
---|
107 | #ifdef G4ANALYSIS_USE |
---|
108 | PurgMagAnalysisManager* analysis = PurgMagAnalysisManager::getInstance(); |
---|
109 | #endif |
---|
110 | |
---|
111 | G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl; |
---|
112 | |
---|
113 | #ifdef G4ANALYSIS_USE |
---|
114 | analysis->finish(); |
---|
115 | #endif |
---|
116 | |
---|
117 | //drawing |
---|
118 | if (G4VVisManager::GetConcreteInstance()) |
---|
119 | G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update"); |
---|
120 | |
---|
121 | // save Rndm status |
---|
122 | if (saveRndm == 1) |
---|
123 | { CLHEP::HepRandom::showEngineStatus(); |
---|
124 | CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm"); |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | |
---|