Geant4  10.00.p03
F04EventAction.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: F04EventAction.cc 78002 2013-12-02 08:25:49Z gcosmo $
27 //
30 //
31 
32 #include "F04EventAction.hh"
33 
34 #include "F04RunAction.hh"
35 
37 
38 #include "G4Event.hh"
39 #include "G4EventManager.hh"
40 #include "G4Trajectory.hh"
41 #include "G4TrajectoryContainer.hh"
42 #include "G4VVisManager.hh"
43 #include "Randomize.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  : fRunaction(runAction), fVerboselevel(0),
49  fPrintModulo(10), fDrawFlag("all")
50 {
52 }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 {
58  delete fEventMessenger;
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {
65  G4int evtNb = evt->GetEventID();
66  if (evtNb%fPrintModulo == 0)
67  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
68 
69  if(fVerboselevel>0)
70  G4cout << "<<< Event " << evtNb << " started." << G4endl;
71 }
72 
73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
74 #include "G4Threading.hh"
75 
77 {
78 // G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
79 //
80 // if(pVVisManager)
81 // {
82 // G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
83 //
84 // G4int n_trajectories = 0;
85 //
86 // if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
87 // for(G4int i=0; i<n_trajectories; i++)
88 // { G4Trajectory* trj =
89 // (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);
90 // if (fDrawFlag == "all") trj->DrawTrajectory();
91 // else if ((fDrawFlag == "charged")&&(trj->GetCharge() != 0.))
92 // trj->DrawTrajectory();
93 // }
94 // }
95 
96  if (fVerboselevel>0)
97  G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
98 
99  if (fRunaction->GetRndmFreq() == 2)
100  {
101  std::ostringstream os;
102  os<<"endOfEvent_"<<G4Threading::G4GetThreadId()<<".rndm";
103  G4Random::saveEngineStatus(os.str().c_str());
104  G4int evtNb = evt->GetEventID();
105  if (evtNb%fPrintModulo == 0)
106  {
107  G4cout << "\n---> End of Event: " << evtNb << G4endl;
108  G4Random::showEngineStatus();
109  }
110  }
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
118  return evno ;
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122 
124 {
125  fVerboselevel = level ;
126 }
Definition of the F04EventActionMessenger class.
virtual void EndOfEventAction(const G4Event *)
G4int GetRndmFreq()
Definition: F04RunAction.hh:55
G4EventManager * fpEventManager
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
void SetEventVerbose(G4int)
G4GLOB_DLL std::ostream G4cout
virtual void BeginOfEventAction(const G4Event *)
Definition of the F04RunAction class.
Definition of the F04EventAction class.
F04EventActionMessenger * fEventMessenger
F04EventAction(F04RunAction *)
#define G4endl
Definition: G4ios.hh:61
virtual ~F04EventAction()
F04RunAction * fRunaction
const G4Event * GetConstCurrentEvent()
G4int G4GetThreadId()
Definition: G4Threading.cc:103