Geant4  10.02.p02
G4HadronicProcessStore.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 // $Id: G4HadronicProcessStore.cc 92691 2015-09-14 07:04:52Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4HadronicProcessStore
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 09.05.2008
38 //
39 // Modifications:
40 // 23.01.2009 V.Ivanchenko add destruction of processes
41 //
42 // Class Description:
43 // Singleton to store hadronic processes, to provide access to processes
44 // and to printout information about processes
45 //
46 // -------------------------------------------------------------------
47 //
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
52 #include "G4SystemOfUnits.hh"
53 #include "G4UnitsTable.hh"
54 #include "G4Element.hh"
55 #include "G4ProcessManager.hh"
56 #include "G4Electron.hh"
57 #include "G4Proton.hh"
58 #include "G4ParticleTable.hh"
62 #ifdef G4USE_STD11
63  #include <algorithm> //transform
64 #endif
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
66 
68 
70 {
71  if(!instance) {
73  instance = inst.Instance();
74  }
75  return instance;
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
79 
81 {
82  Clean();
83  delete theEPTestMessenger;
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
87 
89 {
90  G4int i;
91  //std::cout << "G4HadronicProcessStore::Clean() Nproc= " << n_proc
92  // << " Nextra= " << n_extra << std::endl;
93  for (i=0; i<n_proc; ++i) {
94  if( process[i] ) {
95  //G4cout << "G4HadronicProcessStore::Clean() delete hadronic "
96  // << i << " " << process[i]->GetProcessName() << G4endl;
97  delete process[i];
98  }
99  }
100  for(i=0; i<n_extra; ++i) {
101  if(extraProcess[i]) {
102  // G4cout << "G4HadronicProcessStore::Clean() delete extra proc "
103  //<< i << " " << extraProcess[i]->GetProcessName() << G4endl;
104  delete extraProcess[i];
105  extraProcess[i] = 0;
106  }
107  }
108  //std::cout << "G4HadronicProcessStore::Clean() done" << std::endl;
109  n_extra = 0;
110  n_proc = 0;
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
114 
116 {
117  n_proc = 0;
118  n_part = 0;
119  n_model= 0;
120  n_extra= 0;
121  currentProcess = 0;
122  currentParticle = 0;
123  theGenericIon =
125  verbose = 1;
126  buildTableStart = true;
128 }
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
130 
132  const G4ParticleDefinition* part,
134  const G4VProcess* proc,
135  const G4Element* element,
136  const G4Material* material)
137 {
138  G4double cross = 0.;
139  G4int subType = proc->GetProcessSubType();
140  if (subType == fHadronElastic)
141  cross = GetElasticCrossSectionPerAtom(part,energy,element,material);
142  else if (subType == fHadronInelastic)
143  cross = GetInelasticCrossSectionPerAtom(part,energy,element,material);
144  else if (subType == fCapture)
145  cross = GetCaptureCrossSectionPerAtom(part,energy,element,material);
146  else if (subType == fFission)
147  cross = GetFissionCrossSectionPerAtom(part,energy,element,material);
148  else if (subType == fChargeExchange)
149  cross = GetChargeExchangeCrossSectionPerAtom(part,energy,element,material);
150  return cross;
151 }
152 
153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
154 
156  const G4ParticleDefinition* part,
158  const G4VProcess* proc,
159  const G4Material* material)
160 {
161  G4double cross = 0.;
162  G4int subType = proc->GetProcessSubType();
163  if (subType == fHadronElastic)
164  cross = GetElasticCrossSectionPerVolume(part,energy,material);
165  else if (subType == fHadronInelastic)
166  cross = GetInelasticCrossSectionPerVolume(part,energy,material);
167  else if (subType == fCapture)
168  cross = GetCaptureCrossSectionPerVolume(part,energy,material);
169  else if (subType == fFission)
170  cross = GetFissionCrossSectionPerVolume(part,energy,material);
171  else if (subType == fChargeExchange)
172  cross = GetChargeExchangeCrossSectionPerVolume(part,energy,material);
173  return cross;
174 }
175 
176 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
177 
179  const G4ParticleDefinition *aParticle,
180  G4double kineticEnergy,
181  const G4Material *material)
182 {
183  G4double cross = 0.0;
184  const G4ElementVector* theElementVector = material->GetElementVector();
185  const G4double* theAtomNumDensityVector =
186  material->GetVecNbOfAtomsPerVolume();
187  size_t nelm = material->GetNumberOfElements();
188  for (size_t i=0; i<nelm; ++i) {
189  const G4Element* elm = (*theElementVector)[i];
190  cross += theAtomNumDensityVector[i]*
191  GetElasticCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
192  }
193  return cross;
194 }
195 
196 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
197 
199  const G4ParticleDefinition *aParticle,
200  G4double kineticEnergy,
201  const G4Element *anElement, const G4Material* mat)
202 {
203  G4HadronicProcess* hp = FindProcess(aParticle, fHadronElastic);
204  G4double cross = 0.0;
205  localDP.SetKineticEnergy(kineticEnergy);
206  if(hp) {
207  cross = hp->GetElementCrossSection(&localDP,anElement,mat);
208  }
209  return cross;
210 }
211 
212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
213 
215  const G4ParticleDefinition*,
216  G4double,
217  G4int, G4int)
218 {
219  return 0.0;
220 }
221 
222 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
223 
225  const G4ParticleDefinition *aParticle,
226  G4double kineticEnergy,
227  const G4Material *material)
228 {
229  G4double cross = 0.0;
230  const G4ElementVector* theElementVector = material->GetElementVector();
231  const G4double* theAtomNumDensityVector =
232  material->GetVecNbOfAtomsPerVolume();
233  size_t nelm = material->GetNumberOfElements();
234  for (size_t i=0; i<nelm; ++i) {
235  const G4Element* elm = (*theElementVector)[i];
236  cross += theAtomNumDensityVector[i]*
237  GetInelasticCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
238  }
239  return cross;
240 }
241 
242 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
243 
245  const G4ParticleDefinition *aParticle,
246  G4double kineticEnergy,
247  const G4Element *anElement, const G4Material* mat)
248 {
250  localDP.SetKineticEnergy(kineticEnergy);
251  G4double cross = 0.0;
252  if(hp) {
253  cross = hp->GetElementCrossSection(&localDP,anElement,mat);
254  }
255  return cross;
256 }
257 
258 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
259 
261  const G4ParticleDefinition *,
262  G4double,
263  G4int, G4int)
264 {
265  return 0.0;
266 }
267 
268 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
269 
271  const G4ParticleDefinition *aParticle,
272  G4double kineticEnergy,
273  const G4Material *material)
274 {
275  G4double cross = 0.0;
276  const G4ElementVector* theElementVector = material->GetElementVector();
277  const G4double* theAtomNumDensityVector =
278  material->GetVecNbOfAtomsPerVolume();
279  size_t nelm = material->GetNumberOfElements();
280  for (size_t i=0; i<nelm; ++i) {
281  const G4Element* elm = (*theElementVector)[i];
282  cross += theAtomNumDensityVector[i]*
283  GetCaptureCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
284  }
285  return cross;
286 }
287 
288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
289 
291  const G4ParticleDefinition *aParticle,
292  G4double kineticEnergy,
293  const G4Element *anElement, const G4Material* mat)
294 {
295  G4HadronicProcess* hp = FindProcess(aParticle, fCapture);
296  localDP.SetKineticEnergy(kineticEnergy);
297  G4double cross = 0.0;
298  if(hp) {
299  cross = hp->GetElementCrossSection(&localDP,anElement,mat);
300  }
301  return cross;
302 }
303 
304 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
305 
307  const G4ParticleDefinition *,
308  G4double,
309  G4int, G4int)
310 {
311  return 0.0;
312 }
313 
314 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
315 
317  const G4ParticleDefinition *aParticle,
318  G4double kineticEnergy,
319  const G4Material *material)
320 {
321  G4double cross = 0.0;
322  const G4ElementVector* theElementVector = material->GetElementVector();
323  const G4double* theAtomNumDensityVector =
324  material->GetVecNbOfAtomsPerVolume();
325  size_t nelm = material->GetNumberOfElements();
326  for (size_t i=0; i<nelm; i++) {
327  const G4Element* elm = (*theElementVector)[i];
328  cross += theAtomNumDensityVector[i]*
329  GetFissionCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
330  }
331  return cross;
332 }
333 
334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
335 
337  const G4ParticleDefinition *aParticle,
338  G4double kineticEnergy,
339  const G4Element *anElement, const G4Material* mat)
340 {
341  G4HadronicProcess* hp = FindProcess(aParticle, fFission);
342  localDP.SetKineticEnergy(kineticEnergy);
343  G4double cross = 0.0;
344  if(hp) {
345  cross = hp->GetElementCrossSection(&localDP,anElement,mat);
346  }
347  return cross;
348 }
349 
350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
351 
353  const G4ParticleDefinition *,
354  G4double,
355  G4int, G4int)
356 {
357  return 0.0;
358 }
359 
360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
361 
363  const G4ParticleDefinition *aParticle,
364  G4double kineticEnergy,
365  const G4Material *material)
366 {
367  G4double cross = 0.0;
368  const G4ElementVector* theElementVector = material->GetElementVector();
369  const G4double* theAtomNumDensityVector =
370  material->GetVecNbOfAtomsPerVolume();
371  size_t nelm = material->GetNumberOfElements();
372  for (size_t i=0; i<nelm; ++i) {
373  const G4Element* elm = (*theElementVector)[i];
374  cross += theAtomNumDensityVector[i]*
375  GetChargeExchangeCrossSectionPerAtom(aParticle,kineticEnergy,elm,material);
376  }
377  return cross;
378 }
379 
380 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
381 
383  const G4ParticleDefinition *aParticle,
384  G4double kineticEnergy,
385  const G4Element *anElement, const G4Material* mat)
386 {
388  localDP.SetKineticEnergy(kineticEnergy);
389  G4double cross = 0.0;
390  if(hp) {
391  cross = hp->GetElementCrossSection(&localDP,anElement,mat);
392  }
393  return cross;
394 }
395 
396 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
397 
399  const G4ParticleDefinition *,
400  G4double,
401  G4int, G4int)
402 {
403  return 0.0;
404 }
405 
406 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
407 
409 {
410  for(G4int i=0; i<n_proc; ++i) {
411  if(process[i] == proc) { return; }
412  }
413  if(1 < verbose) {
414  G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc
415  << " " << proc->GetProcessName() << G4endl;
416  }
417  ++n_proc;
418  process.push_back(proc);
419 }
420 
421 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
422 
424  const G4ParticleDefinition* part)
425 {
426  G4int i=0;
427  for(; i<n_proc; ++i) {if(process[i] == proc) break;}
428  G4int j=0;
429  for(; j<n_part; ++j) {if(particle[j] == part) break;}
430 
431  if(1 < verbose) {
432  G4cout << "G4HadronicProcessStore::RegisterParticle "
433  << part->GetParticleName()
434  << " for " << proc->GetProcessName() << G4endl;
435  }
436  if(j == n_part) {
437  ++n_part;
438  particle.push_back(part);
439  wasPrinted.push_back(0);
440  }
441 
442  // the pair should be added?
443  if(i < n_proc) {
444  std::multimap<PD,HP,std::less<PD> >::iterator it;
445  for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
446  if(it->first == part) {
447  HP process2 = (it->second);
448  if(proc == process2) { return; }
449  }
450  }
451  }
452 
453  p_map.insert(std::multimap<PD,HP>::value_type(part,proc));
454 }
455 
456 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
457 
460 {
461  G4int i=0;
462  for(; i<n_proc; ++i) {if(process[i] == proc) { break; }}
463  G4int k=0;
464  for(; k<n_model; ++k) {if(model[k] == mod) { break; }}
465 
466  m_map.insert(std::multimap<HP,HI>::value_type(proc,mod));
467 
468  if(k == n_model) {
469  ++n_model;
470  model.push_back(mod);
471  modelName.push_back(mod->GetModelName());
472  }
473 }
474 
475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
476 
478 {
479  for(G4int i=0; i<n_proc; ++i) {
480  if(process[i] == proc) {
481  process[i] = 0;
483  return;
484  }
485  }
486 }
487 
488 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
489 
491 {
492  for(G4int i=0; i<n_extra; ++i) {
493  if(extraProcess[i] == proc) { return; }
494  }
495  G4HadronicProcess* hproc = reinterpret_cast<G4HadronicProcess*>(proc);
496  if(hproc) {
497  for(G4int i=0; i<n_proc; ++i) {
498  if(process[i] == hproc) { return; }
499  }
500  }
501  if(1 < verbose) {
502  G4cout << "Extra Process: " << n_extra
503  << " " << proc->GetProcessName() << G4endl;
504  }
505  ++n_extra;
506  extraProcess.push_back(proc);
507 }
508 
509 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
510 
512  G4VProcess* proc,
513  const G4ParticleDefinition* part)
514 {
515  G4int i=0;
516  for(; i<n_extra; ++i) { if(extraProcess[i] == proc) { break; } }
517  G4int j=0;
518  for(; j<n_part; ++j) { if(particle[j] == part) { break; } }
519 
520  if(j == n_part) {
521  ++n_part;
522  particle.push_back(part);
523  wasPrinted.push_back(0);
524  }
525 
526  // the pair should be added?
527  if(i < n_extra) {
528  std::multimap<PD,G4VProcess*,std::less<PD> >::iterator it;
529  for(it=ep_map.lower_bound(part); it!=ep_map.upper_bound(part); ++it) {
530  if(it->first == part) {
531  G4VProcess* process2 = (it->second);
532  if(proc == process2) { return; }
533  }
534  }
535  }
536 
537  ep_map.insert(std::multimap<PD,G4VProcess*>::value_type(part,proc));
538 }
539 
540 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
541 
543 {
544  for(G4int i=0; i<n_extra; ++i) {
545  if(extraProcess[i] == proc) {
546  extraProcess[i] = 0;
547  if(1 < verbose) {
548  G4cout << "Extra Process: " << i << " "
549  <<proc->GetProcessName()<< " is deregisted " << G4endl;
550  }
551  return;
552  }
553  }
554 }
555 
556 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
557 
559 {
560  // Trigger particle/process/model printout only when last particle is
561  // registered
562  if(buildTableStart && part == particle[n_part - 1]) {
563  buildTableStart = false;
564  Dump(verbose);
565  if (getenv("G4PhysListDocDir") ) DumpHtml();
566  }
567 }
568 
569 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
570 
572 {
573  // Automatic generation of html documentation page for physics lists
574  // List processes, models and cross sections for the most important
575  // particles in descending order of importance
576 
577  char* dirName = getenv("G4PhysListDocDir");
578  char* physListName = getenv("G4PhysListName");
579  if (dirName && physListName) {
580 
581  // Open output file with path name
582  G4String pathName = G4String(dirName) + "/" + G4String(physListName) + ".html";
583  std::ofstream outFile;
584  outFile.open(pathName);
585 
586  // Write physics list summary file
587  outFile << "<html>\n";
588  outFile << "<head>\n";
589  outFile << "<title>Physics List Summary</title>\n";
590  outFile << "</head>\n";
591  outFile << "<body>\n";
592  outFile << "<h2> Summary of Hadronic Processes, Models and Cross Sections for Physics List "
593  << G4String(physListName) << "</h2>\n";
594  outFile << "<ul>\n";
595 
596  PrintHtml(G4Proton::Proton(), outFile);
597  PrintHtml(G4Neutron::Neutron(), outFile);
598  PrintHtml(G4PionPlus::PionPlus(), outFile);
599  PrintHtml(G4PionMinus::PionMinus(), outFile);
600  PrintHtml(G4Gamma::Gamma(), outFile);
601  PrintHtml(G4Electron::Electron(), outFile);
602 // PrintHtml(G4MuonMinus::MuonMinus(), outFile);
603  PrintHtml(G4Positron::Positron(), outFile);
604  PrintHtml(G4KaonPlus::KaonPlus(), outFile);
605  PrintHtml(G4KaonMinus::KaonMinus(), outFile);
606  PrintHtml(G4Lambda::Lambda(), outFile);
607  PrintHtml(G4Alpha::Alpha(), outFile);
608 
609  outFile << "</ul>\n";
610  outFile << "</body>\n";
611  outFile << "</html>\n";
612  outFile.close();
613  }
614 }
615 
616 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
617 
619  std::ofstream& outFile)
620 {
621  // Automatic generation of html documentation page for physics lists
622  // List processes for the most important particles in descending order
623  // of importance
624 
625  outFile << "<br> <li><h2><font color=\" ff0000 \">"
626  << theParticle->GetParticleName() << "</font></h2></li>\n";
627 
628  typedef std::multimap<PD,HP,std::less<PD> > PDHPmap;
629  typedef std::multimap<HP,HI,std::less<HP> > HPHImap;
630 
631  std::pair<PDHPmap::iterator, PDHPmap::iterator> itpart =
632  p_map.equal_range(theParticle);
633 
634  // Loop over processes assigned to particle
635 
636  G4HadronicProcess* theProcess;
637  for (PDHPmap::iterator it = itpart.first; it != itpart.second; ++it) {
638  theProcess = (*it).second;
639  // description is inline
640  //outFile << "<br> &nbsp;&nbsp; <b><font color=\" 0000ff \">process : <a href=\""
641  // << theProcess->GetProcessName() << ".html\"> "
642  // << theProcess->GetProcessName() << "</a></font></b>\n";
643  outFile << "<br> &nbsp;&nbsp; <b><font color=\" 0000ff \">process : "
644  << theProcess->GetProcessName() << "</font></b>\n";
645  outFile << "<ul>\n";
646  outFile << " <li>";
647  theProcess->ProcessDescription(outFile);
648  outFile << " <li><b><font color=\" 00AA00 \">models : </font></b>\n";
649  // Loop over models assigned to process
650  std::pair<HPHImap::iterator, HPHImap::iterator> itmod =
651  m_map.equal_range(theProcess);
652 
653  outFile << " <ul>\n";
654  G4String physListName(getenv("G4PhysListName"));
655 
656  for (HPHImap::iterator jt = itmod.first; jt != itmod.second; ++jt) {
657  outFile << " <li><b><a href=\"" << physListName << "_"
658  << HtmlFileName((*jt).second->GetModelName()) << "\"> "
659  << (*jt).second->GetModelName() << "</a>"
660  << " from " << (*jt).second->GetMinEnergy()/GeV
661  << " GeV to " << (*jt).second->GetMaxEnergy()/GeV
662  << " GeV </b></li>\n";
663 
664  // Print ModelDescription, ignore that we overwrite files n-times.
665  PrintModelHtml((*jt).second);
666 
667  }
668  outFile << " </ul>\n";
669  outFile << " </li>\n";
670 
671  // List cross sections assigned to process
672  outFile << " <li><b><font color=\" 00AA00 \">cross sections : </font></b>\n";
673  outFile << " <ul>\n";
674  theProcess->GetCrossSectionDataStore()->DumpHtml(*theParticle, outFile);
675  // << " \n";
676  outFile << " </ul>\n";
677 
678  outFile << " </li>\n";
679  outFile << "</ul>\n";
680  }
681 }
682 
683 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
684 
685 void
687 {
688  G4String dirName(getenv("G4PhysListDocDir"));
689  G4String physListName(getenv("G4PhysListName"));
690  G4String pathName = dirName + "/" + physListName + "_" + HtmlFileName(mod->GetModelName());
691  std::ofstream outModel;
692  outModel.open(pathName);
693  outModel << "<html>\n";
694  outModel << "<head>\n";
695  outModel << "<title>Description of " << mod->GetModelName()
696  << "</title>\n";
697  outModel << "</head>\n";
698  outModel << "<body>\n";
699 
700  mod->ModelDescription(outModel);
701 
702  outModel << "</body>\n";
703  outModel << "</html>\n";
704 
705 }
706 
707 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
708 //private
710 {
711  G4String str(in);
712  // replace blanks by _ C++11 version:
713 #ifdef G4USE_STD11
714  std::transform(str.begin(), str.end(), str.begin(), [](char ch) {
715  return ch == ' ' ? '_' : ch;
716  });
717 #else
718  // and now in ancient language
719  for(std::string::iterator it = str.begin(); it != str.end(); ++it) {
720  if(*it == ' ') *it = '_';
721  }
722 #endif
723  str=str + ".html";
724  return str;
725 }
726 
727 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
728 
730 {
731  if (level == 0) return;
732 
733  G4cout
734  << "\n====================================================================\n"
735  << std::setw(60) << "HADRONIC PROCESSES SUMMARY (verbose level " << level
736  << ")" << G4endl;
737 
738  for (G4int i=0; i<n_part; ++i) {
739  PD part = particle[i];
740  G4String pname = part->GetParticleName();
741  G4bool yes = false;
742 
743  if (level == 1 && (pname == "proton" ||
744  pname == "neutron" ||
745  pname == "deuteron" ||
746  pname == "triton" ||
747  pname == "He3" ||
748  pname == "alpha" ||
749  pname == "pi+" ||
750  pname == "pi-" ||
751  pname == "gamma" ||
752  pname == "e+" ||
753  pname == "e-" ||
754  pname == "mu+" ||
755  pname == "mu-" ||
756  pname == "kaon+" ||
757  pname == "kaon-" ||
758  pname == "lambda" ||
759  pname == "GenericIon" ||
760  pname == "anti_neutron" ||
761  pname == "anti_proton" ||
762  pname == "anti_deuteron" ||
763  pname == "anti_triton" ||
764  pname == "anti_He3" ||
765  pname == "anti_alpha")) yes = true;
766  if (level > 1) yes = true;
767  if (yes) {
768  // main processes
769  std::multimap<PD,HP,std::less<PD> >::iterator it;
770 
771  for (it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
772  if (it->first == part) {
773  HP proc = (it->second);
774  G4int j=0;
775  for (; j<n_proc; ++j) {
776  if (process[j] == proc) { Print(j, i); }
777  }
778  }
779  }
780 
781  // extra processes
782  std::multimap<PD,G4VProcess*,std::less<PD> >::iterator itp;
783  for(itp=ep_map.lower_bound(part); itp!=ep_map.upper_bound(part); ++itp) {
784  if(itp->first == part) {
785  G4VProcess* proc = (itp->second);
786  if (wasPrinted[i] == 0) {
787  G4cout << "\n---------------------------------------------------\n"
788  << std::setw(50) << "Hadronic Processes for "
789  << part->GetParticleName() << "\n";
790  wasPrinted[i] = 1;
791  }
792  G4cout << "\n Process: " << proc->GetProcessName() << G4endl;
793  }
794  }
795  }
796  }
797 
798  G4cout << "\n================================================================"
799  << G4endl;
800 }
801 
802 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
803 
805 {
806  G4HadronicProcess* proc = process[idxProc];
807  const G4ParticleDefinition* part = particle[idxPart];
808  if (wasPrinted[idxPart] == 0) {
809  G4cout << "\n---------------------------------------------------\n"
810  << std::setw(50) << "Hadronic Processes for "
811  << part->GetParticleName() << "\n";
812  wasPrinted[idxPart] = 1;
813  }
814 
815  G4cout << "\n Process: " << proc->GetProcessName();
816 
817  // Append the string "/n" (i.e. "per nucleon") on the kinetic energy of ions.
818  G4String stringEnergyPerNucleon = "";
819  if ( part &&
820  ( part == G4GenericIon::Definition() ||
821  std::abs( part->GetBaryonNumber() ) > 1 ) ) {
822  stringEnergyPerNucleon = "/n";
823  }
824 
825  HI hi = 0;
826  std::multimap<HP,HI,std::less<HP> >::iterator ih;
827  for(ih=m_map.lower_bound(proc); ih!=m_map.upper_bound(proc); ++ih) {
828  if(ih->first == proc) {
829  hi = ih->second;
830  G4int i=0;
831  for(; i<n_model; ++i) {
832  if(model[i] == hi) { break; }
833  }
834  G4cout << "\n Model: " << std::setw(25) << modelName[i] << ": "
835  << G4BestUnit(hi->GetMinEnergy(), "Energy") << stringEnergyPerNucleon
836  << " ---> "
837  << G4BestUnit(hi->GetMaxEnergy(), "Energy") << stringEnergyPerNucleon;
838  }
839  }
840  G4cout << G4endl;
841 
843  csds->DumpPhysicsTable(*part);
844 }
845 
846 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
847 
849 {
850  verbose = val;
851  G4int i;
852  for(i=0; i<n_proc; ++i) {
853  if(process[i]) { process[i]->SetVerboseLevel(val); }
854  }
855  for(i=0; i<n_model; ++i) {
856  if(model[i]) { model[i]->SetVerboseLevel(val); }
857  }
858 }
859 
860 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
861 
863 {
864  return verbose;
865 }
866 
867 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
868 
870  const G4ParticleDefinition* part, G4HadronicProcessType subType)
871 {
872  bool isNew = false;
873  G4HadronicProcess* hp = 0;
874  localDP.SetDefinition(part);
875 
876  if(part != currentParticle) {
877  const G4ParticleDefinition* p = part;
878  if(p->GetBaryonNumber() > 4 && p->GetParticleType() == "nucleus") {
879  p = theGenericIon;
880  }
881  if(p != currentParticle) {
882  isNew = true;
883  currentParticle = p;
884  }
885  }
886  if(!isNew) {
887  if(!currentProcess) {
888  isNew = true;
889  } else if(subType == currentProcess->GetProcessSubType()) {
890  hp = currentProcess;
891  } else {
892  isNew = true;
893  }
894  }
895  if(isNew) {
896  std::multimap<PD,HP,std::less<PD> >::iterator it;
897  for(it=p_map.lower_bound(currentParticle);
898  it!=p_map.upper_bound(currentParticle); ++it) {
899  if(it->first == currentParticle &&
900  subType == (it->second)->GetProcessSubType()) {
901  hp = it->second;
902  break;
903  }
904  }
905  currentProcess = hp;
906  }
907  return hp;
908 }
909 
910 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
911 
913 {
914  G4cout << " Setting energy/momentum report level to " << level
915  << " for " << process.size() << " hadronic processes " << G4endl;
916  for (G4int i = 0; i < G4int(process.size()); ++i) {
917  process[i]->SetEpReportLevel(level);
918  }
919 }
920 
921 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
922 
924 {
925  G4cout << " Setting absolute energy/momentum test level to " << abslevel
926  << G4endl;
927  G4double rellevel = 0.0;
928  G4HadronicProcess* theProcess = 0;
929  for (G4int i = 0; i < G4int(process.size()); ++i) {
930  theProcess = process[i];
931  rellevel = theProcess->GetEnergyMomentumCheckLevels().first;
932  theProcess->SetEnergyMomentumCheckLevels(rellevel, abslevel);
933  }
934 }
935 
936 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
937 
939 {
940  G4cout << " Setting relative energy/momentum test level to " << rellevel
941  << G4endl;
942  G4double abslevel = 0.0;
943  G4HadronicProcess* theProcess = 0;
944  for (G4int i = 0; i < G4int(process.size()); ++i) {
945  theProcess = process[i];
946  abslevel = theProcess->GetEnergyMomentumCheckLevels().second;
947  theProcess->SetEnergyMomentumCheckLevels(rellevel, abslevel);
948  }
949 }
950 
951 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4double GetMinEnergy() const
void DeRegisterExtraProcess(G4VProcess *)
void PrintModelHtml(const G4HadronicInteraction *model) const
std::vector< G4String > modelName
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SetProcessAbsLevel(G4double absoluteLevel)
G4double GetCaptureCrossSectionPerIsotope(const G4ParticleDefinition *aParticle, G4double kineticEnergy, G4int Z, G4int A)
void RegisterInteraction(G4HadronicProcess *, G4HadronicInteraction *)
std::vector< G4Element * > G4ElementVector
std::vector< G4HadronicProcess * > process
G4double GetMaxEnergy() const
void PrintHtml(const G4ParticleDefinition *, std::ofstream &)
static G4HadronicProcessStore * Instance()
G4double GetElasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
std::vector< G4int > wasPrinted
static G4GenericIon * Definition()
Definition: G4GenericIon.cc:49
std::multimap< PD, G4VProcess * > ep_map
virtual void ModelDescription(std::ostream &outFile) const
std::vector< G4HadronicInteraction * > model
G4double GetFissionCrossSectionPerIsotope(const G4ParticleDefinition *aParticle, G4double kineticEnergy, G4int Z, G4int A)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetModelName() const
#define G4ThreadLocal
Definition: tls.hh:89
G4double GetFissionCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:190
int G4int
Definition: G4Types.hh:78
G4HadronicProcessType
const G4String & GetParticleName() const
static G4KaonMinus * KaonMinus()
Definition: G4KaonMinus.cc:113
const G4double * GetVecNbOfAtomsPerVolume() const
Definition: G4Material.hh:206
std::multimap< HP, HI > m_map
void RegisterParticleForExtraProcess(G4VProcess *, const G4ParticleDefinition *)
G4GLOB_DLL std::ostream G4cout
std::vector< G4VProcess * > extraProcess
G4HadronicProcess * FindProcess(const G4ParticleDefinition *, G4HadronicProcessType subType)
void Register(G4HadronicProcess *)
bool G4bool
Definition: G4Types.hh:79
G4double GetChargeExchangeCrossSectionPerIsotope(const G4ParticleDefinition *aParticle, G4double kineticEnergy, G4int Z, G4int A)
G4double GetInelasticCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
G4CrossSectionDataStore * GetCrossSectionDataStore()
G4double GetInelasticCrossSectionPerIsotope(const G4ParticleDefinition *aParticle, G4double kineticEnergy, G4int Z, G4int A)
static G4Proton * Proton()
Definition: G4Proton.cc:93
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:98
static const double GeV
Definition: G4SIunits.hh:214
const G4String & GetParticleType() const
G4double GetChargeExchangeCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
std::multimap< PD, HP > p_map
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
virtual void ProcessDescription(std::ostream &outFile) const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
void RegisterParticle(G4HadronicProcess *, const G4ParticleDefinition *)
void Print(G4int idxProcess, G4int idxParticle)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
void DeRegister(G4HadronicProcess *)
void SetKineticEnergy(G4double aEnergy)
G4String HtmlFileName(const G4String &) const
void RegisterExtraProcess(G4VProcess *)
G4HadronicEPTestMessenger * theEPTestMessenger
void SetEnergyMomentumCheckLevels(G4double relativeLevel, G4double absoluteLevel)
static G4Positron * Positron()
Definition: G4Positron.cc:94
void DumpPhysicsTable(const G4ParticleDefinition &)
G4double GetElementCrossSection(const G4DynamicParticle *part, const G4Element *elm, const G4Material *mat=0)
G4double GetChargeExchangeCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
G4double GetFissionCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
void DumpHtml(const G4ParticleDefinition &, std::ofstream &) const
static G4ParticleTable * GetParticleTable()
G4double GetElasticCrossSectionPerIsotope(const G4ParticleDefinition *aParticle, G4double kineticEnergy, G4int Z, G4int A)
G4double energy(const ThreeVector &p, const G4double m)
G4double GetCrossSectionPerVolume(const G4ParticleDefinition *particle, G4double kineticEnergy, const G4VProcess *process, const G4Material *material)
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:98
void SetProcessRelLevel(G4double relativeLevel)
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
void SetEpReportLevel(G4int level)
G4double GetCaptureCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
static G4Lambda * Lambda()
Definition: G4Lambda.cc:108
G4double GetElasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
double G4double
Definition: G4Types.hh:76
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
static G4ThreadLocal G4HadronicProcessStore * instance
static G4KaonPlus * KaonPlus()
Definition: G4KaonPlus.cc:113
G4double GetInelasticCrossSectionPerVolume(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Material *material)
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
std::pair< G4double, G4double > GetEnergyMomentumCheckLevels() const
G4double GetCrossSectionPerAtom(const G4ParticleDefinition *particle, G4double kineticEnergy, const G4VProcess *process, const G4Element *element, const G4Material *material=0)
G4double GetCaptureCrossSectionPerAtom(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4Element *anElement, const G4Material *mat=0)
void PrintInfo(const G4ParticleDefinition *)