Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4StateManager.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
15#include "TG4StateManager.h"
16#include "TG4Globals.h"
17
19
20//_____________________________________________________________________________
22{
24
25 switch (state) {
26 case kPreInit:
27 return "PreInit";
29 return "ConstructGeometry";
31 return "ConstructOpGeometry";
33 return "MisalignGeometry";
34 case kInitGeometry:
35 return "InitGeometry";
36 case kAddParticles:
37 return "AddParticles";
38 case kAddIons:
39 return "AddIons";
40 case kInEvent:
41 return "InEvent";
43 default:
44 return "NotInApplication";
45 }
46}
47
48//_____________________________________________________________________________
50 : TG4Verbose("stateManager"),
51 fCurrentState(kNotInApplication),
52 fPreviousState(kNotInApplication)
53
54{
56
57 if (fgInstance) {
58 TG4Globals::Exception("TG4StateManager",
59 "TG4StateManager:", "Cannot create two instances of singleton.");
60 }
61
62 fgInstance = this;
63}
64
65//_____________________________________________________________________________
72
73//_____________________________________________________________________________
75{
77
78 if (VerboseLevel() > 1) {
79 G4cout << "**** TG4StateManager::SetNewState: " << GetStateName(state)
80 << "****" << G4endl;
81 }
82
84 fCurrentState = state;
85}
Definition of the TG4Globals class and basic container types.
Definition of the TG4StateManager class.
static void Exception(const TString &className, const TString &methodName, const TString &text)
The manager class for application state.
static G4ThreadLocal TG4StateManager * fgInstance
this instance
TG4ApplicationState fCurrentState
the current application state
static G4String GetStateName(TG4ApplicationState state)
void SetNewState(TG4ApplicationState state)
TG4ApplicationState fPreviousState
the previous application state
virtual ~TG4StateManager()
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
virtual G4int VerboseLevel() const
Definition TG4Verbose.h:78
TG4ApplicationState
Enumeration for application states.
@ kMisalignGeometry
in MisalignGeometry
@ kAddIons
in AddIons
@ kConstructGeometry
in ConstructGeometry
@ kAddParticles
in AddParticles
@ kPreInit
in PreInit
@ kInEvent
in event processing
@ kNotInApplication
not in VMC application
@ kInitGeometry
in InitGeometry
@ kConstructOpGeometry
in ConstructOpGeometry