20#include <TGeoManager.h>
22#include "ROOTGeo/TofROOTGeo.h"
26 for (
int part = 0; part < m_kPart; part++ )
28 for (
int scin = 0; scin < m_kAssemblyBr; scin++ )
30 m_NodeScin[part][scin] = 0;
31 m_PhysicalScin[part][scin] = 0;
48 if ( !m_Tof ) std::cout <<
"m_Tof = 0" << std::endl;
50 for (
int part = 0; part < m_kPart; part++ )
53 if ( part == 1 ) nScin = m_kAssemblyBr;
54 else nScin = m_kAssemblyEc;
55 for (
int scin = 0; scin < nScin; scin++ )
57 std::stringstream osname;
64 <<
"_" << m_kAssemblyBr + m_kAssemblyEc + scin <<
"_0";
72 <<
"_" << scin <<
"_0";
80 <<
"_" << m_kAssemblyBr + scin <<
"_0";
83 m_NodeScin[part][scin] =
GetNode( osname.str() );
94 m_Tof->SetLineColor( tofColor );
95 m_Tof->SetVisibility( 0 );
97 for (
int part = 0; part < m_kPart; part++ )
105 if ( part == 1 ) nScin = m_kAssemblyBr;
106 else nScin = m_kAssemblyEc;
107 for (
int scin = 0; scin < nScin; scin++ )
109 GetScin( part, scin )->SetVisibility( 0 );
112 if ( part == 1 ) nBucket = m_kBucketBr;
113 else nBucket = m_kBucketEc;
114 for (
int bucket = 0; bucket < nBucket; bucket++ )
115 {
GetBucket( part, scin, bucket )->SetVisibility( 0 ); }
122 for (
int part = 0; part < m_kPart; part++ )
128 if ( part == 1 ) nScin = m_kAssemblyBr;
129 else nScin = m_kAssemblyEc;
130 for (
int scin = 0; scin < nScin; scin++ )
132 GetScin( part, scin )->SetVisibility( 1 );
135 if ( part == 1 ) nBucket = m_kBucketBr;
136 else nBucket = m_kBucketEc;
137 for (
int bucket = 0; bucket < nBucket; bucket++ )
138 {
GetBucket( part, scin, bucket )->SetVisibility( 1 ); }
144 for (
int part = 0; part < m_kPart; part++ )
150 if ( part == 1 ) nScin = m_kAssemblyBr;
151 else nScin = m_kAssemblyEc;
152 for (
int scin = 0; scin < nScin; scin++ )
154 if ( scin < nScin / 4 )
GetScin( part, scin )->SetVisibility( 0 );
155 else GetScin( part, scin )->SetVisibility( 1 );
158 if ( part == 1 ) nBucket = m_kBucketBr;
159 else nBucket = m_kBucketEc;
160 for (
int bucket = 0; bucket < nBucket; bucket++ )
162 if ( scin < nScin / 4 )
GetBucket( part, scin, bucket )->SetVisibility( 0 );
163 else GetBucket( part, scin, bucket )->SetVisibility( 1 );
172 if ( gGeoManager == 0 ) std::cout <<
"Create gGeoManager first" << std::endl;
173 TGeoNode*
bes = gGeoManager->GetTopNode();
177 for (
int part = 0; part < m_kPart; part++ )
180 if ( part == 1 ) nScin = m_kAssemblyBr;
181 else nScin = m_kAssemblyEc;
182 for (
int scin = 0; scin < nScin; scin++ )
184 TGeoNode* nodeScin =
GetScin( part, scin );
185 m_PhysicalScin[part][scin] = gGeoManager->MakePhysicalNode(
186 TString(
"/" ) +
bes->GetName() + TString(
"/" ) + tof->GetName() + TString(
"/" ) +
187 nodeScin->GetName() );
188 m_PhysicalScin[part][scin]->SetVisibility( 0 );
189 m_PhysicalScin[part][scin]->SetIsVolAtt( kFALSE );
190 m_PhysicalScin[part][scin]->SetLineColor( scinColor );
201 int nScin = m_kAssemblyBr;
202 if ( part != 1 ) nScin = m_kAssemblyEc;
207 std::stringstream osname;
208 if ( part == 0 || part == 2 )
228 std::stringstream osname;
229 if ( part == 0 || part == 2 )
249 std::stringstream osname;
250 if ( part == 0 || part == 2 )
270 if ( m_NodeScin[part][scin] != 0 ) {
return m_NodeScin[part][scin]; }
273 std::cout <<
"Node: "
274 <<
"Part" << part <<
"Scin" << scin <<
" not found" << std::endl;
278 return m_NodeScin[part][scin];
282 std::stringstream osname;
289 <<
"_" << m_kAssemblyBr + m_kAssemblyEc + scin <<
"_1";
291 else if ( part == 1 )
297 <<
"_" << scin <<
"_" << bucket + 1;
299 else if ( part == 2 )
305 <<
"_" << m_kAssemblyBr + scin <<
"_1";
308 return GetNode( osname.str() );
312 if ( m_PhysicalScin[part][scin] != 0 ) {
return m_PhysicalScin[part][scin]; }
315 std::cout <<
"PhysicalNode: "
316 <<
"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;.