Commit ee94af22 authored by Oleg Golosov's avatar Oleg Golosov
Browse files

fix: install CbmConfigBase.h, small change in geometry setting

parent 57525b13
......@@ -34,3 +34,7 @@ set(CBMDETECTORBASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/detectors PARENT_SCOPE)
If(GTEST_FOUND)
add_subdirectory(data/test)
EndIf()
Install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/config/CbmConfigBase.h
DESTINATION include
)
......@@ -37,7 +37,7 @@ public:
SetLogLevel(tree);
auto moduleTree {tree.get_child_optional(Config_t::GetModuleTag())};
if (!moduleTree) {
LOG(error) << "CbmConfig: module tag is not correct!\n";
LOG(error) << "CbmConfig: module tag not found:" << Config_t::GetModuleTag();
return false;
}
if (!Validate(moduleTree.get())) return false;
......
......@@ -72,6 +72,11 @@
"psd": "v20a",
"platform": "v13a"
}
},
"stackFilter": {
"storeAllPrimaries": true,
"storeAllMothers": true,
"storeAllDecays": true
}
},
......
......@@ -64,7 +64,10 @@ CbmTransportConfig::TagSet_t CbmTransportConfig::GetValidationTags()
"geometry.subsystems.psd",
"geometry.subsystems.hodo",
"geometry.subsystems.shield",
"geometry.subsystems.platform"};
"geometry.subsystems.platform",
"stackFilter.storeAllPrimaries",
"stackFilter.storeAllMothers",
"stackFilter.storeAllDecays"};
}
CbmTransportConfig::TagSet_t CbmTransportConfig::GetAcceptedGenerators() { return {"unigen", "pluto", "beam"}; }
......@@ -259,6 +262,11 @@ bool CbmTransportConfig::SetTransportParameters(CbmTransport& obj, const pt::ptr
}
bool CbmTransportConfig::SetGeometry(CbmTransport& obj, const pt::ptree& moduleTree)
{
return SetGeometry(obj.GetSetup(), moduleTree);
};
bool CbmTransportConfig::SetGeometry(CbmSetup* setup, const pt::ptree& moduleTree)
{
auto geometry = moduleTree.get_child_optional("geometry");
if (!geometry) {
......@@ -267,9 +275,8 @@ bool CbmTransportConfig::SetGeometry(CbmTransport& obj, const pt::ptree& moduleT
}
auto geometryTree = geometry.get();
auto baseSetup = geometryTree.get_optional<string>("baseSetup");
if (baseSetup) obj.LoadSetup(baseSetup.get().c_str());
if (baseSetup) setup->LoadSetup(baseSetup.get().c_str());
auto setup = obj.GetSetup();
auto fieldTag = geometryTree.get_optional<string>("magneticField.tag");
auto fieldScale = geometryTree.get_optional<float>("magneticField.scale");
auto fieldX = geometryTree.get_optional<float>("magneticField.position.x");
......@@ -297,10 +304,25 @@ bool CbmTransportConfig::SetGeometry(CbmTransport& obj, const pt::ptree& moduleT
return true;
}
bool CbmTransportConfig::SetStackFilter(CbmTransport& obj, const pt::ptree& moduleTree)
{
auto stackFilterSettings = moduleTree.get_child_optional("stackFilter");
if (!stackFilterSettings) return true;
auto settingsTree = stackFilterSettings.get();
auto& filter = obj.GetStackFilter();
auto storeAllPrimaries = settingsTree.get_optional<bool>("storeAllPrimaries");
auto storeAllMothers = settingsTree.get_optional<bool>("storeAllMothers");
auto storeAllDecays = settingsTree.get_optional<bool>("storeAllDecays");
if (storeAllPrimaries) filter->SetStoreAllPrimaries(storeAllPrimaries.get());
if (storeAllMothers) filter->SetStoreAllPrimaries(storeAllMothers.get());
if (storeAllDecays) filter->SetStoreAllPrimaries(storeAllDecays.get());
return true;
}
bool CbmTransportConfig::LoadImpl(CbmTransport& obj, const pt::ptree& moduleTree)
{
return SetIO(obj, moduleTree) && SetTarget(obj, moduleTree) && SetBeamProfile(obj, moduleTree)
&& SetTransportParameters(obj, moduleTree) && SetGeometry(obj, moduleTree);
&& SetTransportParameters(obj, moduleTree) && SetGeometry(obj, moduleTree) && SetStackFilter(obj, moduleTree);
}
ClassImp(CbmTransportConfig)
......@@ -3,6 +3,7 @@
#include "CbmConfigBase.h"
class CbmTransport;
class CbmSetup;
class CbmTransportConfig : public CbmConfigBase<CbmTransportConfig, CbmTransport> {
......@@ -18,6 +19,8 @@ public:
static bool SetBeamProfile(CbmTransport& obj, const pt::ptree& moduleTree);
static bool SetTransportParameters(CbmTransport& obj, const pt::ptree& moduleTree);
static bool SetGeometry(CbmTransport& obj, const pt::ptree& moduleTree);
static bool SetGeometry(CbmSetup* setup, const pt::ptree& moduleTree);
static bool SetStackFilter(CbmTransport& obj, const pt::ptree& moduleTree);
ClassDef(CbmTransportConfig, 1);
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment