BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
CbmStsSetup.cxx
Go to the documentation of this file.
1/** @file CbmStsSetup.cxx
2 ** @author Volker Friese <v.friese@gsi.de>
3 ** @date 27.05.2013
4 **/
5
6#include "setup/CbmStsSetup.h"
7
8#include "TGeoManager.h"
9#include "TGeoPhysicalNode.h"
10
11// ----- Initialisation of static singleton pointer ----------------------
13// ---------------------------------------------------------------------------
14
15// ----- Level names -----------------------------------------------------
16const TString CbmStsSetup::fgkLevelName[] = {"sts", "station", "ladder", "halfladder",
17 "module", "sensor", "side", "channel"};
18// ---------------------------------------------------------------------------
19
20// ----- Constructor -----------------------------------------------------
22 : CbmStsElement("STS Setup", "system", kStsSystem)
23{}
24// ---------------------------------------------------------------------------
25
26// ----- Intialisation from TGeoManager ----------------------------------
28{
29
30 // --- Catch non-existence of GeoManager
31 if (!geo) {
32 LOG(fatal) << "fName: no TGeoManager!";
33 return kFALSE;
34 }
35
36 // --- Get cave (top node)
37 LOG(info) << fName << ": " << " Reading geometry from TGeoManager " << geo->GetName();
38 geo->CdTop();
39 TGeoNode* cave = geo->GetCurrentNode();
40 LOG(info) << "Top node: " << cave->GetName();
41
42 // --- Get top STS node
43 TGeoNode* sts = NULL;
44 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
45 TString name = cave->GetDaughter(iNode)->GetName();
46 if (name.Contains("STS", TString::kIgnoreCase)) {
47 sts = cave->GetDaughter(iNode);
48 geo->CdDown(iNode);
49 LOG(info) << fName << ": found STS node " << sts->GetName();
50 break;
51 }
52 }
53 if (!sts) {
54 LOG(error) << fName << ": No top STS node found in geometry!";
55 return kFALSE;
56 }
57
58 // --- Create physical node for sts
59 TString path = cave->GetName();
60 path = path + "/" + sts->GetName();
61 LOG(info) << "Path to STS is " << path;
62 fNode = new TGeoPhysicalNode(path);
63 LOG(info) << "PN name " << fNode->GetName();
64
65 // --- Initialise daughter elements
67
68 return kTRUE;
69}
70// ---------------------------------------------------------------------------
71
72// ----- Instance --------------------------------------------------------
79// ---------------------------------------------------------------------------
@ kStsSystem
System = STS.
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
TGeoPhysicalNode * fNode
Pointer to geometry.
CbmStsElement()
Default constructor.
void InitDaughters()
Initialise daughters from geometry.
Class representing the top level of the STS setup.
Definition CbmStsSetup.h:23
static CbmStsSetup * fgInstance
Definition CbmStsSetup.h:42
Bool_t Init(TGeoManager *geo)
static const TString fgkLevelName[kStsNofLevels]
Definition CbmStsSetup.h:16
static CbmStsSetup * Instance()
TGeoNode * GetCurrentNode() const
void CdTop()
void CdDown(Int_t index)
Int_t GetNdaughters() const
TGeoNode * GetDaughter(Int_t ind) const
const char * GetName() const override
TString fName
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const