65 #ifdef G4ANALYSIS_USE_ROOT
75 if (pMessenger)
delete pMessenger;
91 if ( !
ParseArg(vararg))
return false;
96 if (kinEmin != kinEmax && npoints >1)
98 G4double logmin = std::log10(kinEmin);
99 G4double logmax = std::log10(kinEmax);
104 en = std::pow(10., logmin + (
c*(logmax-logmin) / (npoints - 1.)) );
105 energy.push_back(en/
MeV);
107 massDedx.push_back ( (dedxtot / density)/(
MeV*
cm2/
g) );
112 energy.push_back(kinEmin/
MeV);
114 massDedx.push_back ( (dedxtot / density)/(
MeV*
cm2/
g) );
118 data <<
"MeV " <<
"MeV*cm2/g " << particle <<
" (into " <<
119 material <<
", density = " <<
G4BestUnit(density,
"Volumic Mass") <<
")" <<
G4endl;
122 for (
size_t i=0; i<energy.size(); i++){
123 data << std::setw(16) << energy[i] << massDedx[i] <<
G4endl;
127 #ifdef G4ANALYSIS_USE_ROOT
132 G4String ofName = (filename ==
"") ?
"User terminal": filename;
133 G4cout <<
"User choice:\n";
135 ", Kinetic energy upper limit= " <<
G4BestUnit(kinEmax,
"Energy") <<
136 ", npoints= "<< npoints <<
", particle= \"" << particle <<
137 "\", material= \"" << material <<
"\", filename= \""<<
143 #ifdef G4ANALYSIS_USE_ROOT
144 void HadrontherapyInteractionParameters::PlotStopping(
const G4String& filetype)
149 gROOT->SetStyle(
"Plain");
150 theRootCanvas =
new TCanvas(
"theRootCanvas",
"Interaction Parameters",200, 10, 600,400);
152 theRootCanvas -> SetBorderMode(1);
153 theRootCanvas -> SetBorderSize(1);
154 theRootCanvas -> SetFrameBorderMode(0);
155 theRootCanvas -> SetGrid();
159 if (theRootGraph)
delete theRootGraph;
160 theRootGraph =
new TGraph(energy.size(), &energy[0], &massDedx[0]);
165 axisY ->
SetTitle(
"Stopping Power (MeV cm2/g)");
169 axisX -> SetAxisColor(2);
170 axisY -> SetAxisColor(2);
177 G4String gName = particle.substr(0, particle.find(
"[") );
178 gName = gName +
"_" + material;
179 G4String fName =
"./referenceData/interaction/" + gName +
"." + filetype;
181 theRootGraph ->
Draw(
"AP");
184 theRootCanvas -> SaveAs(fName);
192 if (Pmaterial) density = Pmaterial -> GetDensity();
198 kinEmin = kinEmax = npoints = 0.;
199 particle = material = filename =
"";
201 std::istringstream strParam(vararg);
203 strParam >> std::skipws >> material >> kinEmin >> kinEmax >> npoints >> particle >> filename;
205 npoints = std::floor(npoints);
209 if (kinEmax == 0. && kinEmin > 0. ) kinEmax = kinEmin;
210 if (kinEmax == 0. && kinEmin == 0. ) kinEmax = kinEmin = 1.*
MeV;
211 if (kinEmax < kinEmin)
213 G4cout <<
"WARNING: kinEmin must not exceed kinEmax!" <<
G4endl;
214 G4cout <<
"Usage: /parameter/command material kinetic Emin kinetic Emax nPoints [particle] [output filename]" <<
G4endl;
217 if (npoints < 1) npoints = 1;
220 if (!GetNistMaterial(material) )
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;
228 if (particle ==
"") particle =
"proton";
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;
243 outfile.open(filename,std::ios_base::trunc);
244 data.rdbuf(outfile.rdbuf());
257 G4cout <<
"Issuing a G4RunManager::beamOn()... ";
258 G4cout <<
"Current Run State is " << mState -> GetStateString( aState ) <<
G4endl;
275 const std::vector<G4String>& vec = nistMat -> GetMaterialNames();
276 for (
size_t i=0; i<vec.size(); i++)
282 else if (vararg ==
"all" || vararg ==
"simple" || vararg ==
"compound" || vararg ==
"hep" )
284 nistMat -> ListMaterials(vararg);