CbmRoot
Loading...
Searching...
No Matches
CbmFsdGeoHandler.h
Go to the documentation of this file.
1/* Copyright (C) 2023 Physikalisches Institut, Eberhard Karls Universitaet Tuebingen, Tuebingen
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Lukas Chlad [committer] */
4
5#ifndef CBMFSDGEOHANDLER_H
6#define CBMFSDGEOHANDLER_H
7
8#include <RtypesCore.h> // for Int_t, Bool_t
9#include <TString.h> // for TString
10
11#include <iostream> // for string
12#include <map> // for map
13#include <vector> // for vector
14
16struct CbmFsdUnitSpecs;
17class TVirtualMC;
18class TGeoManager;
19
21
22private:
25
27 ~CbmFsdGeoHandler() = default;
28
32 Int_t GetCopyNumberByKey(TString geoPath, TString key) const;
33
34public:
37
42 {
43 static CbmFsdGeoHandler fInstance;
44 return fInstance;
45 }
46
47 /*
48 * \brief Return CbmFsdModuleSpecs by digi moduleId.
49 */
51
52 /*
53 * \brief Return CbmFsdUnitSpecs by digi unitId.
54 */
56
57 /*
58 * \brief Initialize maps.
59 */
60 void InitMaps();
61
65 int32_t GetAddress(TString geoPath) const;
66
70 int32_t GetCurrentAddress(TVirtualMC* vmc) const;
71
75 int32_t GetCurrentAddress(TGeoManager* geoMan) const;
76
77private:
78 std::map<Int_t, CbmFsdModuleSpecs*> fModuleIdToSpecsMap;
79 std::map<Int_t, CbmFsdUnitSpecs*> fUnitIdToSpecsMap;
80
81 // these key TStrings must corresponds to what one introduce in create geo macros!!
82 const TString fBranchStr = "fsd_";
83 const TString fUnitStr = "unit";
84 const TString fModuleStr = "module";
85 const TString fActiveMatStr = "scint";
86};
87
88#endif /* CBMFSDGEOHANDLER_H */
static CbmFsdGeoHandler & GetInstance()
Int_t GetCopyNumberByKey(TString geoPath, TString key) const
Helper function to extract copy number from geoPath using key word.
const TString fUnitStr
CbmFsdGeoHandler(const CbmFsdGeoHandler &)=delete
CbmFsdGeoHandler & operator=(const CbmFsdGeoHandler &)=delete
std::map< Int_t, CbmFsdModuleSpecs * > fModuleIdToSpecsMap
std::map< Int_t, CbmFsdUnitSpecs * > fUnitIdToSpecsMap
const TString fActiveMatStr
CbmFsdUnitSpecs * GetUnitSpecsById(Int_t id)
int32_t GetAddress(TString geoPath) const
Get the unique address from geometry path string.
~CbmFsdGeoHandler()=default
const TString fBranchStr
CbmFsdModuleSpecs * GetModuleSpecsById(Int_t id)
int32_t GetCurrentAddress(TVirtualMC *vmc) const
Get the unique address from TVirtualMC.
const TString fModuleStr