4 #include "KVRangeYanez.h"
5 #include "KVRangeYanezMaterial.h"
6 #include "KVElementDensity.h"
7 #include "KVElementDensityTable.h"
8 #include "KVNDTManager.h"
10 #include "KVNucleus.h"
11 #include "KVNumberList.h"
12 #include <KVSystemDirectory.h>
13 #include <KVSystemFile.h>
43 "Interface to Range dE/dx and range library (Ricardo Yanez)")
64 DataFilePaths.
Begin(
" ");
67 while (!DataFilePaths.
End()) {
68 nextPath = DataFilePaths.
Next();
69 if (nextPath == lastPath)
break;
145 printf(
"\nEnergy loss & range tables loaded for 0 materials.\n");
223 Error(
"AddElementalMaterial",
224 "Nuclear data tables have not been initialised");
229 Error(
"AddElementalMaterial",
230 "No element found in ElementDensity NDT-table with Z=%d", z);
234 if (ed->
IsGas()) state =
"gas";
265 const std::vector<CompoundFormulaElement>& elements,
Double_t density)
const
283 if (density > 0) state =
"solid";
286 for (
auto& el : elements) {
313 const std::vector<MixtureFormulaElement>& elements,
Double_t density)
const
329 if (density > 0) state =
"solid";
332 for (
auto& el : elements) {
366 Error(
"MakeNaturallyOccuringElementMixture",
367 "Nuclear data tables have not been initialised");
372 Error(
"AddElementalMaterial",
373 "No element found in ElementDensity NDT-table with Z=%d", z);
380 while (!isotopes.
End()) {
389 if (ed->
IsGas()) state =
"gas";
396 while (!isotopes.
End()) {
418 Error(
"ReadPredefinedMaterials",
"Cannot open %s for reading", DataFilePath.
Data());
421 Info(
"ReadPredefinedMaterials",
"Reading materials in file : %s",
filename);
429 while (filestream.good()) {
430 line.ReadLine(filestream);
431 if (filestream.good()) {
432 if (
line.BeginsWith(
"//"))
continue;
433 if (
line.BeginsWith(
"COMPOUND")) {
437 else if (
line.BeginsWith(
"MIXTURE")) {
441 else if (
line.BeginsWith(
"ELEMENT")) {
449 std::vector<CompoundFormulaElement> compound_elements;
450 std::vector<MixtureFormulaElement> mixture_elements;
452 line.ReadLine(filestream);
453 while (filestream.good() && !
line.IsWhitespace() &&
line !=
"\n") {
456 if (next ==
"name")
name =
line.Next();
457 else if (next ==
"symbol") symbol =
line.Next();
458 else if (next ==
"state") state =
line.Next();
459 else if (next ==
"density") density =
line.Next().Atof();
460 else if (next ==
"nelem") {
461 nelem =
line.Next().Atoi();
462 for (
int i = 0; i < nelem; i++) {
463 line.ReadLine(filestream);
465 element =
line.Next();
470 auto natoms =
line.Next().Atoi();
472 auto proportion =
line.Next().Atof();
473 mixture_elements.push_back({z,
a, natoms, proportion});
476 compound_elements.push_back({z,
a, natoms});
489 line.ReadLine(filestream);
490 while (filestream.good() && !
line.IsWhitespace() &&
line !=
"\n") {
493 if (next ==
"name")
name =
line.Next();
494 else if (next ==
"symbol") symbol =
line.Next();
495 else if (next ==
"state") state =
line.Next();
532 matfilename +=
".dat";
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
virtual const Char_t * GetType() const
void Error(const char *method, const char *msgfmt,...) const override
static const Char_t * GetWORKDIRFilePath(const Char_t *namefile="")
void Copy(TObject &) const override
Make a copy of this object.
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
Atomic element with name, symbol and density.
const Char_t * GetElementName() const
const Char_t * GetElementSymbol() const
Extended version of ROOT THashList.
Material for use in energy loss & range calculations.
void AddCompoundElement(Int_t Z, Int_t A, Int_t Natoms)
void AddMixtureElement(Int_t Z, Int_t A, Int_t Natoms, Double_t Proportion)
virtual void Initialize()
Abstract base class for calculation of range & energy loss of charged particles in matter.
KVNuclData * GetData(Int_t zz, Int_t aa, const Char_t *name) const
Double_t GetValue() const
Description of properties and kinematics of atomic nuclei.
static Int_t IsMassGiven(const Char_t *)
KVNumberList GetKnownARange(Int_t z=-1, Double_t tmin=0) const
Double_t GetAbundance(Int_t z=-1, Int_t a=-1) const
Int_t GetZ() const
Return the number of proton / atomic number.
Strings used to represent a set of ranges of values.
Description of absorber for the Range dE/dx and range library.
void Initialize() override
Interface to Range dE/dx and range library.
void Copy(TObject &) const override
Bool_t fDoNotSaveMaterials
TString fLocalMaterialsDirectory
static KVHashList * fMaterials
static list of all currently defined materials
Bool_t ReadMaterials(const Char_t *filename) const override
Read materials from file whose name is given.
void SaveMaterial(KVIonRangeTableMaterial *mat) const
void Print(Option_t *="") const override
KVIonRangeTableMaterial * GetMaterialWithNameOrType(const Char_t *material) const override
TObjArray * GetListOfMaterials() override
KVIonRangeTableMaterial * AddElementalMaterial(Int_t z, Int_t a=0) const override
virtual KVIonRangeTableMaterial * AddMixedMaterial(const Char_t *name, const Char_t *symbol, const std::vector< MixtureFormulaElement > &elements, Double_t density=-1.0) const override
virtual KVIonRangeTableMaterial * AddCompoundMaterial(const Char_t *name, const Char_t *symbol, const std::vector< CompoundFormulaElement > &elements, Double_t density=-1.0) const override
KVIonRangeTableMaterial * MakeNaturallyOccuringElementMixture(Int_t z, Int_t &a) const
void CheckMaterialsList() const
void Add(TObject *obj) override
TObject * FindObject(const char *name) const override
void SetOwner(Bool_t enable=kTRUE) override
virtual TObject * FindObjectByType(const Char_t *) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Extension of ROOT TSystemDirectory class, handling browsing directories on disk.
TList * GetListOfFiles() const override
Extended ROOT TSystemFile with added info on file size etc.
const Char_t * GetFullPath() const
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
void SetName(const char *name)
virtual Int_t GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
virtual const char * GetValue(const char *name, const char *dflt) const
const char * GetName() const override
const char * GetTitle() const override
void Add(TObject *obj) override
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
TString & ReplaceAll(const char *s1, const char *s2)
virtual int Chmod(const char *file, UInt_t mode)
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)