36 for (
int part = 0; part < m_kPart; part++ )
38 for (
int phi = 0; phi < m_kPhiBr; phi++ )
40 for (
int theta = 0; theta < m_kThetaBr; theta++ )
42 m_NodeTheta[part][phi][theta] = 0;
43 m_PhysicalCrystal[part][phi][theta] = 0;
48 string GdmlManagementPath = getenv(
"GDMLMANAGEMENTDATAROOT" );
49 if ( GdmlManagementPath ==
"" ) cout <<
"EmcROOTGeo::GdmlManagementPath not set!" << endl;
50 string GdmlFile = GdmlManagementPath + string(
"/dat/Emc.gdml" );
51 cout <<
"EmcROOTGeo: Construct Emc from GdmlFile " << GdmlFile << endl;
68 gErrorIgnoreLevel = kFatal;
72 if ( !m_Emc ) std::cout <<
"m_Emc = 0" << std::endl;
73 else cout <<
"Find logicalEMC!" << endl;
75 for (
int part = 0; part < m_kPart; part++ )
79 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
81 for (
int phi = 0; phi <
nPhi; phi++ )
84 int nTheta = ( part == 1 ? 219 : m_kThetaEc );
85 TGeoNode* nodePhi =
GetPhi( part, phi );
88 for (
int theta = 0; theta < nTheta; theta++ )
90 string name = nodePhi->GetDaughter( theta )->GetName();
93 if ( name.find(
"BSCCasing", 0 ) == 7 ) { strthe = name.substr( 16, 2 ); }
94 else if ( name.find(
"EndCasing", 0 ) == 7 ) { strthe = name.substr( 19, 2 ); }
96 istringstream thetaBuf( strthe );
99 if ( nthe >= 0 ) { m_NodeTheta[part][phi][nthe] = nodePhi->GetDaughter( theta ); }
112 int brCrystalColor = 4;
113 int ecCrystalColor = 7;
115 m_Emc->SetLineColor( emcColor );
116 m_Emc->SetVisibility( 0 );
118 for (
int part = 0; part < m_kPart - 1; part++ )
121 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
122 for (
int phi = 0; phi <
nPhi; phi++ )
129 for (
int theta = 0; theta < m_kThetaBr; theta++ )
137 else if ( part == 0 )
139 int iPhi[4] = { 0, 6, 8, 7 };
140 for (
int i = 0; i < 4; i++ )
143 int nTheta = ( part == 1 ? m_kThetaBr : m_kThetaEc );
144 for (
int theta = 0; theta < nTheta; theta++ )
155 for (
int part = 0; part < m_kPart; part++ )
157 GetPart( part )->SetVisibility( 0 );
158 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
159 for (
int phi = 0; phi <
nPhi; phi++ )
161 GetPhi( part, phi )->SetVisibility( 0 );
162 int nTheta = ( part == 1 ? m_kThetaBr : m_kThetaEc );
163 for (
int theta = 0; theta < nTheta; theta++ )
165 GetTheta( part, phi, theta )->SetVisibility( 0 );
166 GetCrystal( part, phi, theta )->SetVisibility( 0 );
199 for (
int part = 0; part < m_kPart; part++ )
201 GetPart( part )->SetVisibility( 0 );
202 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
203 for (
int phi = 0; phi <
nPhi; phi++ )
205 GetPhi( part, phi )->SetVisibility( 0 );
206 int nTheta = ( part == 1 ? m_kThetaBr : m_kThetaEc );
207 for (
int theta = 0; theta < nTheta; theta++ )
209 GetTheta( part, phi, theta )->SetVisibility( 0 );
210 GetCrystal( part, phi, theta )->SetVisibility( 1 );
240 for (
int part = 0; part < m_kPart; part++ )
242 GetPart( part )->SetVisibility( 0 );
243 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
244 for (
int phi = 0; phi <
nPhi; phi++ )
246 GetPhi( part, phi )->SetVisibility( 0 );
247 int nTheta = ( part == 1 ? m_kThetaBr : m_kThetaEc );
248 for (
int theta = 0; theta < nTheta; theta++ )
250 GetTheta( part, phi, theta )->SetVisibility( 0 );
251 if ( ( part == 1 && ( phi >= 0 && phi <
nPhi / 4 ) ) || ( part != 1 ) )
252 {
GetCrystal( part, phi, theta )->SetVisibility( 1 ); }
253 else {
GetCrystal( part, phi, theta )->SetVisibility( 0 ); }
264 gErrorIgnoreLevel = kFatal;
266 if ( gGeoManager == 0 ) std::cout <<
"Create gGeoManager first" << std::endl;
267 else cout <<
"gGeoManager success!" << endl;
270 if ( !volEmc ) std::cout <<
"logicalEMC not found !" << std::endl;
275 TGeoIdentity* identity =
new TGeoIdentity();
277 TGeoMaterial* mat =
new TGeoMaterial(
"VOID", 0, 0, 0 );
278 TGeoMedium* med =
new TGeoMedium(
"MED", 1, mat );
280 gGeoManager->MakeBox(
"volBes", med, 0.5 * m_BesR, 0.5 * m_BesR, 0.5 * m_BesZ );
281 gGeoManager->SetTopVolume( m_Bes );
282 m_Bes->AddNode( volEmc, 0, identity );
286 gGeoManager->SetDrawExtraPaths();
287 gGeoManager->CloseGeometry();
288 gGeoManager->SetNsegments( 20 );
290 TGeoNode*
bes = gGeoManager->GetTopNode();
291 TGeoNode* emc =
bes->GetDaughter( 0 );
293 for (
int part = 0; part < m_kPart; part++ )
295 TGeoNode* nodePart =
GetPart( part );
296 int nPhi = ( part == 1 ? m_kPhiBr : m_kPhiEc );
297 for (
int phi = 0; phi <
nPhi; phi++ )
299 TGeoNode* nodePhi =
GetPhi( part, phi );
300 int nTheta = ( part == 1 ? m_kThetaBr : m_kThetaEc );
301 for (
int theta = 0; theta < nTheta; theta++ )
304 TGeoNode* nodeTheta =
GetTheta( part, phi, theta );
305 TGeoNode* nodeCrystal =
GetCrystal( part, phi, theta );
306 TString strPath = TString(
"/" ) +
bes->GetName() + TString(
"/" ) + emc->GetName() +
307 TString(
"/" ) + nodePart->GetName() + TString(
"/" ) +
308 nodePhi->GetName() + TString(
"/" ) + nodeTheta->GetName() +
309 TString(
"/" ) + nodeCrystal->GetName();
310 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode( strPath );
435 std::stringstream osname;
439 osname <<
"pv_logicalBSCPhi_" << phiNb;
443 if ( phi >= 0 && phi < 6 ) { osname <<
"pv_logicalEndPhi0_" << 15 - phi; }
444 else if ( phi >= 8 && phi < 14 ) { osname <<
"pv_logicalEndPhi0_" << 17 - phi; }
445 else if ( phi == 6 || phi == 14 ) { osname <<
"pv_logicalEndPhi1_" << ( 30 - phi ) / 8; }
446 else if ( phi == 7 || phi == 15 ) { osname <<
"pv_logicalEndPhi2_" << ( 15 - phi ) / 8; }
451 return GetNode( osname.str() );