source: trunk/source/event/include/G4EventManager.hh @ 1350

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

tag geant4.9.4 beta 1 + modifs locales

File size: 7.8 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//
27// $Id: G4EventManager.hh,v 1.23 2010/06/12 04:07:45 asaim Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31
32
33#ifndef G4EventManager_h
34#define G4EventManager_h 1
35
36#include "evmandefs.hh"
37#include "G4StackManager.hh"
38#include "G4TrajectoryContainer.hh"
39#include "G4PrimaryTransformer.hh"
40class G4Event;
41class G4UserEventAction;
42class G4UserStackingAction;
43class G4UserTrackingAction;
44class G4UserSteppingAction;
45class G4EvManMessenger;
46#include "G4TrackingManager.hh"
47#include "G4Track.hh"
48#include "G4VTrajectory.hh"
49#include "G4TrackStatus.hh"
50class G4SDManager;
51#include "globals.hh"
52class G4VUserEventInformation;
53
54// class description:
55//
56//      G4EventManager controls an event. This class must be a singleton
57//      and should be constructed by G4RunManager.
58//
59
60class G4EventManager 
61{
62  public: // with description
63      static G4EventManager* GetEventManager();
64      //  This method returns the singleton pointer of G4EventManager.
65
66  private:
67      static G4EventManager* fpEventManager;
68
69  public:
70      G4EventManager();
71      ~G4EventManager();
72
73  private:
74      G4EventManager(const G4EventManager &right);
75      G4EventManager& operator=(const G4EventManager& right);
76
77  public: // with description
78      void ProcessOneEvent(G4Event* anEvent);
79      //  This method is the main entry to this class for simulating an event.
80
81      void ProcessOneEvent(G4TrackVector* trackVector,G4Event* anEvent=0);
82      //  This is an alternative entry for large HEP experiments which create G4Track
83      // objects by themselves directly without using G4VPrimaryGenerator or user
84      // primary generator action. Dummy G4Event object will be created if "anEvent" is null
85      // for internal use, but this dummy object will be deleted at the end of this
86      // method and will never be available for the use after the processing.
87      // Note that in this case of null G4Event pointer no output of the simulated event
88      // is returned by this method, but the user must implement some mechanism
89      // of storing output by his/herself, e.g. in his/her UserEventAction and/or
90      // sensitive detectors.
91      //  If valid G4Event object is given, this object will not be deleted with
92      // this method and output objects such as hits collections and trajectories
93      // will be associated to this event object. If this event object has valid
94      // primary vertices/particles, they will be added to the given trackvector input.
95
96  private:
97      void DoProcessing(G4Event* anEvent);
98      void StackTracks(G4TrackVector *trackVector, G4bool IDhasAlreadySet=false);
99 
100      G4Event* currentEvent;
101
102      G4StackManager *trackContainer;
103      G4TrackingManager *trackManager;
104      G4TrajectoryContainer *trajectoryContainer;
105      G4int trackIDCounter;
106      G4int verboseLevel;
107      G4SDManager* sdManager;
108      G4PrimaryTransformer* transformer;
109      G4bool tracking;
110      G4bool abortRequested;
111
112      G4EvManMessenger* theMessenger;
113
114      G4UserEventAction*    userEventAction;
115      G4UserStackingAction* userStackingAction;
116      G4UserTrackingAction* userTrackingAction;
117      G4UserSteppingAction* userSteppingAction;
118
119      G4int storetRandomNumberStatusToG4Event;
120      G4String randomNumberStatusToG4Event;
121
122  public: // with description
123      inline const G4Event* GetConstCurrentEvent()
124      { return currentEvent; }
125      inline G4Event* GetNonconstCurrentEvent()
126      { return currentEvent; }
127      //  These methods returns the pointers of const G4Event*
128      // and G4Event*, respectively. Null will be returned when
129      // an event is not processing.
130
131  public: // with description
132      inline void AbortCurrentEvent()
133      { 
134        abortRequested = true;
135        trackContainer->clear();
136        if(tracking) trackManager->EventAborted();
137      }
138      //  This method aborts the processing of the current event. All stacked
139      // tracks are deleted. The contents of G4Event object is not completed,
140      // but trajectories, hits, and/or digits which are created before the
141      // moment of abortion can be used.
142
143  public: // with description
144      void SetUserAction(G4UserEventAction* userAction);
145      void SetUserAction(G4UserStackingAction* userAction);
146      void SetUserAction(G4UserTrackingAction* userAction);
147      void SetUserAction(G4UserSteppingAction* userAction);
148      inline G4UserEventAction* GetUserEventAction()
149      { return userEventAction; }
150      inline G4UserStackingAction* GetUserStackingAction()
151      { return userStackingAction; }
152      inline G4UserTrackingAction* GetUserTrackingAction()
153      { return userTrackingAction; }
154      inline G4UserSteppingAction* GetUserSteppingAction()
155      { return userSteppingAction; }
156      // Set and get methods for user action classes. User action classes
157      // which should belong to the other managers will be sent to the
158      // corresponding managers.
159      void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
160      { trackContainer->SetNumberOfAdditionalWaitingStacks(iAdd); }
161
162      void KeepTheCurrentEvent();
163      // If the current event exists, it is kept undeleted until the end of the current run
164
165      inline G4StackManager* GetStackManager() const
166      { return trackContainer; }
167      inline G4TrackingManager* GetTrackingManager() const
168      { return trackManager; }
169
170  public: // with description
171      inline G4int GetVerboseLevel()
172      { return verboseLevel; }
173      inline void SetVerboseLevel( G4int value )
174      {
175        verboseLevel = value;
176        trackContainer->SetVerboseLevel( value );
177        transformer->SetVerboseLevel( value );
178      }
179      // Set and get method of the verbose level
180
181      void SetUserInformation(G4VUserEventInformation* anInfo);
182      G4VUserEventInformation* GetUserInformation();
183      // Set and get method of G4VUserEventInformation object associating with
184      // the current event. Both methods are valid only for G4State_EventProc
185      // application state.
186
187      inline G4PrimaryTransformer* GetPrimaryTransformer() const
188      { return transformer; }
189      inline void SetPrimaryTransformer(G4PrimaryTransformer* tf)
190      { transformer = tf; }
191      inline void StoreRandomNumberStatusToG4Event(G4int vl)
192      { storetRandomNumberStatusToG4Event = vl; }
193};
194
195
196
197#endif
198
Note: See TracBrowser for help on using the repository browser.