71 #ifdef G4ANALYSIS_USE_ROOT
81 if (pMessenger)
delete pMessenger;
97 if ( !
ParseArg(vararg))
return false;
102 if (kinEmin != kinEmax && npoints >1)
104 G4double logmin = std::log10(kinEmin);
105 G4double logmax = std::log10(kinEmax);
110 en = std::pow(10., logmin + (
c*(logmax-logmin) / (npoints - 1.)) );
111 energy.push_back(en/
MeV);
113 massDedx.push_back ( (dedxtot / density)/(
MeV*
cm2/
g) );
118 energy.push_back(kinEmin/
MeV);
120 massDedx.push_back ( (dedxtot / density)/(
MeV*
cm2/
g) );
124 data <<
"MeV " <<
"MeV*cm2/g " << particle <<
" (into " <<
125 material <<
", density = " <<
G4BestUnit(density,
"Volumic Mass") <<
")" <<
G4endl;
128 for (
size_t i=0; i<energy.size(); i++){
129 data << std::setw(16) << energy[i] << massDedx[i] <<
G4endl;
133 #ifdef G4ANALYSIS_USE_ROOT
138 G4String ofName = (filename ==
"") ?
"User terminal": filename;
139 G4cout <<
"User choice:\n";
141 ", Kinetic energy upper limit= " <<
G4BestUnit(kinEmax,
"Energy") <<
142 ", npoints= "<< npoints <<
", particle= \"" << particle <<
143 "\", material= \"" << material <<
"\", filename= \""<<
149 #ifdef G4ANALYSIS_USE_ROOT
150 void IORTInteractionParameters::PlotStopping(
const G4String& filetype)
155 gROOT->SetStyle(
"Plain");
156 theRootCanvas =
new TCanvas(
"theRootCanvas",
"Interaction Parameters",200, 10, 600,400);
157 theRootCanvas -> SetFillColor(20);
158 theRootCanvas -> SetBorderMode(1);
159 theRootCanvas -> SetBorderSize(1);
160 theRootCanvas -> SetFrameBorderMode(0);
161 theRootCanvas -> SetGrid();
165 if (theRootGraph)
delete theRootGraph;
166 theRootGraph =
new TGraph(energy.size(), &energy[0], &massDedx[0]);
168 axisX = theRootGraph -> GetXaxis(),
169 axisY = theRootGraph -> GetYaxis();
171 axisY ->
SetTitle(
"Stopping Power (MeV cm2/g)");
175 axisX -> SetAxisColor(2);
176 axisY -> SetAxisColor(2);
179 theRootGraph -> SetMarkerColor(4);
180 theRootGraph -> SetMarkerStyle(20);
181 theRootGraph -> SetMarkerSize(.5);
183 G4String gName = particle.substr(0, particle.find(
"[") );
184 gName = gName +
"_" + material;
185 G4String fName =
"./referenceData/interaction/" + gName +
"." + filetype;
187 theRootGraph -> Draw(
"AP");
190 theRootCanvas -> SaveAs(fName);
198 if (Pmaterial) density = Pmaterial -> GetDensity();
204 kinEmin = kinEmax = npoints = 0.;
205 particle = material = filename =
"";
207 std::istringstream strParam(vararg);
209 strParam >> std::skipws >> material >> kinEmin >> kinEmax >> npoints >> particle >> filename;
211 npoints = std::floor(npoints);
215 if (kinEmax == 0. && kinEmin > 0. ) kinEmax = kinEmin;
216 if (kinEmax == 0. && kinEmin == 0. ) kinEmax = kinEmin = 1.*
MeV;
217 if (kinEmax < kinEmin)
219 G4cout <<
"WARNING: kinEmin must not exceed kinEmax!" <<
G4endl;
220 G4cout <<
"Usage: /parameter/command material kinetic Emin kinetic Emax nPoints [particle] [output filename]" <<
G4endl;
223 if (npoints < 1) npoints = 1;
226 if (!GetNistMaterial(material) )
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;
234 if (particle ==
"") particle =
"proton";
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;
249 outfile.open(filename,std::ios_base::trunc);
250 data.rdbuf(outfile.rdbuf());
263 G4cout <<
"Issuing a G4RunManager::beamOn()... ";
264 G4cout <<
"Current Run State is " << mState -> GetStateString( aState ) <<
G4endl;
281 const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
282 for (
size_t i=0; i<vec.size(); i++)
288 else if (vararg ==
"all" || vararg ==
"simple" ||
289 vararg ==
"compound" || vararg ==
"hep" )
291 nistMat -> ListMaterials(vararg);
void ListOfNistMaterials(const G4String &vararg)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double cm2
G4double ComputeTotalDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, G4double cut=DBL_MAX)
G4double GetStopping(G4double energy, const G4ParticleDefinition *, const G4Material *, G4double density=0.)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
bool ParseArg(const G4String &vararg)
static G4NistManager * Instance()
IORTInteractionParameters(G4bool)
const XML_Char const XML_Char * data
~IORTInteractionParameters()
static G4StateManager * GetStateManager()
G4GLOB_DLL std::ostream G4cout
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)
static G4RunManager * GetRunManager()
const G4ParticleDefinition * FindParticle(const G4String &)
G4bool GetStoppingTable(const G4String &vararg)
static constexpr double MeV