Geant4  10.01
RunAction.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 // $Id: RunAction.cc 82385 2014-06-18 09:25:07Z gcosmo $
27 //
30 
31 #include "G4MPImanager.hh"
32 #include <stdio.h>
33 #include "G4Threading.hh"
34 #include "Analysis.hh"
35 #include "RunAction.hh"
36 
37 #include "G4MPIRunMerger.hh"
38 #include "G4MPIScorerMerger.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 {
43 }
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 {
48 }
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
52 {
54  myana-> Clear();
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 void RunAction::EndOfRunAction(const G4Run* arun)
59 {
60  G4bool is_worker = G4Threading::IsWorkerThread();
61  if ( is_worker ) return;
62 
63  G4int rank = G4MPImanager::GetManager()-> GetRank();
64 
65  G4cout<<"================================================"<<G4endl;
66  G4cout<<"My rank is: "<<rank<<G4endl;
67  G4cout<<"================================================"<<G4endl;
68  G4MPIRunMerger rm( arun );
69  //rm.SetVerbosity( 3 );
70  rm.Merge();
71  //G4cout<<"Num events: "<<arun->GetNumberOfEvent()<<G4endl;
74  //sm.SetVerbosity(4);
75  sm.Merge();
76  }
77  G4cout<<"================================================"<<G4endl;
78  G4cout<<"================================================"<<G4endl;
79 
80  char str[64];
81  sprintf(str, "dose-%03d.root", rank);
82  G4String fname(str);
83 
85  myana-> Save(fname);
86 }
void BeginOfRunAction(const G4Run *)
Definition: RunAction.cc:57
void Clear(Node *)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static G4ScoringManager * GetScoringManagerIfExist()
MPI manager class.
static Analysis * GetAnalysis()
Definition: Analysis.cc:41
bool G4bool
Definition: G4Types.hh:79
void EndOfRunAction(const G4Run *)
Definition: RunAction.cc:260
Definition: G4Run.hh:46
static G4MPImanager * GetManager()
~RunAction()
Definition: RunAction.cc:52
G4bool IsWorkerThread()
Definition: G4Threading.cc:128
#define G4endl
Definition: G4ios.hh:61