1 |
#include "PamG4RangeCutsPhysicsList.h" |
2 |
#include "PamG4RangeCutsPhysics.h" |
3 |
|
4 |
#include <TG4Globals.h> |
5 |
#include <TG4G3PhysicsManager.h> |
6 |
|
7 |
#include <G4ParticleDefinition.hh> |
8 |
#include <G4ProcessManager.hh> |
9 |
#include <G4ProcessTable.hh> |
10 |
|
11 |
|
12 |
PamG4RangeCutsPhysicsList* PamG4RangeCutsPhysicsList::fgInstance = 0; |
13 |
|
14 |
|
15 |
|
16 |
PamG4RangeCutsPhysicsList::PamG4RangeCutsPhysicsList() |
17 |
: G4VModularPhysicsList(), |
18 |
TG4Verbose("RangeCutsPhysicsList") |
19 |
{ |
20 |
/// Default constructor |
21 |
|
22 |
SetVerboseLevel(TG4VVerbose::VerboseLevel()); |
23 |
|
24 |
Configure(); |
25 |
} |
26 |
|
27 |
PamG4RangeCutsPhysicsList::~PamG4RangeCutsPhysicsList() |
28 |
{ |
29 |
/// Destructor |
30 |
fgInstance = 0; |
31 |
} |
32 |
|
33 |
|
34 |
void PamG4RangeCutsPhysicsList::Configure() |
35 |
{ |
36 |
/// Create the selected physics constructors |
37 |
/// and registeres them in the modular physics list. |
38 |
|
39 |
Int_t verboseLevel = TG4VVerbose::VerboseLevel(); |
40 |
|
41 |
RegisterPhysics(new PamG4RangeCutsPhysics(verboseLevel)); |
42 |
|
43 |
} |
44 |
|
45 |
|
46 |
void PamG4RangeCutsPhysicsList::ConstructProcess() |
47 |
{ |
48 |
/// Construct all processes. |
49 |
|
50 |
// lock physics manager |
51 |
TG4G3PhysicsManager* g3PhysicsManager = TG4G3PhysicsManager::Instance(); |
52 |
g3PhysicsManager->Lock(); |
53 |
|
54 |
// create processes for registered physics |
55 |
// To avoid call AddTransportation twice we do not call directly |
56 |
// G4VModularPhysicsList::ConstructProcess(); |
57 |
// but call registered processes ourselves: |
58 |
G4PhysConstVector::iterator itr; |
59 |
for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) { |
60 |
(*itr)->ConstructProcess(); |
61 |
} |
62 |
} |
63 |
|
64 |
G4int PamG4RangeCutsPhysicsList::VerboseLevel() const |
65 |
{ |
66 |
/// Return verbose level (via TG4VVerbose) |
67 |
|
68 |
return TG4VVerbose::VerboseLevel(); |
69 |
} |
70 |
|
71 |
void PamG4RangeCutsPhysicsList::VerboseLevel(G4int level) |
72 |
{ |
73 |
/// Set the specified level to both TG4Verbose and |
74 |
/// G4VModularPhysicsList. |
75 |
/// The verbose level is also propagated to registered physics contructors. |
76 |
|
77 |
TG4VVerbose::VerboseLevel(level); |
78 |
SetVerboseLevel(level); |
79 |
|
80 |
G4PhysConstVector::iterator it; |
81 |
for ( it = physicsVector->begin(); it != physicsVector->end(); ++it ) { |
82 |
TG4Verbose* verbose = dynamic_cast<TG4Verbose*>(*it); |
83 |
if ( verbose ) |
84 |
verbose->VerboseLevel(level); |
85 |
else |
86 |
(*it)->SetVerboseLevel(level); |
87 |
} |
88 |
} |
89 |
|
90 |
|
91 |
|