23#include <TGeoManager.h>
39 throw std::runtime_error(
"MuCh is not in the setup, but the much::RecoSetupUnitFactory was called (this should "
46 TString parFile = gSystem->Getenv(
"VMCWORKDIR");
47 if (parFile.IsNull()) {
48 throw std::runtime_error(
"The VMCWORKDIR env. variable is required but not defined. Please, configure CbmRoot");
50 parFile +=
"/parameters/much/much_" + geoTag(0, 4) +
"_digi_sector.root";
54catch (
const std::exception& err) {
56 <<
"much::RecoSetupUnitFactory cannot be constructed, because " << err.what() <<
". Please ensure, if the "
57 <<
"required parameters are defined before the point of the much::RecoSetupUnitFactory object construction";
66 LOG(error) << res.TableOfTrackingStations();
67 LOG(fatal) <<
"much::RecoSetupUnitFactory: creation of a valid MuCh reco-setup unit failed";
78 res.reserve(pGeoScheme->GetNStations() + 1);
80 for (
int iMuchSt = 0; iMuchSt < pGeoScheme->GetNStations(); ++iMuchSt) {
81 res.push_back(res.back() + pGeoScheme->GetStation(iMuchSt)->GetNLayers());
93 for (
int iMuchSt = 0; iMuchSt < pGeoScheme->GetNStations(); ++iMuchSt) {
94 nStations += pGeoScheme->GetStation(iMuchSt)->GetNLayers();
97 std::vector<GeoVolume> fullVolumes(nStations);
98 std::vector<GeoVolume> activeVolumes(nStations);
99 std::regex rgxLayerPattern{
"muchstation(\\d+)layer(\\d+)_(\\d+)"};
102 assert(
static_cast<int>(vLayerPaths.size()) == nStations);
103 for (
int iTrkSt = 0; iTrkSt < nStations; ++iTrkSt) {
104 const auto& layerPath = vLayerPaths[iTrkSt];
106 gGeoManager->cd(layerPath);
108 gGeoManager->GetCurrentNode())};
109 if (vActPaths.empty()) {
110 throw std::runtime_error(
"Could not find nodes containing \"active\" in their paths");
112 for (
const auto& activePath : vActPaths) {
117 return {std::move(fullVolumes), std::move(activeVolumes)};
@ kMuch
Muon detection system.
A multi-purpose class to access the geometrical information stored in a TGeoManager (source)
A factory for the MuCh RecoSetupUnit.
Different utilities for the CbmOfflineRecoSetup library (source)
static CbmMuchGeoScheme * Instance()
void Init(TObjArray *stations, Int_t flag)
Bool_t GetGeoTag(ECbmModuleId moduleId, TString &tag)
static CbmSetup * Instance()
RecoSetupUnitFactory()
Default constructor (check for parameter containers)
static std::vector< TString > CollectNodes(const TString &detector, const std::regex &component, const TString &path, TGeoNode *pNode)
Collects paths of the components.
A representation of a geometrical volume of different tracking stations.
A factory class for the MuCh RecoSetupUnit.
std::pair< std::vector< algo::GeoVolume >, std::vector< algo::GeoVolume > > CreateStationVolumes() const
Creates full and active volumes of the tracking stations.
OffsetContainer_t CreateStationIdOffsets() const
Creates tracking station offset container.
RecoSetupUnit_t Create() const
Creates a reconstruction setup unit.
typename RecoSetupUnit_t::OffsetContainer_t OffsetContainer_t
static algo::GeoVolume ReadVolume(const TString &path)
Creates a volume info from a geo node, provided by path.