Public Member Functions | Public Attributes | List of all members
g4n::PrintTables Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/g4nova/PrintTables.h"

Public Member Functions

 PrintTables ()
 
void Materials ()
 
void dEdx ()
 

Public Attributes

const G4MaterialTable * fMaterialTable
 
G4ParticleTable * fParticleTable
 

Detailed Description

Definition at line 10 of file PrintTables.h.

Constructor & Destructor Documentation

PrintTables::PrintTables ( )

Definition at line 11 of file PrintTables.cxx.

References fMaterialTable, and fParticleTable.

12 {
13  fMaterialTable = G4Material::GetMaterialTable();
14  fParticleTable = G4ParticleTable::GetParticleTable();
15 }
const G4MaterialTable * fMaterialTable
Definition: PrintTables.h:22
G4ParticleTable * fParticleTable
Definition: PrintTables.h:23

Member Function Documentation

void PrintTables::dEdx ( )

Print dEdx tables

Definition at line 43 of file PrintTables.cxx.

References CLHEP::cm2, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, fMaterialTable, plot_validation_datamc::fname, fParticleTable, CLHEP::g, CLHEP::GeV, MECModelEnuComparisons::i, kemax, kemin, CLHEP::keV, std::log10(), m, CLHEP::MeV, LSTME::PDG_MUON, cet::pow(), string, and CLHEP::TeV.

Referenced by g4n::G4Gen::endJob().

44 {
45  static const int PDG_MUON = 13;
46  unsigned int i, k;
47 
48  unsigned int nbin = 90;
49  double ke[nbin];
50  double kemin = 10*CLHEP::keV;
51  double kemax = 10*CLHEP::TeV;
52  double dp = log10(kemax/kemin)/(nbin-1);
53  double dt = pow(10.0, dp);
54  ke[0] = kemin;
55  for (i=1; i<nbin; ++i) ke[i] = ke[i-1]*dt;
56 
57  G4ParticleDefinition* p = fParticleTable->FindParticle(PDG_MUON);
58 
59  G4EmCalculator g4EMCalc;
60  for (i=0; i<fMaterialTable->size(); ++i) {
61  const G4Material* m = (*fMaterialTable)[i];
62  double rho = m->GetDensity();
63 
64  std::string fname = "g4nova-muon-dedx-";
65  fname += m->GetName();
66  fname += ".txt";
67 
68  std::ofstream f;
69  f.open(fname);
70  f << "# MUON ENERGY LOSS FOR " << m->GetName() << std::endl;
71  f << "# T [GeV]\t dE/dx [MeV cm^2/g]" << std::endl;
72  for (k=0; k<nbin; ++k) {
73  f << ke[k]/CLHEP::GeV << "\t"
74  << g4EMCalc.ComputeTotalDEDX(ke[k], p, m)/rho/(CLHEP::MeV*CLHEP::cm2/CLHEP::g)
75  << std::endl;
76  }
77  f.close();
78  }
79 }
static constexpr double g
const char * p
Definition: xmltok.h:285
constexpr T pow(T x)
Definition: pow.h:75
const G4MaterialTable * fMaterialTable
Definition: PrintTables.h:22
const double kemax
static constexpr double TeV
Definition: Cand.cxx:23
G4ParticleTable * fParticleTable
Definition: PrintTables.h:23
const int PDG_MUON
Definition: ProngCVNVars.h:14
static constexpr double MeV
static constexpr double cm2
T log10(T number)
Definition: d0nt_math.hpp:120
const double kemin
static constexpr double keV
static constexpr double GeV
enum BeamMode string
void PrintTables::Materials ( )

Print the materials table

Definition at line 19 of file PrintTables.cxx.

References CLHEP::cm, CLHEP::cm3, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, fMaterialTable, CLHEP::gram, MECModelEnuComparisons::i, and m.

Referenced by g4n::G4Gen::endJob().

20 {
21  std::ofstream f;
22  f.open("g4nova-materials.txt");
23  unsigned int i;
24  f << "*= MATERIALS" << std::endl;
25  f << "n\tName\tZeff\tDensity [g/cc]\tRadLen [cm]\t"
26  << "Nucl. Int. Len [cm]\t"
27  << std::endl;
28  for (i=0; i<fMaterialTable->size(); ++i) {
29  const G4Material* m = (*fMaterialTable)[i];
30  f << i << "\t"
31  << m->GetName() << "\t"
32  << m->GetIonisation()->GetZeffective() << "\t"
33  << m->GetDensity()/(CLHEP::gram/CLHEP::cm3) << "\t"
34  << m->GetRadlen()/CLHEP::cm << "\t"
35  << m->GetNuclearInterLength()/CLHEP::cm
36  << std::endl;
37  }
38  f.close();
39 }
static constexpr double cm3
const G4MaterialTable * fMaterialTable
Definition: PrintTables.h:22
static constexpr double cm
Definition: SystemOfUnits.h:99
static constexpr double gram

Member Data Documentation

const G4MaterialTable* g4n::PrintTables::fMaterialTable

Definition at line 22 of file PrintTables.h.

Referenced by dEdx(), Materials(), and PrintTables().

G4ParticleTable* g4n::PrintTables::fParticleTable

Definition at line 23 of file PrintTables.h.

Referenced by dEdx(), and PrintTables().


The documentation for this class was generated from the following files: