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

#include <HadrontherapyInteractionParameters.hh>

Inheritance diagram for HadrontherapyInteractionParameters:
Collaboration diagram for HadrontherapyInteractionParameters:

Public Member Functions

 HadrontherapyInteractionParameters (G4bool)
 
 ~HadrontherapyInteractionParameters ()
 
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 53 of file HadrontherapyInteractionParameters.hh.

Constructor & Destructor Documentation

HadrontherapyInteractionParameters::HadrontherapyInteractionParameters ( G4bool  wantMessenger)

Definition at line 53 of file HadrontherapyInteractionParameters.cc.

53  :
54  nistEle(new G4NistElementBuilder(0)),
55  nistMat(new G4NistMaterialBuilder(nistEle, 0)),
56  data(G4cout.rdbuf()),
57  pMessenger(0),
58  beamFlag(false)
59 #ifdef G4ANALYSIS_USE_ROOT
60  ,theRootCanvas(0),
61  theRootGraph(0)
62 #endif
63 {
64  if (wantMessenger) pMessenger = new HadrontherapyParameterMessenger(this);
65 }
const XML_Char const XML_Char * data
Definition: expat.h:268
G4GLOB_DLL std::ostream G4cout
HadrontherapyInteractionParameters::~HadrontherapyInteractionParameters ( )

Definition at line 67 of file HadrontherapyInteractionParameters.cc.

68 {
69  if (pMessenger) delete pMessenger;
70  delete nistMat;
71  delete nistEle;
72 }

Member Function Documentation

void HadrontherapyInteractionParameters::BeamOn ( )

Definition at line 244 of file HadrontherapyInteractionParameters.cc.

245 {
246  // first check if RunManager is above G4State_Idle
248  G4ApplicationState aState = mState -> GetCurrentState();
249  if ( aState <= G4State_Idle && beamFlag == false)
250  {
251  G4cout << "Issuing a G4RunManager::beamOn()... ";
252  G4cout << "Current Run State is " << mState -> GetStateString( aState ) << G4endl;
254  beamFlag = true;
255  }
256 
257 }
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 HadrontherapyInteractionParameters::GetStopping ( G4double  energy,
const G4ParticleDefinition pDef,
const G4Material pMat,
G4double  density = 0. 
)

Definition at line 74 of file HadrontherapyInteractionParameters.cc.

78 {
79  if (dens) return ComputeTotalDEDX(ene, pDef, pMat)/dens;
80  return ComputeTotalDEDX(ene, pDef, pMat);
81 }
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)

Here is the call graph for this function:

bool HadrontherapyInteractionParameters::GetStoppingTable ( const G4String vararg)

Definition at line 82 of file HadrontherapyInteractionParameters.cc.

83 {
84  // Check arguments
85  if ( !ParseArg(vararg)) return false;
86  // Clear previous energy & mass sp vectors
87  energy.clear();
88  massDedx.clear();
89  // log scale
90  if (kinEmin != kinEmax && npoints >1)
91  {
92  G4double logmin = std::log10(kinEmin);
93  G4double logmax = std::log10(kinEmax);
94  G4double en;
95  // uniform log space
96  for (G4double c = 0.; c < npoints; c++)
97  {
98  en = std::pow(10., logmin + ( c*(logmax-logmin) / (npoints - 1.)) );
99  energy.push_back(en/MeV);
100  dedxtot = ComputeTotalDEDX (en, particle, material);
101  massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
102  }
103  }
104  else // one point only
105  {
106  energy.push_back(kinEmin/MeV);
107  dedxtot = ComputeTotalDEDX (kinEmin, particle, material);
108  massDedx.push_back ( (dedxtot / density)/(MeV*cm2/g) );
109  }
110 
111  G4cout.precision(6);
112  data << "MeV " << "MeV*cm2/g " << particle << " (into " <<
113  material << ", density = " << G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
114  data << G4endl;
115  data << std::left << std::setfill(' ');
116  for (size_t i=0; i<energy.size(); i++){
117  data << std::setw(16) << energy[i] << massDedx[i] << G4endl;
118  }
119  outfile.close();
120  // This will plot
121 #ifdef G4ANALYSIS_USE_ROOT
122  PlotStopping("pdf");
123 #endif
124 
125 // Info to user
126  G4String ofName = (filename == "") ? "User terminal": filename;
127  G4cout << "User choice:\n";
128  G4cout << "Kinetic energy lower limit= "<< G4BestUnit(kinEmin,"Energy") <<
129  ", Kinetic energy upper limit= " << G4BestUnit(kinEmax,"Energy") <<
130  ", npoints= "<< npoints << ", particle= \"" << particle <<
131  "\", material= \"" << material << "\", filename= \""<<
132  ofName << "\"" << G4endl;
133  return true;
134 }
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
const XML_Char const XML_Char * data
Definition: expat.h:268
string material
Definition: eplot.py:19
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
G4double energy(const ThreeVector &p, const G4double m)
#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 HadrontherapyInteractionParameters::ListOfNistMaterials ( const G4String vararg)

