Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
HadrontherapyInteractionParameters Class Reference

#include <HadrontherapyInteractionParameters.hh>

Inheritance diagram for HadrontherapyInteractionParameters:
G4EmCalculator

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=0)
 
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=0)
 
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=0)
 
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=0)
 
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=0)
 
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=0)
 
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=0)
 
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 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 ComputeGammaAttenuationLength (G4double kinEnergy, const G4Material *)
 
G4double ComputeShellIonisationCrossSectionPerAtom (const G4String &part, G4int Z, G4AtomicShellEnumerator shell, G4double kinEnergy, const G4Material *mat=0)
 
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=0)
 
void SetVerbose (G4int val)
 

Detailed Description

Definition at line 59 of file HadrontherapyInteractionParameters.hh.

Constructor & Destructor Documentation

HadrontherapyInteractionParameters::HadrontherapyInteractionParameters ( G4bool  wantMessenger)

Definition at line 59 of file HadrontherapyInteractionParameters.cc.

59  :
60  nistEle(new G4NistElementBuilder(0)),
61  nistMat(new G4NistMaterialBuilder(nistEle, 0)),
62  data(G4cout.rdbuf()),
63  pMessenger(0),
64  beamFlag(false)
65 #ifdef G4ANALYSIS_USE_ROOT
66  ,theRootCanvas(0),
67  theRootGraph(0)
68 #endif
69 {
70  if (wantMessenger) pMessenger = new HadrontherapyParameterMessenger(this);
71 }
G4GLOB_DLL std::ostream G4cout
const XML_Char const XML_Char * data
HadrontherapyInteractionParameters::~HadrontherapyInteractionParameters ( )

Definition at line 73 of file HadrontherapyInteractionParameters.cc.

74 {
75  if (pMessenger) delete pMessenger;
76  delete nistMat;
77  delete nistEle;
78 }

Member Function Documentation

void HadrontherapyInteractionParameters::BeamOn ( )

Definition at line 250 of file HadrontherapyInteractionParameters.cc.

References G4cout, G4endl, G4State_Idle, G4RunManager::GetRunManager(), and G4StateManager::GetStateManager().

Referenced by ParseArg().

251 {
252  // first check if RunManager is above G4State_Idle
254  G4ApplicationState aState = mState -> GetCurrentState();
255  if ( aState <= G4State_Idle && beamFlag == false)
256  {
257  G4cout << "Issuing a G4RunManager::beamOn()... ";
258  G4cout << "Current Run State is " << mState -> GetStateString( aState ) << G4endl;
260  beamFlag = true;
261  }
262 
263 }
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
G4ApplicationState
G4double HadrontherapyInteractionParameters::GetStopping ( G4double  energy,
const G4ParticleDefinition pDef,
const G4Material pMat,
G4double  density = 0. 
)

Definition at line 80 of file HadrontherapyInteractionParameters.cc.

References G4EmCalculator::ComputeTotalDEDX().

84 {
85  if (dens) return ComputeTotalDEDX(ene, pDef, pMat)/dens;
86  return ComputeTotalDEDX(ene, pDef, pMat);
87 }
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
bool HadrontherapyInteractionParameters::GetStoppingTable ( const G4String vararg)

Definition at line 88 of file HadrontherapyInteractionParameters.cc.

References test::c, python.hepunit::cm2, G4EmCalculator::ComputeTotalDEDX(), g(), G4BestUnit, G4cout, G4endl, left, python.hepunit::MeV, and ParseArg().

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

Definition at line 265 of file HadrontherapyInteractionParameters.cc.

References G4cout, G4endl, and left.

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

Definition at line 196 of file HadrontherapyInteractionParameters.cc.

References BeamOn(), G4EmCalculator::FindParticle(), G4cout, G4endl, and python.hepunit::MeV.

Referenced by GetStoppingTable().

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

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