Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4ExtraPhysicsList.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 "TG4ExtraPhysicsList.h"
16#include "TG4G3Units.h"
17#include "TG4Globals.h"
18
19#include <G4EmExtraPhysics.hh>
20#include <G4GenericBiasingPhysics.hh>
21#include <G4HadronicParameters.hh>
22#include <G4MonopolePhysics.hh>
23#include <G4OpticalPhysics.hh>
24#include <G4RadioactiveDecayPhysics.hh>
25
26#include <G4ParticleDefinition.hh>
27#include <G4ProcessManager.hh>
28#include <G4ProcessTable.hh>
29#include <G4SystemOfUnits.hh>
30
31// According to G4VModularPhysicsList.cc
32#include <G4StateManager.hh>
33// This macros change the references to fields that are now encapsulated
34// in the class G4VMPLData.
35#define G4MT_physicsVector \
36 ((G4VMPLsubInstanceManager.offset[g4vmplInstanceID]).physicsVector)
37
38const G4double TG4ExtraPhysicsList::fgkDefaultCutValue = 1.0 * mm;
39
40namespace
41{
42
43//_____________________________________________________________________________
44void SetParameters(G4MonopolePhysics* monopolePhysics,
45 const std::map<TString, Double_t>& parameters)
46{
50
51 std::map<TString, Double_t>::const_iterator it;
52 for (it = parameters.begin(); it != parameters.end(); it++) {
53 if (it->first == "monopoleMass") {
54 monopolePhysics->SetMonopoleMass(it->second * TG4G3Units::Energy());
55 }
56 else if (it->first == "monopoleElCharge") {
57 monopolePhysics->SetElectricCharge(it->second * TG4G3Units::Charge());
58 }
59 else if (it->first == "monopoleMagCharge") {
60 monopolePhysics->SetMagneticCharge(it->second * TG4G3Units::Charge());
61 }
62 else {
63 TString text = "Invalid parameter name = ";
64 text += it->second;
65 TG4Globals::Warning("TG4ParticlesManager", "SetParameters", text);
66 }
67 }
68}
69
70} // namespace
71
72//
73// static methods
74//
75
76//_____________________________________________________________________________
78{
80
81 G4String selections;
82 selections += "biasing extra monopole optical radDecay hyperNuclei ";
83
84 return selections;
85}
86
87//_____________________________________________________________________________
88G4bool TG4ExtraPhysicsList::IsAvailableSelection(const G4String& selection)
89{
91
92 G4String available = AvailableSelections();
93 G4String checkSelection = selection;
94 checkSelection += " ";
95
96 return G4StrUtil::contains(available, checkSelection);
97}
98
99//
100// ctors, dtor
101//
102
103//_____________________________________________________________________________
105 const G4String& selection, const std::map<TString, Double_t>& parameters)
106 : G4VModularPhysicsList(), TG4Verbose("extraPhysicsList")
107{
109
110 Configure(selection, parameters);
111
112 defaultCutValue = fgkDefaultCutValue;
113
114 SetVerboseLevel(TG4Verbose::VerboseLevel());
115}
116
117//_____________________________________________________________________________
122
123//
124// private methods
125//
126
127//_____________________________________________________________________________
129 const G4String& selection, const std::map<TString, Double_t>& parameters)
130{
133
134 // Generic biasing physics
135 if (G4StrUtil::contains(selection, "biasing")) {
136 G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics;
137 // we may need to make this configurable later
138 biasingPhysics->Bias("proton");
139 biasingPhysics->Bias("neutron");
140 biasingPhysics->Bias("pi+");
141 biasingPhysics->Bias("pi-");
142 RegisterPhysics(biasingPhysics);
143 }
144
145 // Extra electromagnetic physics
146 if (G4StrUtil::contains(selection, "extra")) {
147 G4EmExtraPhysics* extraPhysics = new G4EmExtraPhysics();
148#if G4VERSION_NUMBER >= 1012
149 extraPhysics->Synch(false);
150 extraPhysics->GammaNuclear(false);
151 extraPhysics->MuonNuclear(false);
152#else
153 G4String state("off");
154 extraPhysics->Synch(state);
155 extraPhysics->GammaNuclear(state);
156 extraPhysics->MuonNuclear(state);
157#endif
158 RegisterPhysics(extraPhysics);
159 }
160
161 // Monopole physics
162 if (G4StrUtil::contains(selection, "monopole")) {
163 G4MonopolePhysics* monopolePhysics = new G4MonopolePhysics();
164 SetParameters(monopolePhysics, parameters);
165 RegisterPhysics(monopolePhysics);
166 }
167
168 // Optical physics
169 if (G4StrUtil::contains(selection, "optical")) {
170 G4OpticalPhysics* g4OpticalPhysics = new G4OpticalPhysics();
171 RegisterPhysics(g4OpticalPhysics);
172 }
173
174 // Radioactive decay physics
175 if (G4StrUtil::contains(selection, "radDecay")) {
176 RegisterPhysics(new G4RadioactiveDecayPhysics());
177 }
178
179 // Hyper-nuclei physics
180 if (G4StrUtil::contains(selection, "hyperNuclei")) {
181 // activate hyper-nuclei processes
182 G4HadronicParameters::Instance()->SetEnableHyperNuclei(true);
183 }
184}
185
186//
187// public methods
188//
189
190//_____________________________________________________________________________
192{
194
195 // create processes for registered physics
196 // G4VModularPhysicsList::ConstructProcess();
197 G4PhysConstVector::iterator itr;
198 for (itr = G4MT_physicsVector->begin(); itr != G4MT_physicsVector->end();
199 ++itr) {
200 (*itr)->ConstructProcess();
201 }
202
203 if (VerboseLevel() > 0) {
204 G4cout << "### Extra physics constructed: ";
205 G4PhysConstVector::iterator it;
206 for (it = G4MT_physicsVector->begin(); it != G4MT_physicsVector->end();
207 ++it) {
208 G4cout << (*it)->GetPhysicsName() << " ";
209 }
210 G4cout << G4endl;
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//_____________________________________________________________________________
245{
250
251 defaultCutValue = value;
252}
Definition of the G4MonopolePhysics class.
#define G4MT_physicsVector
Definition of the TG4ExtraPhysicsList class.
Definition of the TG4G3Units class.
Definition of the TG4Globals class and basic container types.
void SetMonopoleMass(G4double)
void SetElectricCharge(G4double)
void SetMagneticCharge(G4double)
static G4bool IsAvailableSelection(const G4String &selection)
TG4ExtraPhysicsList(const G4String &selection, const std::map< TString, Double_t > &parameters)
void SetRangeCut(G4double value)
virtual G4int VerboseLevel() const
static G4String AvailableSelections()
void Configure(const G4String &, const std::map< TString, Double_t > &parameters)
static const G4double fgkDefaultCutValue
default cut value
static G4double Charge()
Definition TG4G3Units.h:99
static G4double Energy()
Definition TG4G3Units.h:105
static void Warning(const TString &className, const TString &methodName, const TString &text)
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