Skip to content
Snippets Groups Projects
Commit cbffb4aa authored by Ralf Kliemt's avatar Ralf Kliemt Committed by Florian Uhlig
Browse files

Add liquid hydrogen target

parent 453bcbf8
Branches
Tags
1 merge request!1869Add liquid hydrogen target
Pipeline #31680 passed
......@@ -128,7 +128,9 @@ void CbmTarget::ConstructGeometry()
}
else if (!fMaterial.IsNull()) {
targElem = geoMan->GetElementTable()->FindElement(fMaterial.Data());
if (!targElem) { LOG(fatal) << GetName() << ": Unknown element " << fMaterial; }
if (!targElem) {
LOG(fatal) << GetName() << ": Unknown element " << fMaterial;
}
fZ = targElem->Z();
}
else {
......@@ -144,6 +146,7 @@ void CbmTarget::ConstructGeometry()
<< " available: density must be set explicitly.";
return;
}
LOG(info) << GetName() << ": Density " << fDensity;
// --- Create target medium
TGeoMaterial* targMat = new TGeoMaterial("targetMaterial", targElem, fDensity);
......@@ -202,6 +205,7 @@ Double_t CbmTarget::GetStandardDensity(Int_t charge) const
// TODO: Better implementation with array or the like
switch (charge) {
case 1: return 0.07085; break; // Liquid Hydrogen (20˚K at 1 atm)
case 4: return 1.848; break; // Beryllium
case 6: return 2.260; break; // Carbon
case 28: return 8.908; break; // Nickel
......@@ -249,11 +253,13 @@ std::string CbmTarget::ToString() const
std::stringstream ss;
if (fBuildFromFile) ss << GetName() << ": Geometry file " << fgeoName;
if (fBuildFromFile)
ss << GetName() << ": Geometry file " << fgeoName;
else {
ss << GetName() << ": Material " << fMaterial;
if (fDensity >= 0.) ss << ", density " << fDensity << " g/cm^3, ";
if (fDensity >= 0.)
ss << ", density " << fDensity << " g/cm^3, ";
else
ss << ", standard density, ";
ss << "thickness " << fThickness * 10000. << " mum, diameter " << fDiameter << " cm, position (" << fPosX << ", "
......
......@@ -774,10 +774,14 @@ void CbmTransport::SetOutFileName(TString fileName, Bool_t overwrite)
// ----- Define the target ----------------------------------------------
void CbmTransport::SetTarget(const char* medium, Double_t thickness, Double_t diameter, Double_t x, Double_t y,
Double_t z, Double_t angle)
Double_t z, Double_t angle, Double_t density)
{
if (density >= 0.) {
fTarget.reset(new CbmTarget(medium, thickness, diameter, density));
}
else {
fTarget.reset(new CbmTarget(medium, thickness, diameter));
}
fTarget->SetPosition(x, y, z);
fTarget->SetRotation(angle);
}
......
......@@ -277,13 +277,14 @@ public:
** @param y y position of target centre in global c.s. [cm]
** @param z z position of target centre in global c.s. [cm]
** @param rot Rotation angle around y axis in global c.s. [deg]
** @param density target material density [g/cm^3], -1 to attempt using a default
**
** The target is a disk with the z axis as symmetry axis.
** By default, it is centred at the origin. It can be rotated around
** the y axis.
**/
void SetTarget(const char* medium, Double_t thickness, Double_t diameter, Double_t x = 0., Double_t y = 0.,
Double_t z = 0., Double_t rot = 0.);
void SetTarget(const char* medium = "Gold", Double_t thickness = 0.025, Double_t diameter = 2.5, Double_t x = 0.,
Double_t y = 0., Double_t z = -44.0, Double_t rot = 0., Double_t density = -1);
/** @brief Set the output file name
......
......@@ -34,6 +34,7 @@ CbmTransportConfig::TagSet_t CbmTransportConfig::GetValidationTags()
"target.position.y",
"target.position.z",
"target.rotation.y",
"target.density",
"beam.position.x",
"beam.position.y",
"beam.position.zFocus",
......@@ -174,8 +175,12 @@ bool CbmTransportConfig::SetTarget(CbmTransport& obj, const pt::ptree& moduleTre
auto y = moduleTree.get_optional<float>("target.position.y");
auto z = moduleTree.get_optional<float>("target.position.z");
auto rotY = moduleTree.get_optional<float>("target.rotation.y");
auto density = moduleTree.get_optional<float>("target.density");
// one can set a target only if all 3 parameters are present in config file
if (material && thickness && diameter) {
if (x && y && z && rotY && density && density.get() >= 0.)
obj.SetTarget(material.get().c_str(), thickness.get(), diameter.get(), x.get(), y.get(), z.get(), rotY.get(),
density.get());
if (x && y && z && rotY)
obj.SetTarget(material.get().c_str(), thickness.get(), diameter.get(), x.get(), y.get(), z.get(), rotY.get());
else if (x && y && z)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment