ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4EmExtraParameters.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4EmExtraParameters.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 // -------------------------------------------------------------------
27 //
28 // GEANT4 Class file
29 //
30 //
31 // File name: G4EmExtraParameters
32 //
33 // Author: Vladimir Ivanchenko
34 //
35 // Creation date: 07.05.2019
36 //
37 // -------------------------------------------------------------------
38 //
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41 
42 #include "G4EmExtraParameters.hh"
43 #include "G4PhysicalConstants.hh"
44 #include "G4UnitsTable.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "G4VEmProcess.hh"
47 #include "G4VEnergyLossProcess.hh"
49 #include "G4RegionStore.hh"
50 #include "G4Region.hh"
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
53 
55 {
57  Initialise();
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
61 
63 {
64  delete theMessenger;
65 }
66 
67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
68 
70 {
71  quantumEntanglement = false;
72  directionalSplitting = false;
75 
76  dRoverRange = 0.2;
78  dRoverRangeMuHad = 0.2;
80 
81  m_regnamesForced.clear();
82  m_procForced.clear();
83  m_lengthForced.clear();
84  m_weightForced.clear();
85  m_regnamesSubCut.clear();
86  m_subCuts.clear();
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
90 
91 
93 {
94  G4Exception("G4EmExtraParameters", "em0044", JustWarning, ed);
95 }
96 
98 {
99  G4String r = reg;
100  if(r == "" || r == "world" || r == "World") {
101  r = "DefaultRegionForTheWorld";
102  }
103  return r;
104 }
105 
107 {
108  if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
109  dRoverRange = v1;
110  finalRange = v2;
111  } else {
113  ed << "Values of step function are out of range: "
114  << v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
115  PrintWarning(ed);
116  }
117 }
118 
120 {
121  return dRoverRange;
122 }
123 
125 {
126  return finalRange;
127 }
128 
130 {
131  if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
134  } else {
136  ed << "Values of step function are out of range: "
137  << v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
138  PrintWarning(ed);
139  }
140 }
141 
143 {
144  return dRoverRangeMuHad;
145 }
146 
148 {
149  return finalRangeMuHad;
150 }
151 
153  const G4String& region,
154  const G4String& type)
155 {
156  G4String r = CheckRegion(region);
157  G4int nreg = m_regnamesPAI.size();
158  for(G4int i=0; i<nreg; ++i) {
159  if((m_particlesPAI[i] == particle ||
160  m_particlesPAI[i] == "all" ||
161  particle == "all") &&
162  (m_regnamesPAI[i] == r ||
163  m_regnamesPAI[i] == "DefaultRegionForTheWorld" ||
164  r == "DefaultRegionForTheWorld") ) {
165 
166  m_typesPAI[i] = type;
167  if(particle == "all") { m_particlesPAI[i] = particle; }
168  if(r == "DefaultRegionForTheWorld") { m_regnamesPAI[i] = r; }
169  return;
170  }
171  }
172  m_particlesPAI.push_back(particle);
173  m_regnamesPAI.push_back(r);
174  m_typesPAI.push_back(type);
175 }
176 
177 const std::vector<G4String>& G4EmExtraParameters::ParticlesPAI() const
178 {
179  return m_particlesPAI;
180 }
181 
182 const std::vector<G4String>& G4EmExtraParameters::RegionsPAI() const
183 {
184  return m_regnamesPAI;
185 }
186 
187 const std::vector<G4String>& G4EmExtraParameters::TypesPAI() const
188 {
189  return m_typesPAI;
190 }
191 
193  const G4String& type)
194 {
195  G4String r = CheckRegion(region);
196  G4int nreg = m_regnamesPhys.size();
197  for(G4int i=0; i<nreg; ++i) {
198  if(r == m_regnamesPhys[i]) { return; }
199  }
200  m_regnamesPhys.push_back(r);
201  m_typesPhys.push_back(type);
202 }
203 
204 const std::vector<G4String>& G4EmExtraParameters::RegionsPhysics() const
205 {
206  return m_regnamesPhys;
207 }
208 
209 const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
210 {
211  return m_typesPhys;
212 }
213 
215 {
216  G4String r = CheckRegion(region);
217  G4int nreg = m_regnamesSubCut.size();
218  for(G4int i=0; i<nreg; ++i) {
219  if(r == m_regnamesSubCut[i]) {
220  m_subCuts[i] = val;
221  return;
222  }
223  }
224  m_regnamesSubCut.push_back(r);
225  m_subCuts.push_back(val);
226 }
227 
228 void
230  G4double val, G4bool wflag)
231 {
232  if(val > 0.0) {
233  G4int n = m_procBiasedXS.size();
234  for(G4int i=0; i<n; ++i) {
235  if(procname == m_procBiasedXS[i]) {
236  m_factBiasedXS[i] = val;
237  m_weightBiasedXS[i]= wflag;
238  return;
239  }
240  }
241  m_procBiasedXS.push_back(procname);
242  m_factBiasedXS.push_back(val);
243  m_weightBiasedXS.push_back(wflag);
244  } else {
246  ed << "Process: " << procname << " XS biasing factor "
247  << val << " is negative - ignored";
248  PrintWarning(ed);
249  }
250 }
251 
252 void
254  const G4String& region,
255  G4double length,
256  G4bool wflag)
257 {
258  G4String r = CheckRegion(region);
259  if(length >= 0.0) {
260  G4int n = m_procForced.size();
261  for(G4int i=0; i<n; ++i) {
262  if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
263  m_lengthForced[i] = length;
264  m_weightForced[i]= wflag;
265  return;
266  }
267  }
268  m_regnamesForced.push_back(r);
269  m_procForced.push_back(procname);
270  m_lengthForced.push_back(length);
271  m_weightForced.push_back(wflag);
272  } else {
274  ed << "Process: " << procname << " in region " << r
275  << " : forced interacttion length= "
276  << length << " is negative - ignored";
277  PrintWarning(ed);
278  }
279 }
280 
281 void
283  const G4String& region,
284  G4double factor,
285  G4double energyLim)
286 {
287  G4String r = CheckRegion(region);
288  if(factor >= 0.0 && energyLim >= 0.0) {
289  G4int n = m_procBiasedSec.size();
290  for(G4int i=0; i<n; ++i) {
291  if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
292  m_factBiasedSec[i] = factor;
293  m_elimBiasedSec[i] = energyLim;
294  return;
295  }
296  }
297  m_regnamesBiasedSec.push_back(r);
298  m_procBiasedSec.push_back(procname);
299  m_factBiasedSec.push_back(factor);
300  m_elimBiasedSec.push_back(energyLim);
301  } else {
303  ed << "Process: " << procname << " in region " << r
304  << " : secondary bised factor= "
305  << factor << ", Elim= " << energyLim << " - ignored";
306  PrintWarning(ed);
307  }
308 }
309 
311  G4bool isElectron) const
312 {
313  if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
314  else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
315 
316  G4RegionStore* regionStore = G4RegionStore::GetInstance();
317  G4int n = m_regnamesSubCut.size();
318  for(G4int i=0; i<n; ++i) {
319  const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
320  if(reg) { ptr->ActivateSubCutoff(m_subCuts[i], reg); }
321  }
322  n = m_procBiasedXS.size();
323  for(G4int i=0; i<n; ++i) {
324  if(ptr->GetProcessName() == m_procBiasedXS[i]) {
326  m_weightBiasedXS[i]);
327  break;
328  }
329  }
330  n = m_procForced.size();
331  for(G4int i=0; i<n; ++i) {
332  if(ptr->GetProcessName() == m_procForced[i]) {
334  m_regnamesForced[i],
335  m_weightForced[i]);
336  break;
337  }
338  }
339  n = m_procBiasedSec.size();
340  for(G4int i=0; i<n; ++i) {
341  if(ptr->GetProcessName() == m_procBiasedSec[i]) {
343  m_factBiasedSec[i],
344  m_elimBiasedSec[i]);
345  break;
346  }
347  }
348 }
349 
351 {
352  G4int n = m_procBiasedXS.size();
353  for(G4int i=0; i<n; ++i) {
354  if(ptr->GetProcessName() == m_procBiasedXS[i]) {
356  m_weightBiasedXS[i]);
357  break;
358  }
359  }
360  n = m_procForced.size();
361  for(G4int i=0; i<n; ++i) {
362  if(ptr->GetProcessName() == m_procForced[i]) {
364  m_regnamesForced[i],
365  m_weightForced[i]);
366  break;
367  }
368  }
369  n = m_procBiasedSec.size();
370  for(G4int i=0; i<n; ++i) {
371  if(ptr->GetProcessName() == m_procBiasedSec[i]) {
373  m_factBiasedSec[i],
374  m_elimBiasedSec[i]);
375  break;
376  }
377  }
378 }
379 
381 {
382  return quantumEntanglement;
383 }
384 
386 {
388 }
389 
391  return directionalSplitting;
392 }
393 
395 {
397 }
398 
399 void
401 {
403 }
404 
406 {
408 }
409 
411 {
413 }
414 
416 {
418 }
419 
420 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....