Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
physics_list
src
TG4ExtDecayerPhysics.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 "
TG4ExtDecayerPhysics.h
"
16
#include "
TG4ExtDecayer.h
"
17
#include "
TG4Globals.h
"
18
19
#include <TVirtualMC.h>
20
#include <TVirtualMCDecayer.h>
21
22
#include <G4Decay.hh>
23
#include <G4ParticleDefinition.hh>
24
#include <G4ProcessManager.hh>
25
26
//_____________________________________________________________________________
27
TG4ExtDecayerPhysics::TG4ExtDecayerPhysics
(
const
G4String& name)
28
:
TG4VPhysicsConstructor
(name),
29
fMessenger
(this),
30
fDecayProcess
(0),
31
fSelection
(),
32
fSkipNeutrino
(false)
33
{
35
}
36
37
//_____________________________________________________________________________
38
TG4ExtDecayerPhysics::TG4ExtDecayerPhysics
(
39
G4int theVerboseLevel,
const
G4String& name)
40
:
TG4VPhysicsConstructor
(name, theVerboseLevel),
41
fMessenger
(this),
42
fDecayProcess
(0),
43
fSelection
(),
44
fSkipNeutrino
(false)
45
{
47
}
48
49
//_____________________________________________________________________________
50
TG4ExtDecayerPhysics::~TG4ExtDecayerPhysics
()
51
{
53
54
delete
fDecayProcess
;
55
}
56
57
//
58
// protected methods
59
//
60
61
//_____________________________________________________________________________
62
void
TG4ExtDecayerPhysics::ConstructParticle
()
63
{
65
}
66
67
//_____________________________________________________________________________
68
void
TG4ExtDecayerPhysics::ConstructProcess
()
69
{
72
73
// Check if VMC decayer is defined
74
TVirtualMCDecayer* mcDecayer = gMC->GetDecayer();
75
if
(!mcDecayer) {
76
// TG4Globals::Warning(
77
// "TG4ExtDecayerPhysics", "ConstructProcess",
78
// "No VMC external decayer defined.");
79
return
;
80
}
81
82
// Create Geant4 external decayer
83
TG4ExtDecayer
* tg4Decayer =
new
TG4ExtDecayer
(mcDecayer);
84
tg4Decayer->
VerboseLevel
(
VerboseLevel
());
85
tg4Decayer->
SetSkipNeutrino
(
fSkipNeutrino
);
86
// The tg4Decayer is deleted in G4Decay destructor
87
// But we may have a problem if there are more than one
88
// instances of G4Decay process
89
90
auto
aParticleIterator = GetParticleIterator();
91
aParticleIterator->reset();
92
while
((*aParticleIterator)()) {
93
G4ParticleDefinition
* particle = aParticleIterator->value();
94
G4ProcessManager* pmanager = particle->GetProcessManager();
95
96
// skip particles which do not have process manager
97
if
(!pmanager)
continue
;
98
99
if
(
TG4Globals::Contains
(particle->GetParticleName(),
fSelection
)) {
100
101
if
(
VerboseLevel
() > 1) {
102
G4cout <<
"Switching off Geant4 decay table for: "
103
<< particle->GetParticleName() << G4endl;
104
}
105
106
// Unset the decay table for particles in a selection;
107
// for the particles in selection, the external decayer
108
// will have a priority over Geant4 decay table
109
particle->SetDecayTable(0);
110
}
111
112
if
(
VerboseLevel
() > 1) {
113
G4cout <<
"Setting ext decayer for: "
114
<< aParticleIterator->value()->GetParticleName() << G4endl;
115
}
116
117
G4ProcessVector* processVector = pmanager->GetProcessList();
118
for
(
size_t
i = 0; i < processVector->length(); i++) {
119
120
G4Decay* decay =
dynamic_cast<
G4Decay*
>
((*processVector)[i]);
121
if
(decay) decay->SetExtDecayer(tg4Decayer);
122
}
123
}
124
125
if
(
VerboseLevel
() > 0) {
126
G4cout <<
"### "
127
<<
"External decayer physics constructed."
<< G4endl;
128
}
129
}
TG4ExtDecayerPhysics.h
Definition of the TG4ExtDecayerPhysics class.
TG4ExtDecayer.h
Definition of the TG4ExtDecayer class.
TG4Globals.h
Definition of the TG4Globals class and basic container types.
G4ParticleDefinition
TG4ExtDecayerPhysics::fSkipNeutrino
G4bool fSkipNeutrino
option to skip importing neutrinos
Definition
TG4ExtDecayerPhysics.h:60
TG4ExtDecayerPhysics::fMessenger
TG4ExtDecayerMessenger fMessenger
messenger
Definition
TG4ExtDecayerPhysics.h:57
TG4ExtDecayerPhysics::TG4ExtDecayerPhysics
TG4ExtDecayerPhysics(const G4String &name="ExtDecayer")
Definition
TG4ExtDecayerPhysics.cxx:27
TG4ExtDecayerPhysics::fDecayProcess
G4Decay * fDecayProcess
decay process
Definition
TG4ExtDecayerPhysics.h:58
TG4ExtDecayerPhysics::~TG4ExtDecayerPhysics
virtual ~TG4ExtDecayerPhysics()
Definition
TG4ExtDecayerPhysics.cxx:50
TG4ExtDecayerPhysics::ConstructParticle
virtual void ConstructParticle()
Construct particles.
Definition
TG4ExtDecayerPhysics.cxx:62
TG4ExtDecayerPhysics::fSelection
G4String fSelection
particles selection
Definition
TG4ExtDecayerPhysics.h:59
TG4ExtDecayerPhysics::ConstructProcess
virtual void ConstructProcess()
Construct physics processes.
Definition
TG4ExtDecayerPhysics.cxx:68
TG4ExtDecayer
Implements the G4VExtDecayer abstract class with the TVirtualMCDecayer.
Definition
TG4ExtDecayer.h:42
TG4ExtDecayer::SetSkipNeutrino
void SetSkipNeutrino(G4bool skipNeutrino)
Definition
TG4ExtDecayer.h:66
TG4Globals::Contains
static G4bool Contains(const G4String &name, const G4String &nameList)
Definition
TG4Globals.cxx:153
TG4VPhysicsConstructor::TG4VPhysicsConstructor
TG4VPhysicsConstructor(const G4String &name)
Definition
TG4VPhysicsConstructor.cxx:22
TG4VPhysicsConstructor::VerboseLevel
virtual G4int VerboseLevel() const
Definition
TG4VPhysicsConstructor.cxx:63
TG4Verbose::VerboseLevel
virtual void VerboseLevel(G4int level)
Definition
TG4Verbose.h:72
Generated on
for Geant4 VMC by
1.17.0