Definition at line 259 of file HadrontherapyInteractionParameters.cc.

260 {
261 /*
262  $G4INSTALL/source/materials/src/G4NistElementBuilder.cc
263  You can also construct a new material by the ConstructNewMaterial method:
264  see $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc
265 */
266  // Get simplest full list
267  if (vararg =="list")
268  {
269  const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
270  for (size_t i=0; i<vec.size(); i++)
271  {
272  G4cout << std::setw(12) << std::left << i+1 << vec[i] << G4endl;
273  }
274  G4cout << G4endl;
275  }
276  else if (vararg =="all" || vararg =="simple" || vararg =="compound" || vararg =="hep" )
277  {
278  nistMat -> ListMaterials(vararg);
279  }
280 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
bool HadrontherapyInteractionParameters::ParseArg ( const G4String vararg)

Definition at line 190 of file HadrontherapyInteractionParameters.cc.

191 {
192  kinEmin = kinEmax = npoints = 0.;
193  particle = material = filename = "";
194  // set internal variables
195  std::istringstream strParam(vararg);
196  // TODO here check for number and parameters consistency
197  strParam >> std::skipws >> material >> kinEmin >> kinEmax >> npoints >> particle >> filename;
198  // npoints must be an integer!
199  npoints = std::floor(npoints);
200 
201 // Check that kinEmax >= kinEmin > 0 && npoints >= 1
202 // TODO NIST points and linear scale
203  if (kinEmax == 0. && kinEmin > 0. ) kinEmax = kinEmin;
204  if (kinEmax == 0. && kinEmin == 0. ) kinEmax = kinEmin = 1.*MeV;
205  if (kinEmax < kinEmin)
206  {
207  G4cout << "WARNING: kinEmin must not exceed kinEmax!" << G4endl;
208  G4cout << "Usage: /parameter/command material EkinMin EKinMax nPoints [particle] [output filename]" << G4endl;
209  return false;
210  }
211  if (npoints < 1) npoints = 1;
212 
213  // check if element/material is into database
214  if (!GetNistMaterial(material) )
215  {
216  G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials"
217  " table [$G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl;
218  G4cout << "Use command \"/parameter/nist\" to see full materials list" << G4endl;
219  return false;
220  }
221  // Check for particle
222  if (particle == "") particle = "proton"; // default to "proton"
223  else if ( !FindParticle(particle) )
224  {
225  G4cout << "WARNING: Particle \"" << particle << "\" isn't supported." << G4endl;
226  G4cout << "Try the command \"/particle/list\" to get full supported particles list." << G4endl;
227  G4cout << "If you are interested in an ion that isn't in this list you must give it to the particle gun."
228  "\nTry the commands:\n/gun/particle ion"
229  "\n/gun/ion <atomic number> <mass number> <[charge]>" << G4endl << G4endl;
230  return false;
231  }
232  // start physics by forcing a G4RunManager::BeamOn():
233  BeamOn();
234  // Set output file
235  if( filename != "" )
236  {
237  outfile.open(filename,std::ios_base::trunc); // overwrite existing file
238  data.rdbuf(outfile.rdbuf());
239  }
240  else data.rdbuf(G4cout.rdbuf()); // output is G4cout!
241  return true;
242 }
const XML_Char const XML_Char * data
Definition: expat.h:268
string material
Definition: eplot.py:19
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: