source: trunk/examples/extended/electromagnetic/TestEm9/src/EventAction.cc @ 1358

Last change on this file since 1358 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.5 KB
Line 
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: EventAction.cc,v 1.6 2010/06/07 05:40:46 perl Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31
32#include "EventAction.hh"
33#include "HistoManager.hh"
34#include "EventActionMessenger.hh"
35
36#include "G4UImanager.hh"
37#include "G4Gamma.hh"
38#include "G4ios.hh"
39
40//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41
42EventAction::EventAction():
43  nEvt(0),
44  printModulo(100),
45  verbose(0),
46  drawFlag("all")
47{
48  eventMessenger = new EventActionMessenger(this);
49}
50
51//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
52
53EventAction::~EventAction()
54{}
55
56//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
57
58void EventAction::BeginOfEventAction(const G4Event*)
59{
60  // New event
61  nEvt++;
62  HistoManager* hi = HistoManager::GetPointer();
63  hi->BeginOfEvent();
64
65  // Switch on verbose mode
66
67  if(hi->FirstEventToDebug() == nEvt) {
68    verbose = 2;
69    hi->SetVerbose(2);
70    (G4UImanager::GetUIpointer())->ApplyCommand("/tracking/verbose 2");
71  }
72
73  // Switch off verbose mode
74  if(hi->LastEventToDebug() == nEvt-1) {
75    verbose = 0;
76    hi->SetVerbose(0);
77    (G4UImanager::GetUIpointer())->ApplyCommand("/tracking/verbose 0");
78  }
79
80
81  // Initialize user actions
82  if(verbose > 0) {
83    G4cout << "EventAction: Event # "
84           << nEvt << " started" << G4endl;
85  }
86
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90
91void EventAction::EndOfEventAction(const G4Event*)
92{
93  (HistoManager::GetPointer())->EndOfEvent();
94
95  if(verbose > 0) {
96    G4cout << "EventAction: Event # "
97           << nEvt << " ended" << G4endl;
98  }
99}
100
101//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Note: See TracBrowser for help on using the repository browser.