Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IORTInteractionParameters Class Reference

#include <IORTInteractionParameters.hh>

Inheritance diagram for IORTInteractionParameters:
Collaboration diagram for IORTInteractionParameters:

Public Member Functions

 IORTInteractionParameters (G4bool)
 
 ~IORTInteractionParameters ()
 
G4bool GetStoppingTable (const G4String &vararg)
 
G4double GetStopping (G4double energy, const G4ParticleDefinition *, const G4Material *, G4double density=0.)
 
void ListOfNistMaterials (const G4String &vararg)
 
void BeamOn ()
 
bool ParseArg (const G4String &vararg)
 
- Public Member Functions inherited from G4EmCalculator
 G4EmCalculator ()
 
 ~G4EmCalculator ()
 
G4double GetDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetRangeFromRestricteDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetRangeFromRestricteDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetCSDARange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetCSDARange (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetRange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetRange (G4double kinEnergy, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetKinEnergy (G4double range, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
 
G4double GetKinEnergy (G4double range, const G4String &part, const G4String &mat, const G4String &s="world")
 
G4double GetCrossSectionPerVolume (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
 
G4double GetCrossSectionPerVolume (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, const G4String &s="world")
 
G4double GetShellIonisationCrossSectionPerAtom (const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy)
 
G4double GetMeanFreePath (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, const G4Region *r=nullptr)
 
G4double GetMeanFreePath (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, const G4String &s="world")
 
void PrintDEDXTable (const G4ParticleDefinition *)
 
void PrintRangeTable (const G4ParticleDefinition *)
 
void PrintInverseRangeTable (const G4ParticleDefinition *)
 
G4double ComputeDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=DBL_MAX)
 
G4double ComputeDEDX (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, G4double cut=DBL_MAX)
 
G4double ComputeElectronicDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double cut=DBL_MAX)
 
G4double ComputeElectronicDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, G4double cut=DBL_MAX)
 
G4double ComputeDEDXForCutInRange (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *mat, G4double rangecut=DBL_MAX)
 
G4double ComputeDEDXForCutInRange (G4double kinEnergy, const G4String &part, const G4String &mat, G4double rangecut=DBL_MAX)
 
G4double ComputeNuclearDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeNuclearDEDX (G4double kinEnergy, const G4String &part, const G4String &mat)
 
G4double ComputeTotalDEDX (G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
 
G4double ComputeTotalDEDX (G4double kinEnergy, const G4String &part, const G4String &mat, G4double cut=DBL_MAX)
 
G4double ComputeCrossSectionPerVolume (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
 
G4double ComputeCrossSectionPerVolume (G4double kinEnergy, const G4String &part, const G4String &proc, const G4String &mat, G4double cut=0.0)
 
G4double ComputeCrossSectionPerAtom (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4double Z, G4double A, G4double cut=0.0)
 
G4double ComputeCrossSectionPerAtom (G4double kinEnergy, const G4String &part, const G4String &processName, const G4Element *, G4double cut=0.0)
 
G4double ComputeCrossSectionPerShell (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, G4int Z, G4int shellIdx, G4double cut=0.0)
 
G4double ComputeCrossSectionPerShell (G4double kinEnergy, const G4String &part, const G4String &processName, const G4Element *, G4int shellIdx, G4double cut=0.0)
 
G4double ComputeGammaAttenuationLength (G4double kinEnergy, const G4Material *)
 
G4double ComputeShellIonisationCrossSectionPerAtom (const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy, const G4Material *mat=nullptr)
 
G4double ComputeMeanFreePath (G4double kinEnergy, const G4ParticleDefinition *, const G4String &processName, const G4Material *, G4double cut=0.0)
 
G4double ComputeMeanFreePath (G4double kinEnergy, const G4String &, const G4String &, const G4String &processName, G4double cut=0.0)
 
G4double ComputeEnergyCutFromRangeCut (G4double range, const G4ParticleDefinition *, const G4Material *)
 
G4double ComputeEnergyCutFromRangeCut (G4double range, const G4String &, const G4String &)
 
const G4ParticleDefinitionFindParticle (const G4String &)
 
const G4ParticleDefinitionFindIon (G4int Z, G4int A)
 
const G4MaterialFindMaterial (const G4String &)
 
const G4RegionFindRegion (const G4String &)
 
const G4MaterialCutsCoupleFindCouple (const G4Material *, const G4Region *r=nullptr)
 
G4VProcessFindProcess (const G4ParticleDefinition *part, const G4String &processName)
 
void SetupMaterial (const G4Material *)
 
void SetupMaterial (const G4String &)
 
void SetVerbose (G4int val)
 

Detailed Description

Definition at line 64 of file IORTInteractionParameters.hh.

Constructor & Destructor Documentation

IORTInteractionParameters::IORTInteractionParameters ( G4bool  wantMessenger)

Definition at line 65 of file IORTInteractionParameters.cc.

65  :
66  nistEle(new G4NistElementBuilder(0)),
67  nistMat(new G4NistMaterialBuilder(nistEle, 0)),
68  data(G4cout.rdbuf()),
69  pMessenger(0),
70  beamFlag(false)
71 #ifdef G4ANALYSIS_USE_ROOT
72  ,theRootCanvas(0),
73  theRootGraph(0)
74 #endif
75 {
76  if (wantMessenger) pMessenger = new IORTParameterMessenger(this);
77 }
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
IORTInteractionParameters::~IORTInteractionParameters ( )

Definition at line 79 of file IORTInteractionParameters.cc.

80 {
81  if (pMessenger) delete pMessenger;
82  delete nistMat;
83  delete nistEle;
84 }

Member Function Documentation

void IORTInteractionParameters::BeamOn ( )

Definition at line 256 of file IORTInteractionParameters.cc.

257 {
258  // first check if RunManager is above G4State_Idle
260  G4ApplicationState aState = mState -> GetCurrentState();
261  if ( aState <= G4State_Idle && beamFlag == false)
262  {
263  G4cout << "Issuing a G4RunManager::beamOn()... ";
264  G4cout << "Current Run State is " << mState -> GetStateString( aState ) << G4endl;
266  beamFlag = true;
267  }
268 
269 }
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#define G4endl
Definition: G4ios.hh:61
G4ApplicationState

Here is the call graph for this function:

Here is the caller graph for this function:

G4double IORTInteractionParameters::GetStopping ( G4double  energy,
const G4ParticleDefinition pDef,
const G4Material pMat,
G4double  density = 0. 
)

Definition at line 86 of file IORTInteractionParameters.cc.

90 {
91  if (dens) return ComputeTotalDEDX(ene, pDef, pMat)/dens;
92  return ComputeTotalDEDX(ene, pDef, pMat);
93 }
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)

Here is the call graph for this function:

bool IORTInteractionParameters::GetStoppingTable ( const G4String vararg)

Definition at line 94 of file IORTInteractionParameters.cc.

95 {
96  // Check arguments
97  if ( !ParseArg(vararg)) return false;
98  // Clear previous energy & mass sp vectors
99  energy.clear();
100  massDedx.clear();
101  // log scale
102  if (kinEmin != kinEmax && npoints >1)
103  {
104  G4double logmin = std::log10(kinEmin);
105  G4double logmax = std::log10(kinEmax);
106  G4double en;
107  // uniform log space
108  for (G4double c = 0.; c < npoints; c++)
109  {
110  en = std::pow(10., logmin + ( c*(logmax-logmin) / (npoints - 1.)) );
111  energy.push_back(en/MeV);
112  dedxtot = ComputeTotalDEDX (en, particle, material);
113  massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
114  }
115  }
116  else // one point only
117  {
118  energy.push_back(kinEmin/MeV);
119  dedxtot = ComputeTotalDEDX (kinEmin, particle, material);
120  massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
121  }
122 
123  G4cout.precision(6);
124  data << "MeV " << "MeV*cm2/g " << particle << " (into " <<
125  material << ", density = " << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
126  data << G4endl;
127  data << std::left << std::setfill(' ');
128  for (size_t i=0; i<energy.size(); i++){
129  data << std::setw(16) << energy[i] << massDedx[i] << G4endl;
130  }
131  outfile.close();
132  // This will plot
133 #ifdef G4ANALYSIS_USE_ROOT
134  PlotStopping("pdf");
135 #endif
136 
137  // Info to user
138  G4String ofName = (filename == "") ? "User terminal": filename;
139  G4cout << "User choice:\n";
140  G4cout << "Kinetic energy lower limit= "<< G4BestUnit(kinEmin,"Energy") <<
141  ", Kinetic energy upper limit= " << G4BestUnit(kinEmax,"Energy") <<
142  ", npoints= "<< npoints << ", particle= \"" << particle <<
143  "\", material= \"" << material << "\", filename= \""<<
144  ofName << "\"" << G4endl;
145  return true;
146 }
static constexpr double cm2
Definition: G4SIunits.hh:120
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
bool ParseArg(const G4String &vararg)
const XML_Char const XML_Char * data
Definition: expat.h:268
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13

Here is the call graph for this function:

void IORTInteractionParameters::ListOfNistMaterials ( const G4String vararg)

Definition at line 271 of file IORTInteractionParameters.cc.

272 {
273 /*
274  $G4INSTALL/source/materials/src/G4NistElementBuilder.cc
275  You can also construct a new material by the ConstructNewMaterial method:
276  see $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc
277 */
278  // Get simplest full list
279  if (vararg =="list")
280  {
281  const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
282  for (size_t i=0; i<vec.size(); i++)
283  {
284  G4cout << std::setw(12) << std::left << i+1 << vec[i] << G4endl;
285  }
286  G4cout << G4endl;
287  }
288  else if (vararg =="all" || vararg =="simple" ||
289  vararg =="compound" || vararg =="hep" )
290  {
291  nistMat -> ListMaterials(vararg);
292  }
293 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
bool IORTInteractionParameters::ParseArg ( const G4String vararg)

Definition at line 202 of file IORTInteractionParameters.cc.

203 {
204  kinEmin = kinEmax = npoints = 0.;
205  particle = material = filename = "";
206  // set internal variables
207  std::istringstream strParam(vararg);
208  // TODO here check for number and parameters consistency
209  strParam >> std::skipws >> material >> kinEmin >> kinEmax >> npoints >> particle >> filename;
210  // npoints must be an integer!
211  npoints = std::floor(npoints);
212 
213 // Check that kinEmax >= kinEmin > 0 && npoints >= 1
214 // TODO NIST points and linear scale
215  if (kinEmax == 0. && kinEmin > 0. ) kinEmax = kinEmin;
216  if (kinEmax == 0. && kinEmin == 0. ) kinEmax = kinEmin = 1.*MeV;
217  if (kinEmax < kinEmin)
218  {
219  G4cout << "WARNING: kinEmin must not exceed kinEmax!" << G4endl;
220  G4cout << "Usage: /parameter/command material kinetic Emin kinetic Emax nPoints [particle] [output filename]" << G4endl;
221  return false;
222  }
223  if (npoints < 1) npoints = 1;
224 
225  // check if element/material is into database
226  if (!GetNistMaterial(material) )
227  {
228  G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
229  " table [$G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
230  G4cout << "Use command \"/parameter/nist\" to see full materials list" << G4endl;
231  return false;
232  }
233  // Check for particle
234  if (particle == "") particle = "proton"; // default to "proton"
235  else if ( !FindParticle(particle) )
236  {
237  G4cout << "WARNING: Particle \"" << particle << "\" isn't supported." << G4endl;
238  G4cout << "Try the command \"/particle/list\" to get full supported particles list." << G4endl;
239  G4cout << "If you are interested in an ion that isn't in this list you must give it to the particle gun."
240  "\nTry the commands:\n/gun/particle ion"
241  "\n/gun/ion <atomic number> <mass number> <[charge]>" << G4endl << G4endl;
242  return false;
243  }
244  // start physics by forcing a G4RunManager::BeamOn():
245  BeamOn();
246  // Set output file
247  if( filename != "" )
248  {
249  outfile.open(filename,std::ios_base::trunc); // overwrite existing file
250  data.rdbuf(outfile.rdbuf());
251  }
252  else data.rdbuf(G4cout.rdbuf()); // output is G4cout!
253  return true;
254 }
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
const G4ParticleDefinition * FindParticle(const G4String &)
#define G4endl
Definition: G4ios.hh:61
static constexpr double MeV
Definition: G4SIunits.hh:214

Here is the call graph for this function:

Here is the caller graph for this function:


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