CbmRoot
Loading...
Searching...
No Matches
CbmLitDetectorSetup.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2020 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer], Florian Uhlig */
4
10#include "CbmLitDetectorSetup.h"
11
12#include "TGeoManager.h"
13#include "TGeoNode.h"
14#include "TObjArray.h"
15//#include "CbmSetup.h"
16
17#include <cassert>
18#include <iostream>
19
20using std::cout;
21
22CbmLitDetectorSetup::CbmLitDetectorSetup() : fIsElectronSetup(false), fIsMuonSetup(false), fDet() {}
23
25
26void CbmLitDetectorSetup::SetDet(ECbmModuleId detId, bool isDet) { fDet[detId] = isDet; }
27
29{
30 assert(fDet.count(detId) != 0);
31 return fDet.find(detId)->second;
32}
33
34bool CbmLitDetectorSetup::CheckDetectorPresence(const std::string& name) const
35{
36 assert(gGeoManager != NULL);
37
38 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
39 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
40 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
41 if (TString(node->GetName()).Contains(name.c_str())) {
42 return true;
43 }
44 }
45
46 if (name == "mvd") {
47 TGeoNode* node1 = gGeoManager->GetTopVolume()->FindNode("pipevac1_0");
48 if (node1) {
49 if (node1->GetVolume()->FindNode("mvdstation01_0")) {
50 return true;
51 }
52 }
53 else {
54 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
55 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
56 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
57 TString nodeName = node->GetName();
58 nodeName.ToLower();
59 if (nodeName.Contains("pipe")) {
60 TObjArray* nodes2 = node->GetNodes();
61 for (Int_t iiNode = 0; iiNode < nodes2->GetEntriesFast(); iiNode++) {
62 TGeoNode* node2 = (TGeoNode*) nodes2->At(iiNode);
63 TString nodeName2 = node2->GetName();
64 nodeName2.ToLower();
65 if (nodeName2.Contains("pipevac1")) {
66 // check if there is a mvd in the pipevac
67 // if there are no nodes return immediately
68 TObjArray* nodes3 = node2->GetNodes();
69 if (!nodes3) return false;
70 for (Int_t iiiNode = 0; iiiNode < nodes3->GetEntriesFast(); iiiNode++) {
71 TGeoNode* node3 = (TGeoNode*) nodes3->At(iiiNode);
72 TString nodeName3 = node3->GetName();
73 nodeName3.ToLower();
74 if (nodeName3.Contains("mvd")) {
75 return true;
76 }
77 }
78 }
79 }
80 }
81 }
82 }
83 }
84
85 return false;
86}
87
89{
98 /*fIsElectronSetup = !CbmSetup::Instance()->IsActive(kMuch);
99 fIsMuonSetup = CbmSetup::Instance()->IsActive(kMuch);
100 fDet[ECbmModuleId::kMvd] = CbmSetup::Instance()->IsActive(kMvd);
101 fDet[ECbmModuleId::kSts] = CbmSetup::Instance()->IsActive(kSts);
102 fDet[ECbmModuleId::kRich] = CbmSetup::Instance()->IsActive(kRich);
103 fDet[ECbmModuleId::kTrd] = CbmSetup::Instance()->IsActive(kTrd);
104 fDet[ECbmModuleId::kMuch] = CbmSetup::Instance()->IsActive(kMuch);
105 fDet[ECbmModuleId::kTof] = CbmSetup::Instance()->IsActive(kTof);*/
106}
107
109{
110 string str = "LitDetectorSetup: ";
111 if (fIsMuonSetup) str += "Muon setup; ";
112 if (fIsElectronSetup) str += "Electron setup; ";
113 str += "detectors in geometry: ";
114 if (fDet.find(ECbmModuleId::kMvd)->second) str += "MVD ";
115 if (fDet.find(ECbmModuleId::kSts)->second) str += "STS ";
116 if (fDet.find(ECbmModuleId::kRich)->second) str += "RICH ";
117 if (fDet.find(ECbmModuleId::kMuch)->second) str += "MUCH ";
118 if (fDet.find(ECbmModuleId::kTrd)->second) str += "TRD ";
119 if (fDet.find(ECbmModuleId::kTof)->second) str += "TOF ";
120 return str;
121}
ECbmModuleId
Definition CbmDefs.h:39
@ kMvd
Micro-Vertex Detector.
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kRich
Ring-Imaging Cherenkov Detector.
Helper class to access detector presence.
bool CheckDetectorPresence(const std::string &name) const
Check detector presence using TGeoManager.
void SetDet(ECbmModuleId detId, bool isDet)
Set detector presence manually.
void DetermineSetup()
Determines detector presence using TGeoManager.
map< ECbmModuleId, bool > fDet
string ToString() const
Return string representation of class.
virtual ~CbmLitDetectorSetup()
Destructor.
CbmLitDetectorSetup()
Constructor.
bool GetDet(ECbmModuleId detId) const
Return detector presence in setup.