Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4SpecialPhysicsList.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2015 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
16#include "TG4EmModelPhysics.h"
19#include "TG4G3ControlVector.h"
20#include "TG4G3PhysicsManager.h"
21#include "TG4GeometryServices.h"
29
30#include <G4ParticleDefinition.hh>
31#include <G4ProcessManager.hh>
32#include <G4ProcessTable.hh>
33
34// According to G4VModularPhysicsList.cc
35#include <G4StateManager.hh>
36// This macros change the references to fields that are now encapsulated
37// in the class G4VMPLData.
38#define G4MT_physicsVector \
39 ((G4VMPLsubInstanceManager.offset[g4vmplInstanceID]).physicsVector)
40
42
43//
44// static methods
45//
46
47//_____________________________________________________________________________
49{
51
52 G4String selections;
53 selections += "stepLimiter ";
54 selections += "specialCuts ";
55 selections += "stackPopper ";
56 selections += "gflash ";
57
58 return selections;
59}
60
61//_____________________________________________________________________________
62G4bool TG4SpecialPhysicsList::IsAvailableSelection(const G4String& selection)
63{
65
66 G4int itoken = 0;
67 TString token = TG4Globals::GetToken(itoken, selection);
68
69 while (token != "") {
70 if (!G4StrUtil::contains(AvailableSelections(), token.Data())) return false;
71 token = TG4Globals::GetToken(++itoken, selection);
72 }
73
74 return true;
75}
76
77//
78// ctors, dtor
79//
80
81//_____________________________________________________________________________
84 TG4Verbose("specialPhysicsList"),
85 fStackPopperPhysics(0),
86 fEmModelPhysics(0),
87 fIsSpecialCuts(false)
88{
90
91 if (VerboseLevel() > 1)
92 G4cout << "TG4SpecialPhysicsList::TG4SpecialPhysicsList" << G4endl;
93
94 if (fgInstance) {
95 TG4Globals::Exception("TG4SpecialPhysicsList", "TG4SpecialPhysicsList",
96 "Cannot create two instances of singleton.");
97 }
98 fgInstance = this;
99
100 Configure(selection);
101
102 SetVerboseLevel(TG4Verbose::VerboseLevel());
103}
104
105//_____________________________________________________________________________
108 TG4Verbose("physicsList"),
109 fStackPopperPhysics(0),
110 fEmModelPhysics(0),
111 fFastSimulationPhysics(0),
112 fIsSpecialCuts(false)
113{
115
116 G4cout << "TG4SpecialPhysicsList::TG4SpecialPhysicsList" << G4endl;
117
118 Configure("");
119
120 SetVerboseLevel(TG4Verbose::VerboseLevel());
121}
122
123//_____________________________________________________________________________
125{
127
128 // delete fExtDecayer;
129 // fExtDecayer is deleted in G4Decay destructor
130
131 fgInstance = 0;
132}
133
134//
135// private methods
136//
137
138//_____________________________________________________________________________
139void TG4SpecialPhysicsList::Configure(const G4String& selection)
140{
143
144 Int_t tg4VerboseLevel = TG4Verbose::VerboseLevel();
145
146 RegisterPhysics(new TG4TransitionRadiationPhysics(tg4VerboseLevel));
147
148 G4int itoken = 0;
149 TString token = TG4Globals::GetToken(itoken, selection);
150 G4bool isGflash = false;
151 while (token != "") {
152
153 if (token == "specialCuts") {
154 // G4cout << "Registering special cuts physics" << G4endl;
155 RegisterPhysics(new TG4SpecialCutsPhysics(tg4VerboseLevel));
156 fIsSpecialCuts = true;
157 }
158 else if (token == "stepLimiter") {
159 // G4cout << "Registering step limiter physics" << G4endl;
160 RegisterPhysics(new TG4StepLimiterPhysics(tg4VerboseLevel));
161 }
162 else if (token == "stackPopper") {
163 // G4cout << "Registering stack popper physics" << G4endl;
164 fStackPopperPhysics = new TG4StackPopperPhysics(tg4VerboseLevel);
165 RegisterPhysics(fStackPopperPhysics);
166 }
167 else if (token == "gflash") {
168 isGflash = true;
169 }
170 else {
172 "TG4SpecialPhysicsList", "Configure", "Unrecognized option " + token);
173 }
174 token = TG4Globals::GetToken(++itoken, selection);
175 }
176 RegisterPhysics(new TG4UserParticlesPhysics(tg4VerboseLevel));
177 RegisterPhysics(new TG4ExtDecayerPhysics(tg4VerboseLevel));
178
179 fEmModelPhysics = new TG4EmModelPhysics(tg4VerboseLevel);
180 RegisterPhysics(fEmModelPhysics);
182 RegisterPhysics(fFastSimulationPhysics);
183 if (isGflash) {
186 }
187 RegisterPhysics(new TG4ProcessMapPhysics(tg4VerboseLevel));
188}
189
190//
191// public methods
192//
193
194//_____________________________________________________________________________
196{
198
199 // lock physics manager
201 g3PhysicsManager->Lock();
202
203 // create processes for registered physics
204 // To avoid call AddTransportation twice we do not call directly
205 // G4VModularPhysicsList::ConstructProcess();
206 // but call registered processes ourselves:
207 G4PhysConstVector::iterator itr;
208 for (itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();
209 ++itr) {
210 (*itr)->ConstructProcess();
211 }
212}
213
214//_____________________________________________________________________________
216{
218
220}
221
222//_____________________________________________________________________________
224{
228
230 SetVerboseLevel(level);
231
232 G4PhysConstVector::iterator it;
233 for (it = G4MT_physicsVector->begin(); it != G4MT_physicsVector->end();
234 ++it) {
235 TG4Verbose* verbose = dynamic_cast<TG4Verbose*>(*it);
236 if (verbose)
237 verbose->VerboseLevel(level);
238 else
239 (*it)->SetVerboseLevel(level);
240 }
241}
242
243//_____________________________________________________________________________
Definition of the TG4EmModelPhysics class.
#define G4MT_physicsVector
Definition of the TG4ExtDecayerPhysics class.
Definition of the TG4FastSimulationPhysics class.
Definition of the TG4G3ControlVector class.
Definition of the TG4G3PhysicsManager class.
Definition of the TG4GeometryServices class.
Definition of the TG4GflashFastSimulation class.
Definition of the TG4ProcessMapPhysics class.
Definition of the TG4SpecialCutsPhysics class.
Definition of the TG4SpecialPhysicsList class.
Definition of the TG4StackPopperPhysics class.
Definition of the TG4StepLimiterPhysics class.
Definition of the TG4TransitionRadiationPhysics class.
Definition of the TG4UserParticlesPhysics class.
Physics builder which activates a selected EM energy loss and/or fluctuations model.
The builder for external decayer.
Physics builder which activates selected fast simulation models.
void SetUserFastSimulation(TG4VUserFastSimulation *userFastSimulation)
Provides a Geant3 way control to Geant4 physics.
static TG4G3PhysicsManager * Instance()
Special class for definition of Gflash fast simulation model.
static G4String GetToken(Int_t i, const TString &s)
static void Warning(const TString &className, const TString &methodName, const TString &text)
static void Exception(const TString &className, const TString &methodName, const TString &text)
The special builder which fills the VMC process map.
The builder for special cuts process.
The Geant4 VMC special physics list helper class.
TG4StackPopperPhysics * fStackPopperPhysics
Stack popper physics builder.
static G4String AvailableSelections()
TG4EmModelPhysics * fEmModelPhysics
EM models physics builder.
void SetUserFastSimulation(TG4VUserFastSimulation *fastSimulation)
G4bool fIsSpecialCuts
Option for special cuts.
TG4FastSimulationPhysics * fFastSimulationPhysics
Fast simulation physics builder.
virtual G4int VerboseLevel() const
static G4bool IsAvailableSelection(const G4String &selection)
static G4ThreadLocal TG4SpecialPhysicsList * fgInstance
this instance
void Configure(const G4String &selection)
The builder for stack popper process.
The builder for step limiter process.
The builder for transition radiation processes.
The builder for user defined particles.
The abstract base class which is used to build fast simulation models.
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
virtual G4int VerboseLevel() const
Definition TG4Verbose.h:78
virtual void VerboseLevel(G4int level)
Definition TG4Verbose.h:72