18 #include "KVMaterial.h"
19 #include "KVNucleus.h"
21 #include "TGeoMaterial.h"
22 #include "TGeoMedium.h"
23 #include "TGeoManager.h"
24 #include "KVIonRangeTable.h"
26 #include <KVValueRange.h>
60 fPressure = 1. * KVUnits::atm;
64 fAbsorberVolume =
nullptr;
104 SetAreaDensity(area_density);
134 fPressure = pressure;
162 if (!fIonRangeTable) {
165 return fIonRangeTable;
189 if (fIonRangeTable)
delete fIonRangeTable;
192 ::Error(
"KVMaterial::ChangeRangeTable",
"No plugin %s defined for KVIonRangeTable", name);
193 return fIonRangeTable;
246 TString iso_name(mat_type);
251 "Called for material '%s' which is unknown in current range table %s. Energy loss & range calculations impossible.",
252 mat_type, fIonRangeTable->GetName());
256 if (iso_name.BeginsWith(
"nat")) iso_name.Remove(0, 3);
260 if (iso_mass)
SetMass(iso_mass);
270 KVMaterial::~KVMaterial()
335 return (fAmasr != 0);
644 if (!
IsGas())
return;
681 if (!
IsGas())
return 0.0;
709 if (!
IsGas())
return;
757 TVector3 n = norm.Unit();
758 TVector3 d = direction.Unit();
760 Double_t prod = TMath::Abs(n * d);
780 TVector3 n = norm.Unit();
781 TVector3 d = direction.Unit();
783 Double_t prod = TMath::Abs(n * d);
795 cout <<
"KVMaterial: " << GetName() <<
" (" <<
GetType() <<
")" << endl;
797 cout <<
" Pressure " <<
GetPressure() <<
" torr" << endl;
800 cout <<
"-----------------------------------------------" << endl;
801 cout <<
" Z = " <<
GetZ() <<
" atomic mass = " <<
GetMass() << endl;
802 cout <<
" Density = " <<
GetDensity() <<
" g/cm**3" << endl;
803 cout <<
"-----------------------------------------------" << endl;
839 thickness, fAmasr, fTemp, fPressure);
870 Double_t E_inc = fIonRangeTable->
872 thickness, fAmasr, fTemp, fPressure);
894 if (Z < 1)
return 0.;
898 return TMath::Max(E_loss, 0.);
931 if (Z < 1)
return 0.;
969 if (Z < 1)
return 0.;
1025 if (Z < 1)
return 0.;
1026 Double_t E_loss = fIonRangeTable->
1027 GetLinearDeltaEFromEResOfIon(
1179 if (Z < 1)
return 0.;
1239 if (Z < 1)
return 0.;
1284 cout <<
"detectparticle in material " <<
GetType() <<
" of thickness "
1289 Double_t Eres = kvp->
GetKE() - el;
1336 if (Z < 1)
return 0.;
1338 return fIonRangeTable->
1339 GetLinearEIncFromEResOfIon(
GetType(), Z, A, Eres,
GetThickness(), fAmasr, fTemp, fPressure);
1354 if (Z < 1)
return 0.;
1356 return fIonRangeTable->
1382 if (Z < 1)
return 0.;
1384 return fIonRangeTable->
1434 if (!gGeoManager)
return nullptr;
1436 if (strcmp(med_name,
"")) {
1437 TGeoMedium* gmed = gGeoManager->GetMedium(med_name);
1438 if (gmed)
return gmed;
1439 else if (!strcmp(med_name,
"Vacuum")) {
1441 TGeoMaterial* gmat =
new TGeoMaterial(
"Vacuum", 0, 0, 0);
1442 gmat->SetTitle(
"Vacuum");
1443 gmed =
new TGeoMedium(
"Vacuum", 0, gmat);
1444 gmed->SetTitle(
"Vacuum");
1459 else medName = GetName();
1461 TGeoMedium* gmed = gGeoManager->GetMedium(medName);
1463 if (gmed)
return gmed;
1465 TGeoMaterial* gmat = gGeoManager->GetMaterial(medName);
1472 gmat->SetTransparency(0);
1473 gmat->SetName(medName);
1474 gmat->SetTitle(GetName());
1478 static Int_t numed = 1;
1479 gmed =
new TGeoMedium(medName, numed, gmat);
1502 auto g =
new TGraph;
1504 for (
int i = 0; i < npts; ++i) {
Base class for KaliVeda framework.
virtual const Char_t * GetType() const
void Copy(TObject &) const override
Make a copy of this object.
virtual void SetType(const Char_t *str)
Simple wrapper for objects which can be drawn (graphs, histograms)
Abstract base class for calculation of range & energy loss of charged particles in matter.
virtual Bool_t IsMaterialGas(const Char_t *)
Return kTRUE if material is gaseous.
virtual Double_t GetLinearEIncFromDeltaEOfIon(const Char_t *mat, Int_t Z, Int_t A, Double_t DeltaE, Double_t e, enum SolType type=kEmax, Double_t isoAmat=0., Double_t T=-1., Double_t P=-1.)
const Char_t * GetMaterialName(const Char_t *)
Return name of material of given type or name if it is in range tables.
virtual Double_t GetAtomicMass(const Char_t *)
Returns atomic mass of a material in the range tables.
const Char_t * GetMaterialType(const Char_t *)
Return type of material of given type or name if it is in range tables.
virtual Double_t GetRangeOfIon(const Char_t *mat, Int_t Z, Int_t A, Double_t E, Double_t Amat=0., Double_t T=-1., Double_t P=-1.)
static KVIonRangeTable * GetRangeTable(const Char_t *name)
Generates an instance of the KVIonRangeTable plugin class corresponding to given name.
virtual TGeoMaterial * GetTGeoMaterial(const Char_t *material)
Create and return pointer to TGeoMaterial/Mixture corresponding to material.
virtual Double_t GetZ(const Char_t *)
Returns atomic number of a material in the range tables.
virtual Double_t GetLinearEResOfIon(const Char_t *mat, Int_t Z, Int_t A, Double_t E, Double_t d, Double_t Amat=0., Double_t T=-1., Double_t P=-1.)
virtual void SetDensity(const Char_t *, Double_t)
Changes the density (g/cm**3) of a material in the range tables.
virtual Double_t GetEmaxValid(const Char_t *material, Int_t Z, Int_t A)
virtual Double_t GetLinearPunchThroughEnergy(const Char_t *mat, Int_t Z, Int_t A, Double_t e, Double_t isoAmat=0., Double_t T=-1., Double_t P=-1.)
virtual Bool_t IsMaterialKnown(const Char_t *)
Return kTRUE if material is in range tables.
virtual Double_t GetLinearDeltaEOfIon(const Char_t *mat, Int_t Z, Int_t A, Double_t E, Double_t d, Double_t Amat=0., Double_t T=-1., Double_t P=-1.)
virtual void SetTemperatureAndPressure(const Char_t *, Double_t temperature, Double_t pressure)
virtual Double_t GetDensity(const Char_t *)
Returns density (g/cm**3) of a material in the range tables.
virtual Double_t GetLinearRangeOfIon(const Char_t *mat, Int_t Z, Int_t A, Double_t E, Double_t Amat=0., Double_t T=-1., Double_t P=-1.)
Description of physical materials used to construct detectors & targets; interface to range tables.
virtual Double_t GetPressure() const
virtual void SetPressure(Double_t)
virtual void SetTemperature(Double_t)
virtual void SetThickness(Double_t thick)
virtual Double_t GetThickness() const
Double_t GetEffectiveAreaDensity(const TVector3 &norm, const TVector3 &direction)
Double_t GetDensity() const
virtual TGeoMedium * GetGeoMedium(const Char_t *="")
static KVIonRangeTable * GetRangeTable()
virtual Double_t GetEnergyLoss() const
Double_t GetEmaxValid(Int_t Z, Int_t A)
virtual Double_t GetIncidentEnergy(Int_t Z, Int_t A, Double_t delta_e=-1.0, enum SolType type=kEmax)
virtual Double_t GetEIncOfMaxDeltaE(Int_t Z, Int_t A)
void Clear(Option_t *opt="") override
Reset absorber - set stored energy lost by particles in absorber to zero.
virtual Double_t GetPunchThroughEnergy(Int_t Z, Int_t A)
virtual Double_t GetEResFromDeltaE(Int_t Z, Int_t A, Double_t dE=-1.0, enum SolType type=kEmax)
virtual KVDrawable< TGraph > GetGraphOfDeltaEVsE(const KVNucleus &nuc, Int_t npts, Double_t Emin, Double_t Emax)
virtual Double_t GetMaxDeltaE(Int_t Z, Int_t A)
static KVIonRangeTable * ChangeRangeTable(const Char_t *name)
void SetAreaDensity(Double_t dens)
Double_t GetAreaDensity() const
virtual Double_t GetParticleEIncFromERes(KVNucleus *, TVector3 *norm=nullptr)
virtual void DetectParticle(KVNucleus *, TVector3 *norm=nullptr)
virtual Double_t GetTemperature() const
virtual Double_t GetIncidentEnergyFromERes(Int_t Z, Int_t A, Double_t Eres)
virtual void SetMaterial(const Char_t *type)
virtual Double_t GetDeltaEFromERes(Int_t Z, Int_t A, Double_t Eres)
void SetDensity(Double_t)
virtual Double_t GetELostByParticle(KVNucleus *, TVector3 *norm=nullptr)
Double_t GetEffectiveThickness(const TVector3 &norm, const TVector3 &direction)
virtual Double_t GetERes(Int_t Z, Int_t A, Double_t Einc, Double_t dx=0.)
virtual Double_t GetRange(Int_t Z, Int_t A, Double_t Einc)
Bool_t IsIsotopic() const
void Copy(TObject &obj) const override
Make a copy of this material object.
void Print(Option_t *option="") const override
Show information on this material.
virtual Double_t GetDeltaE(Int_t Z, Int_t A, Double_t Einc, Double_t dx=0.)
virtual Double_t GetLinearRange(Int_t Z, Int_t A, Double_t Einc)
virtual KVMaterial * GetActiveLayer() const
Description of properties and kinematics of atomic nuclei.
const Char_t * GetSymbol(Option_t *opt="") const
static Int_t IsMassGiven(const Char_t *)
Int_t GetZ() const
Return the number of proton / atomic number.
TVector3 * GetPInitial() const
TVector3 GetMomentum() const
void SetKE(Double_t ecin)
void SetE0(TVector3 *e=0)
Range of values specified by minimum, maximum.
ValueType ValueIofN(Int_t i, Int_t n) const
void Warning(UserClass p, const char *location, const char *va_(fmt),...)