BmnRoot
Loading...
Searching...
No Matches
CbmStsSetup.cxx
Go to the documentation of this file.
1
7#include "TGeoManager.h"
8#include "TGeoPhysicalNode.h"
9#include "setup/CbmStsSetup.h"
10
11
12// ----- Initialisation of static singleton pointer ----------------------
13CbmStsSetup* CbmStsSetup::fgInstance = NULL;
14// ---------------------------------------------------------------------------
15
16
17
18// ----- Level names -----------------------------------------------------
19const TString CbmStsSetup::fgkLevelName[] = { "sts",
20 "station",
21 "ladder",
22 "halfladder",
23 "module",
24 "sensor",
25 "side",
26 "channel" };
27// ---------------------------------------------------------------------------
28
29
30
31// ----- Constructor -----------------------------------------------------
33 "system",
35{
36}
37// ---------------------------------------------------------------------------
38
39
40
41// ----- Intialisation from TGeoManager ----------------------------------
42Bool_t CbmStsSetup::Init(TGeoManager* geo) {
43
44 // --- Catch non-existence of GeoManager
45 if ( ! geo ) {
46 LOG(fatal) << "fName: no TGeoManager!";
47 return kFALSE;
48 }
49
50 // --- Get cave (top node)
51 LOG(info) << fName << ": " << " Reading geometry from TGeoManager "
52 << geo->GetName();
53 geo->CdTop();
54 TGeoNode* cave = geo->GetCurrentNode();
55 LOG(info) << "Top node: " << cave->GetName();
56
57 // --- Get top STS node
58 TGeoNode* sts = NULL;
59 for (Int_t iNode = 0; iNode < cave->GetNdaughters(); iNode++) {
60 TString name = cave->GetDaughter(iNode)->GetName();
61 if ( name.Contains("STS", TString::kIgnoreCase) ) {
62 sts = cave->GetDaughter(iNode);
63 geo->CdDown(iNode);
64 LOG(info) << fName << ": found STS node " << sts->GetName();
65 break;
66 }
67 }
68 if ( ! sts ) {
69 LOG(error) << fName << ": No top STS node found in geometry!";
70 return kFALSE;
71 }
72
73 // --- Create physical node for sts
74 TString path = cave->GetName();
75 path = path + "/" + sts->GetName();
76 LOG(info) << "Path to STS is " << path;
77 fNode = new TGeoPhysicalNode(path);
78 LOG(info) << "PN name " << fNode->GetName();
79
80 // --- Initialise daughter elements
82
83
84 return kTRUE;
85}
86// ---------------------------------------------------------------------------
87
88
89// ----- Instance --------------------------------------------------------
91 if ( ! fgInstance ) fgInstance = new CbmStsSetup();
92 return fgInstance;
93}
94// ---------------------------------------------------------------------------
@ kStsSystem
System = STS.
Class representing an element of the STS setup.
TGeoPhysicalNode * fNode
Pointer to geometry.
Class representing the top level of the STS setup.
Definition CbmStsSetup.h:25
Bool_t Init(TGeoManager *geo)
static CbmStsSetup * Instance()