ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04PhysicsList.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file F04PhysicsList.cc
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 //
29 //
30 
31 #include "F04PhysicsList.hh"
33 
34 #include "G4StepLimiterPhysics.hh"
35 #include "G4OpticalPhysics.hh"
36 
37 #include "G4LossTableManager.hh"
38 
39 #include "G4ProcessManager.hh"
40 #include "G4ParticleTypes.hh"
41 #include "G4ParticleTable.hh"
42 
43 //#include "G4PhysListFactory.hh"
44 #include "FTFP_BERT.hh"
45 #include "QGSP_BERT.hh"
46 
47 #include "G4Gamma.hh"
48 #include "G4Electron.hh"
49 #include "G4Positron.hh"
50 
51 #include "F04StepMax.hh"
52 
53 #include "G4ProcessTable.hh"
54 
55 #include "G4PionDecayMakeSpin.hh"
56 #include "G4DecayWithSpin.hh"
57 
58 #include "G4DecayTable.hh"
61 
62 #include "G4MuonMinusCapture.hh"
64 
65 #include "G4SystemOfUnits.hh"
66 #include "G4AutoDelete.hh"
67 
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
75 
76  defaultCutValue = 1.*mm;
77 
79 
80  SetVerboseLevel(1);
81 
82 // G4PhysListFactory factory;
83  G4VModularPhysicsList* phys = NULL;
84  if (physName == "QGSP_BERT") {
85  phys = new QGSP_BERT;
86  } else {
87  phys = new FTFP_BERT;
88  }
89 
90 // if (factory.IsReferencePhysList(physName))
91 // phys =factory.GetReferencePhysList(physName);
92 
93  // Physics List is defined via environment variable PHYSLIST
94 // if (!phys) phys = factory.ReferencePhysList();
95 
96  if (!phys) G4Exception("F04PhysicsList::F04PhysicsList","InvalidSetup",
97  FatalException,"PhysicsList does not exist");
98 
99  for (G4int i = 0; ; ++i) {
100  G4VPhysicsConstructor* elem =
101  const_cast<G4VPhysicsConstructor*> (phys->GetPhysics(i));
102  if (elem == NULL) break;
103  G4cout << "RegisterPhysics: " << elem->GetPhysicsName() << G4endl;
104  RegisterPhysics(elem);
105  }
106 
109 
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  delete fMessenger;
118 
119  //delete fStepMaxProcess;
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
123 
125 {
127 
129 
130  G4DecayTable* muonPlusDecayTable = new G4DecayTable();
131  muonPlusDecayTable -> Insert(new
132  G4MuonDecayChannelWithSpin("mu+",0.986));
133  muonPlusDecayTable -> Insert(new
135  G4MuonPlus::MuonPlusDefinition() -> SetDecayTable(muonPlusDecayTable);
136 
137  G4DecayTable* muonMinusDecayTable = new G4DecayTable();
138  muonMinusDecayTable -> Insert(new
139  G4MuonDecayChannelWithSpin("mu-",0.986));
140  muonMinusDecayTable -> Insert(new
142  G4MuonMinus::MuonMinusDefinition() -> SetDecayTable(muonMinusDecayTable);
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146 
148 {
150 
151  fStepMaxProcess = new F04StepMax();
153 
154  G4DecayWithSpin* decayWithSpin = new G4DecayWithSpin();
155 
157 
158  G4VProcess* decay;
159  decay = processTable->FindProcess("Decay",G4MuonPlus::MuonPlus());
160 
161  G4ProcessManager* pmanager;
162  pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
163 
164  if (pmanager) {
165  if (decay) pmanager->RemoveProcess(decay);
166  pmanager->AddProcess(decayWithSpin);
167  // set ordering for PostStepDoIt and AtRestDoIt
168  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
169  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
170  }
171 
172  decay = processTable->FindProcess("Decay",G4MuonMinus::MuonMinus());
173 
175 
176  if (pmanager) {
177  if (decay) pmanager->RemoveProcess(decay);
178  pmanager->AddProcess(decayWithSpin);
179  // set ordering for PostStepDoIt and AtRestDoIt
180  pmanager ->SetProcessOrdering(decayWithSpin, idxPostStep);
181  pmanager ->SetProcessOrdering(decayWithSpin, idxAtRest);
182  }
183 
184  G4VProcess* process = processTable->
185  FindProcess("muMinusCaptureAtRest",G4MuonMinus::MuonMinus());
186 
187  if (pmanager) {
188  if (process) pmanager->RemoveProcess(process);
189  process = new G4MuonMinusCapture(new G4MuMinusCapturePrecompound());
190  pmanager->AddRestProcess(process);
191  }
192 
193  G4PionDecayMakeSpin* poldecay = new G4PionDecayMakeSpin();
194 
195  decay = processTable->FindProcess("Decay",G4PionPlus::PionPlus());
196 
197  pmanager = G4PionPlus::PionPlus()->GetProcessManager();
198 
199  if (pmanager) {
200  if (decay) pmanager->RemoveProcess(decay);
201  pmanager->AddProcess(poldecay);
202  // set ordering for PostStepDoIt and AtRestDoIt
203  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
204  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
205  }
206 
207  decay = processTable->FindProcess("Decay",G4PionMinus::PionMinus());
208 
210 
211  if (pmanager) {
212  if (decay) pmanager->RemoveProcess(decay);
213  pmanager->AddProcess(poldecay);
214  // set ordering for PostStepDoIt and AtRestDoIt
215  pmanager ->SetProcessOrdering(poldecay, idxPostStep);
216  pmanager ->SetProcessOrdering(poldecay, idxAtRest);
217  }
218 
219  AddStepMax();
220 }
221 
222 /*
223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
224 
225 void F04PhysicsList::RemoveFromPhysicsList(const G4String& name)
226 {
227  G4bool success = false;
228  for (G4PhysConstVector::iterator p = physicsVector->begin();
229  p != physicsVector->end(); ++p) {
230  G4VPhysicsConstructor* e = (*p);
231  if (e->GetPhysicsName() == name) {
232  physicsVector->erase(p);
233  success = true;
234  break;
235  }
236  }
237  if (!success) {
238  std::ostringstream message;
239  message << "PhysicsList::RemoveFromPhysicsList "<< name << "not found";
240  G4Exception(message.str().c_str());
241  }
242 }
243 
244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245 
246 void F04PhysicsList::ClearPhysics()
247 {
248  for (G4PhysConstVector::iterator p = physicsVector->begin();
249  p != physicsVector->end(); ++p) {
250  delete (*p);
251  }
252  physicsVector->clear();
253 }
254 */
255 
256 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
257 
259 {
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
265 
267 {
268  return fStepMaxProcess;
269 }
270 
271 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
272 
274 {
275  // Step limitation seen as a process
276 
278  particleIterator->reset();
279  while ((*particleIterator)()){
281  G4ProcessManager* pmanager = particle->GetProcessManager();
282 
283  if (fStepMaxProcess->IsApplicable(*particle) && !particle->IsShortLived())
284  {
285  if (pmanager) pmanager ->AddDiscreteProcess(fStepMaxProcess);
286  }
287  }
288 }