Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GarfieldPhysicsList.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file GarfieldPhysicsList.cc
27/// \brief Implementation of the GarfieldPhysicsList class
28
30
31#include "G4EmConfigurator.hh"
32#include "G4FastSimulationManagerProcess.hh"
33#include "G4LossTableManager.hh"
34#include "G4PAIModel.hh"
35#include "G4PAIPhotModel.hh"
36#include "G4ProcessManager.hh"
37#include "G4ProcessVector.hh"
38#include "G4ProductionCuts.hh"
39#include "G4Region.hh"
40#include "G4RegionStore.hh"
41#include "G4SystemOfUnits.hh"
42#include "G4UnitsTable.hh"
43#include "GarfieldPhysics.hh"
44#include "QGSP_BERT_HP.hh"
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47
48GarfieldPhysicsList::GarfieldPhysicsList() : G4VModularPhysicsList() {
49 G4int verb = 0;
50 SetVerboseLevel(verb);
51 defaultCutValue = 1 * CLHEP::mm;
52 QGSP_BERT_HP* physicsList = new QGSP_BERT_HP;
53 for (G4int i = 0;; ++i) {
54 G4VPhysicsConstructor* elem =
55 const_cast<G4VPhysicsConstructor*>(physicsList->GetPhysics(i));
56 if (!elem) break;
57 G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
58 RegisterPhysics(elem);
59 }
60}
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63
65
68
69 std::string ionizationModel = garfieldPhysics->GetIonizationModel();
70
71 auto fastSimProcess_garfield = new G4FastSimulationManagerProcess("G4FSMP_garfield");
72
73 auto theParticleIterator = GetParticleIterator();
74 theParticleIterator->reset();
75 while ((*theParticleIterator)()) {
76 G4ParticleDefinition* particle = theParticleIterator->value();
77 G4ProcessManager* pmanager = particle->GetProcessManager();
78 G4EmConfigurator* config = G4LossTableManager::Instance()->EmConfigurator();
79 G4LossTableManager::Instance()->SetVerbose(1);
80
81 auto particleName = particle->GetParticleName();
82 if (garfieldPhysics->FindParticleName(particleName, "garfield")) {
83 pmanager->AddDiscreteProcess(fastSimProcess_garfield);
84 }
85
86 if (garfieldPhysics->FindParticleName(particleName, "geant4")) {
87 double eMin = MeV * garfieldPhysics->GetMinEnergyMeVParticle(
88 particleName, "geant4");
89 double eMax = MeV * garfieldPhysics->GetMaxEnergyMeVParticle(
90 particleName, "geant4");
91 if (ionizationModel == "PAI") {
92 G4PAIModel* pai = new G4PAIModel(particle, "G4PAIModel");
93 if (particleName == "e-" || particleName == "e+") {
94 config->SetExtraEmModel(particleName, "eIoni", pai,
95 "RegionGarfield", eMin, eMax, pai);
96 } else if (particleName == "mu-" || particleName == "mu+") {
97 config->SetExtraEmModel(particleName, "muIoni", pai,
98 "RegionGarfield", eMin, eMax, pai);
99 } else if (particleName == "proton" ||
100 particleName == "pi+" || particleName == "pi-") {
101 config->SetExtraEmModel(particleName, "hIoni", pai,
102 "RegionGarfield", eMin, eMax, pai);
103 } else if (particleName == "alpha" || particleName == "He3" ||
104 particleName == "GenericIon") {
105 config->SetExtraEmModel(particleName, "ionIoni", pai,
106 "RegionGarfield", eMin, eMax, pai);
107 }
108 } else if (ionizationModel == "PAIPhot") {
109 G4PAIPhotModel* paiPhot = new G4PAIPhotModel(particle, "G4PAIModel");
110 if (particleName == "e-" || particleName == "e+") {
111 config->SetExtraEmModel(particleName, "eIoni", paiPhot,
112 "RegionGarfield", eMin, eMax, paiPhot);
113 } else if (particleName == "mu-" || particleName == "mu+") {
114 config->SetExtraEmModel(particleName, "muIoni", paiPhot,
115 "RegionGarfield", eMin, eMax, paiPhot);
116 } else if (particleName == "proton" ||
117 particleName == "pi+" || particleName == "pi-") {
118 config->SetExtraEmModel(particleName, "hIoni", paiPhot,
119 "RegionGarfield", eMin, eMax, paiPhot);
120 } else if (particleName == "alpha" || particleName == "He3" ||
121 particleName == "GenericIon") {
122 config->SetExtraEmModel(particleName, "ionIoni", paiPhot,
123 "RegionGarfield", eMin, eMax, paiPhot);
124 }
125 }
126 }
127 }
128}
129
131 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100. * eV,
132 100. * TeV);
133
134 SetCutsWithDefault();
135
136 G4Region* region = G4RegionStore::GetInstance()->GetRegion("RegionGarfield");
137 G4ProductionCuts* cuts = new G4ProductionCuts();
138 cuts->SetProductionCut(1 * um, G4ProductionCuts::GetIndex("gamma"));
139 cuts->SetProductionCut(1 * um, G4ProductionCuts::GetIndex("e-"));
140 cuts->SetProductionCut(1 * um, G4ProductionCuts::GetIndex("e+"));
141 if (region) {
142 region->SetProductionCuts(cuts);
143 }
144
145 DumpCutValuesTable();
146}
147
149 G4VModularPhysicsList::ConstructParticle();
150}
151
153 G4VModularPhysicsList::ConstructProcess();
155}
Definition of the GarfieldPhysicsList class.
Definition of the GarfieldPhysics class.
virtual void ConstructProcess()
virtual void ConstructParticle()
double GetMaxEnergyMeVParticle(std::string name, std::string program="garfield")
static GarfieldPhysics * GetInstance()
double GetMinEnergyMeVParticle(std::string name, std::string program="garfield")
std::string GetIonizationModel()
bool FindParticleName(const std::string name, std::string program="garfield")