37 for (
int part = 0; part < m_kPart; part++) {
38 for (
int phi = 0; phi < m_kPhiBr; phi++) {
39 for (
int theta = 0; theta < m_kThetaBr; theta++) {
40 m_NodeTheta[part][phi][theta] = 0;
41 m_PhysicalCrystal[part][phi][theta] = 0;
46 string GdmlManagementPath = getenv(
"GDMLMANAGEMENTROOT");
47 if (GdmlManagementPath ==
"") cout <<
"EmcROOTGeo::GdmlManagementPath not set!" << endl;
48 string GdmlFile = GdmlManagementPath + string(
"/dat/Emc.gdml");
49 cout <<
"Construct Emc from GdmlFile " << GdmlFile << endl;
71 gErrorIgnoreLevel = kFatal;
77 if(!m_Emc) std::cout <<
"m_Emc = 0" << std::endl;
78 else cout<<
"Find logicalEMC!"<<endl;
80 for (
int part = 0; part < m_kPart; part++) {
83 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
85 for (
int phi = 0; phi <
nPhi; phi++) {
87 int nTheta = (part == 1 ? 219 : m_kThetaEc);
88 TGeoNode *nodePhi =
GetPhi(part,phi);
91 for (
int theta = 0; theta < nTheta; theta++) {
92 string name = nodePhi->GetDaughter(theta)->GetName();
95 if(name.find(
"BSCCasing",0)==7) {
96 strthe = name.substr(16,2);
97 }
else if(name.find(
"EndCasing",0)==7) {
98 strthe = name.substr(19,2);
101 istringstream thetaBuf(strthe);
105 m_NodeTheta[part][phi][nthe] = nodePhi->GetDaughter(theta);
121 int brCrystalColor = 4;
122 int ecCrystalColor = 7;
124 m_Emc->SetLineColor(emcColor);
125 m_Emc->SetVisibility(0);
127 for (
int part = 0; part < m_kPart-1; part++) {
129 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
130 for (
int phi = 0; phi <
nPhi; phi++) {
135 for (
int theta = 0; theta < m_kThetaBr; theta++) {
142 else if (part == 0) {
143 int iPhi[4] = {0,6,8,7};
144 for (
int i = 0; i < 4; i++) {
146 int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
147 for (
int theta = 0; theta < nTheta; theta++) {
157 for (
int part = 0; part < m_kPart; part++) {
158 GetPart(part)->SetVisibility(0);
159 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
160 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++) {
164 GetTheta(part, phi, theta)->SetVisibility(0);
165 GetCrystal(part, phi, theta)->SetVisibility(0);
200 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++) {
204 GetPhi(part, phi)->SetVisibility(0);
205 int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
206 for (
int theta = 0; theta < nTheta; theta++) {
207 GetTheta(part, phi, theta)->SetVisibility(0);
208 GetCrystal(part, phi, theta)->SetVisibility(1);
240 for (
int part = 0; part < m_kPart; part++) {
241 GetPart(part)->SetVisibility(0);
242 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
243 for (
int phi = 0; phi <
nPhi; phi++) {
244 GetPhi(part, phi)->SetVisibility(0);
245 int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
246 for (
int theta = 0; theta < nTheta; theta++) {
247 GetTheta(part, phi, theta)->SetVisibility(0);
248 if ( (part == 1 && (phi >= 0 && phi <
nPhi/4)) ||
250 GetCrystal(part, phi, theta)->SetVisibility(1);
253 GetCrystal(part, phi, theta)->SetVisibility(0);
268 gErrorIgnoreLevel = kFatal;
270 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
271 else cout<<
"gGeoManager success!"<<endl;
274 if(!volEmc) std::cout <<
"logicalEMC not found !" << std::endl;
279 TGeoIdentity *identity =
new TGeoIdentity();
281 TGeoMaterial *mat =
new TGeoMaterial(
"VOID",0,0,0);
282 TGeoMedium *med =
new TGeoMedium(
"MED",1,mat);
283 TGeoVolume *m_Bes = gGeoManager->MakeBox(
"volBes", med,
284 0.5*m_BesR, 0.5*m_BesR, 0.5*m_BesZ);
285 gGeoManager->SetTopVolume(m_Bes);
286 m_Bes->AddNode(volEmc, 0, identity);
290 gGeoManager->SetDrawExtraPaths();
291 gGeoManager->CloseGeometry();
292 gGeoManager->SetNsegments(20);
295 TGeoNode *
bes = gGeoManager->GetTopNode();
296 TGeoNode *emc =
bes->GetDaughter(0);
298 for (
int part = 0; part < m_kPart; part++) {
299 TGeoNode *nodePart =
GetPart(part);
300 int nPhi = (part == 1 ? m_kPhiBr : m_kPhiEc);
301 for (
int phi = 0; phi <
nPhi; phi++) {
302 TGeoNode *nodePhi =
GetPhi(part, phi);
303 int nTheta = (part == 1 ? m_kThetaBr : m_kThetaEc);
304 for (
int theta = 0; theta < nTheta; theta++) {
306 TGeoNode *nodeTheta =
GetTheta(part, phi, theta);
307 TGeoNode *nodeCrystal =
GetCrystal(part, phi, theta);
308 TString strPath = TString(
"/") +
bes->GetName() +
309 TString(
"/") + emc->GetName() +
310 TString(
"/") + nodePart->GetName() +
311 TString(
"/") + nodePhi->GetName() +
312 TString(
"/") + nodeTheta->GetName() +
313 TString(
"/") + nodeCrystal->GetName();
314 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode(strPath);