20#include <TGeoManager.h>
22#include "ROOTGeo/TofROOTGeo.h"
27 for (
int part = 0; part < m_kPart; part++) {
28 for (
int scin = 0; scin < m_kAssemblyBr; scin++) {
29 m_NodeScin[part][scin] = 0;
30 m_PhysicalScin[part][scin] = 0;
52 if(!m_Tof) std::cout <<
"m_Tof = 0" << std::endl;
54 for (
int part = 0; part < m_kPart; part++) {
56 if (part == 1) nScin = m_kAssemblyBr;
57 else nScin = m_kAssemblyEc;
58 for (
int scin = 0; scin < nScin; scin++) {
59 std::stringstream osname;
61 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"ScinEc" <<
"_" << m_kAssemblyBr + m_kAssemblyEc + scin <<
"_0";
64 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"ScinBr" <<
"_" << scin <<
"_0";
67 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"ScinEc" <<
"_" << m_kAssemblyBr + scin <<
"_0";
70 m_NodeScin[part][scin] =
GetNode( osname.str() );
83 m_Tof->SetLineColor(tofColor);
84 m_Tof->SetVisibility(0);
86 for (
int part = 0; part < m_kPart; part++) {
93 if (part == 1) nScin = m_kAssemblyBr;
94 else nScin = m_kAssemblyEc;
95 for (
int scin = 0; scin < nScin; scin++) {
96 GetScin(part, scin)->SetVisibility(0);
99 if (part == 1) nBucket = m_kBucketBr;
100 else nBucket = m_kBucketEc;
101 for (
int bucket = 0; bucket < nBucket; bucket++) {
102 GetBucket(part, scin, bucket)->SetVisibility(0);
112 for (
int part = 0; part < m_kPart; part++) {
117 if (part == 1) nScin = m_kAssemblyBr;
118 else nScin = m_kAssemblyEc;
119 for (
int scin = 0; scin < nScin; scin++) {
120 GetScin(part, scin)->SetVisibility(1);
123 if (part == 1) nBucket = m_kBucketBr;
124 else nBucket = m_kBucketEc;
125 for (
int bucket = 0; bucket < nBucket; bucket++) {
126 GetBucket(part, scin, bucket)->SetVisibility(1);
135 for (
int part = 0; part < m_kPart; part++) {
140 if (part == 1) nScin = m_kAssemblyBr;
141 else nScin = m_kAssemblyEc;
142 for (
int scin = 0; scin < nScin; scin++) {
143 if (scin < nScin/4)
GetScin(part, scin)->SetVisibility(0);
144 else GetScin(part, scin)->SetVisibility(1);
147 if (part == 1) nBucket = m_kBucketBr;
148 else nBucket = m_kBucketEc;
149 for (
int bucket = 0; bucket < nBucket; bucket++) {
150 if (scin < nScin/4)
GetBucket(part, scin, bucket)->SetVisibility(0);
151 else GetBucket(part, scin, bucket)->SetVisibility(1);
162 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
163 TGeoNode *
bes = gGeoManager->GetTopNode();
167 for (
int part = 0; part < m_kPart; part++) {
169 if (part == 1) nScin = m_kAssemblyBr;
170 else nScin = m_kAssemblyEc;
171 for (
int scin = 0; scin < nScin; scin++) {
172 TGeoNode *nodeScin =
GetScin(part, scin);
173 m_PhysicalScin[part][scin] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
174 TString(
"/") + tof->GetName() +
175 TString(
"/") + nodeScin->GetName() );
176 m_PhysicalScin[part][scin]->SetVisibility(0);
177 m_PhysicalScin[part][scin]->SetIsVolAtt(kFALSE);
178 m_PhysicalScin[part][scin]->SetLineColor(scinColor);
193 int nScin = m_kAssemblyBr;
194 if (part != 1) nScin = m_kAssemblyEc;
201 std::stringstream osname;
202 if (part == 0 || part == 2) {
203 osname <<
"logical" <<
"Tof" <<
"AssemblyEc";
207 osname <<
"logical" <<
"Tof" <<
"AssemblyBr";
217 std::stringstream osname;
218 if (part == 0 || part == 2) {
219 osname <<
"logical" <<
"Tof" <<
"ScinEc";
223 osname <<
"logical" <<
"Tof" <<
"ScinBr";
233 std::stringstream osname;
234 if (part == 0 || part == 2) {
235 osname <<
"logical" <<
"Tof" <<
"BucketEc";
239 osname <<
"logical" <<
"Tof" <<
"BucketBr";
249 if (m_NodeScin[part][scin] != 0) {
250 return m_NodeScin[part][scin];
253 std::cout <<
"Node: " <<
"Part" << part <<
"Scin" << scin <<
" not found" << std::endl;
257 return m_NodeScin[part][scin];
263 std::stringstream osname;
265 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"BucketEc" <<
"_" << m_kAssemblyBr + m_kAssemblyEc + scin <<
"_1";
267 else if (part == 1) {
268 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"BucketBr" <<
"_" << scin <<
"_" << bucket+1;
270 else if (part == 2) {
271 osname <<
"pv_" <<
"logical" <<
"Tof" <<
"BucketEc" <<
"_" << m_kAssemblyBr + scin <<
"_1";
274 return GetNode( osname.str() );
280 if (m_PhysicalScin[part][scin] != 0) {
281 return m_PhysicalScin[part][scin];
284 std::cout <<
"PhysicalNode: " <<
"Part" << part <<
"Scin" << scin <<
" not found" << std::endl;
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
TGeoVolume * GetTopVolume()
Get the top(world) volume;.
TGeoVolume * GetLogicalVolume(const std::string &vn)
Get a logical volume by name;.
void ReadGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
TGeoVolumeAssembly * GetAssemblyVolume(const std::string &an)
Get an assembly by name;.
void SetQuarterVisible()
Set quater visible;.
TGeoVolume * GetVolumeScin(int part)
Get scintillator volume;.
void InitFromGdml(const char *gdmlFile, const char *setupName)
Initialize the instance of ROOTGeo.
int GetPartNb()
Get number of part;.
TGeoVolume * GetVolumeBucket(int part)
Get bucket volume;.
void SetDefaultVis()
Set default visual attributes;.
TGeoVolumeAssembly * GetVolumeAssembly(int part)
Get assembly volume; part=0,2 for AssemblyEc, 1 for AssemblyBr;
TGeoNode * GetScin(int part, int scin)
Get scintillator node;.
TGeoNode * GetBucket(int part, int scin, int bucket)
Get bucket node, 0 for west bucket, 1 for the east one;.
int GetScinNb(int part)
Get number of scintillators on each part;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
TGeoPhysicalNode * GetPhysicalScin(int part, int scin)
Get scintillator physical node;.
void SetNode()
Set the pointers to theirs nodes;.
void SetAllVisible()
Set all visible;.