17#include <FairRunAna.h>
18#include <FairRuntimeDb.h>
21#include <TGeoManager.h>
42 auto* runtimeDb = FairRunAna::Instance()->GetRuntimeDb();
44 throw std::runtime_error(
"the runtime database is not defined");
48catch (
const std::exception& err) {
49 LOG(fatal) <<
"trd::RecoSetupUnitFactory cannot be constructed, because " << err.what() <<
". Please ensure, if the "
50 <<
"required parameters are defined before the point of the sts::RecoSetupUnitFactory object construction";
59 LOG(fatal) <<
"trd::RecoSetupUnitFactory: creation of a valid TRD reco-setup unit failed";
71 auto& nModulesPerLayer = res.second;
73 std::unordered_map<int, uint32_t> nModulesInLayer;
74 for (
int iModule = 0; iModule <
fTrdDigiPar->GetNrOfModules(); ++iModule) {
77 nModulesPerLayer = nModulesInLayer.begin()->second;
78 if (std::any_of(nModulesInLayer.begin(), nModulesInLayer.end(),
79 [nModulesPerLayer](
const auto& entry) ->
bool { return entry.second != nModulesPerLayer; })) {
80 LOG(fatal) <<
"trd::RecoSetupUnitFactory: TRD layers have different number of modules (assumption failure)";
85 auto& modules = res.first;
88 for (
int iModule = 0; iModule <
fTrdDigiPar->GetNrOfModules(); ++iModule) {
89 uint32_t address =
fTrdDigiPar->GetModuleId(iModule);
93 modules[layerId * nModulesPerLayer + moduleId] =
97 LOG(fatal) <<
"trd::RecoSetupUnitFactory: undefined digi parameters for module 0x" << std::hex << address;
109 std::vector<GeoVolume> fullVolumes(vLayerPaths.size());
110 std::vector<GeoVolume> activeVolumes(vLayerPaths.size());
111 std::regex stationPattern{
"layer(\\d+)_(\\d+)"};
112 for (
const auto& layerPath : vLayerPaths) {
114 std::string line{layerPath.Data()};
115 if (std::regex_search(line, match, stationPattern)) {
116 int iStation{std::stoi(match[1]) - 1};
118 gGeoManager->cd(layerPath);
120 gGeoManager->GetCurrentNode())};
121 for (
const auto& gasPath : vGasPaths) {
126 return {std::move(fullVolumes), std::move(activeVolumes)};
A multi-purpose class to access the geometrical information stored in a TGeoManager (source)
Different utilities for the CbmOfflineRecoSetup library (source)
A factory for the TOF RecoSetupUnit.
static uint32_t GetModuleId(uint32_t address)
Return module ID from address.
static uint32_t GetLayerId(uint32_t address)
Return layer ID from address.
Definition of chamber gain conversion for one TRD module.
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 STS RecoSetupUnit.
std::pair< std::vector< algo::GeoVolume >, std::vector< algo::GeoVolume > > CreateStationVolumes() const
Creates full and active volumes of the tracking stations.
ModuleInfoMap_t CreateModuleMap() const
Creates TRD module type map.
CbmTrdParSetDigi * fTrdDigiPar
TRD digitization parameters.
RecoSetupUnit_t Create() const
Creates a reconstruction setup unit.
typename RecoSetupUnit_t::ModuleInfoMap_t ModuleInfoMap_t
static algo::GeoVolume ReadVolume(const TString &path)
Creates a volume info from a geo node, provided by path.
Different characteristics of TRD module.