23#include <TGeoManager.h>
27#include "BesVisLib/EmcROOTGeo.h"
28#include "Identifier/EmcID.h"
29#include "BesVisLib/BesEvent.h"
30#include "BesVisLib/BesView.h"
31#include "RawEvent/RawDataUtil.h"
44 for (
int part = 0; part < m_kPart; part++) {
45 for (
int phi = 0; phi < m_kPhiBr; phi++) {
46 m_NodePhi[part][phi] = 0;
47 for (
int theta = 0; theta < m_kThetaBr; theta++) {
48 m_NodeTheta[part][phi][theta] = 0;
49 m_NodeTheta2[part][phi][theta] = 0;
50 m_PhysicalCrystal[part][phi][theta] = 0;
51 m_PhysicalCrystal2[part][phi][theta] = 0;
52 m_Emc2DCrystal[part][phi][theta] = 0;
56 m_PhyNodeOrgArray =
new TObjArray();
91 cout <<
"EmcROOTGeo::Init2DGeometry, ROOT Geometry not Initialized yet!" << endl;
96 Double_t local[3] = {0.0, 0.0, 0.0};
97 Double_t master[3] = {0.0, 0.0, 0.0};
105 for (
int part = 0; part <
GetPartNb(); part++) {
106 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
107 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
108 TGeoPhysicalNode *phyNode = 0;
110 if (part == 1) name = TString(
"Barrel");
112 if (part == 0) name = TString(
"EastEc");
113 else if (part == 2) name = TString(
"WestEc");
115 name = TString(
"Emc Part");
118 if (part == 1) name += m_kThetaBr - 1 - theta;
124 sprintf(
data,
"Emc part %i, #theta %i, #phi %i", part, theta, phi);
127 TGeoArb8 *crystalShape = (TGeoArb8*)phyNode->GetShape();
128 Double_t *localArb8Point, masterArb8Point[24*2];
129 localArb8Point = crystalShape->GetVertices();
130 for (Int_t i = 0; i < 8; i++) {
131 local[0] = localArb8Point[2*i];
132 local[1] = localArb8Point[2*i+1];
133 if (i < 4) local[2] = crystalShape->GetDz() * (-1.0);
134 else local[2] = crystalShape->GetDz();
136 phyNode->GetMatrix(-1*phyNode->GetLevel())->LocalToMaster(local, &master[0]);
138 for (Int_t j = 0; j < 3; j++) {
139 masterArb8Point[3*i+j] = master[j];
143 TGeoPhysicalNode *phyNode2 = 0;
146 crystalShape = (TGeoArb8*)phyNode2->GetShape();
147 localArb8Point = crystalShape->GetVertices();
148 for (Int_t i = 0; i < 8; i++) {
149 local[0] = localArb8Point[2*i];
150 local[1] = localArb8Point[2*i+1];
151 if (i < 4) local[2] = crystalShape->GetDz() * (-1.0);
152 else local[2] = crystalShape->GetDz();
153 phyNode2->GetMatrix(-1*phyNode->GetLevel())
154 ->LocalToMaster(local, &master[0]);
155 for (Int_t j = 0; j < 3; j++) {
156 masterArb8Point[24+3*i+j] = master[j];
162 m_Emc2DCrystal[part][phi][theta] =
165 m_Emc2DCrystal[part][phi][theta] =
179 if (!m_Emc) std::cout <<
"m_Emc = 0" << std::endl;
184 for (
int part = 0; part < m_kPart; part++) {
186 if (part == 1) ipart = 2;
187 if (part == 0) ipart = 1;
189 m_NodePart[part] = m_Emc->GetNode(ipart);
192 for (
int phi = 0; phi < m_kPhiBr; phi++) {
196 m_NodePhi[part][phi] =
GetPart(part)->GetVolume()->GetNode(iphi);
200 int endphilist[16]= {15,7,14,6,13,12,11,10,9,8,5,4,3,2,1,0};
201 int endphipos[16] = {15,14,13,12,11,10,3,1,9,8,7,6,5,4,2,0};
203 for (
int sector = 0; sector < m_kSectorEc; sector++) {
204 m_NodePhi[part][sector] =
205 GetPart(part)->GetVolume()->GetNode(endphipos[sector]);
212 for (
int phi = 0; phi < m_kPhiBr; phi++) {
214 for (
int idaughter = 0; idaughter<
GetPhi(1, phi)->GetNdaughters(); idaughter++) {
215 TString name =
GetPhi(1, phi)->GetDaughter(idaughter)->GetName();
216 if (name.Contains(
"logicalBSCCasing")){
218 m_NodeTheta[1][phi][theta] =
GetPhi(1, phi)->GetDaughter(idaughter);
224 for (
int part = 0; part < m_kPart; part++) {
225 if (part == 1)
continue;
226 for (
int sector = 0; sector < m_kSectorEc; sector++) {
227 for (
int nb = 0; nb < m_kNbEc; nb++) {
229 if (nb < m_kRealNbEc) {
231 m_NodeTheta[part][phi][theta] =
GetPhi(part, sector)->GetDaughter(nb);
238 m_NodeTheta2[part][phi][theta] =
GetPhi(part, sector)->GetDaughter(nb);
257 TGeoVolume *logicRear,*logicOrgGlass,*logicRearCasing,*logicAlPlate,*logicPD,*logicPreAmpBox,*logicAirInPABox,*logicHangingPlate,*logicWaterPipe;
258 TGeoVolume *logicCable,*logicOCGirder,*logicSupportBar,*logicSupportBar1,*logicEndRing,*logicGear,*logicTaperRing1,*logicTaperRing2,*logicTaperRing3;
271 for (
int i = 0; i < 44; i++){
273 std::ostringstream osnameBSCCable1;
274 osnameBSCCable1 <<
"logicalBSCCable_1_"<<i;
277 logicCable->SetVisibility(0);
279 std::ostringstream osnameBSCCable2;
280 osnameBSCCable2 <<
"logicalBSCCable_2_"<<i;
283 logicCable->SetVisibility(0);
285 std::ostringstream osnameOCGirder1;
286 osnameOCGirder1 <<
"logicalOpenningCutGirder_1_"<<i;
289 logicOCGirder->SetVisibility(0);
291 std::ostringstream osnameOCGirder2;
292 osnameOCGirder2 <<
"logicalOpenningCutGirder_2_"<<i;
295 logicOCGirder->SetVisibility(0);
297 std::ostringstream osnameOCGirder3;
298 osnameOCGirder3 <<
"logicalOpenningCutGirder_3_"<<i;
301 logicOCGirder->SetVisibility(0);
303 std::ostringstream osnameOCGirder4;
304 osnameOCGirder4 <<
"logicalOpenningCutGirder_4_"<<i;
307 logicOCGirder->SetVisibility(0);
321 logicRear->SetVisibility(0);
323 logicOrgGlass->SetVisibility(0);
325 logicRearCasing->SetVisibility(0);
327 logicAlPlate->SetVisibility(0);
329 logicPD->SetVisibility(0);
331 logicPreAmpBox->SetVisibility(0);
333 logicAirInPABox->SetVisibility(0);
334 if (logicHangingPlate)
335 logicHangingPlate->SetVisibility(0);
337 logicWaterPipe->SetVisibility(0);
339 logicGear->SetVisibility(0);
341 logicTaperRing1->SetVisibility(0);
343 logicTaperRing2->SetVisibility(0);
345 logicTaperRing3->SetVisibility(0);
347 logicSupportBar->SetVisibility(0);
348 if (logicSupportBar1)
349 logicSupportBar1->SetVisibility(0);
351 logicEndRing->SetVisibility(0);
362 m_Emc->SetLineColor(m_EmcColor);
363 m_Emc->SetVisibility(0);
365 for (
int part = 0; part < m_kPart-1; part++) {
367 int nPhi = (part == 1 ? m_kPhiBr : m_kSectorEc);
368 for (
int phi = 0; phi <
nPhi; phi++) {
373 for (
int theta = 0; theta < m_kThetaBr; theta++) {
380 else if (part == 0) {
381 int iPhi[3] = {0,1,2};
382 for (
int i = 0; i < 3; i++) {
384 int nTheta = (part == 1 ? m_kThetaBr : m_kNbEc);
385 for (
int theta = 0; theta < nTheta; theta++) {
396 for (
int part = 0; part < m_kPart; part++) {
397 GetPart(part)->SetVisibility(0);
398 int nPhi = (part == 1 ? m_kPhiBr : m_kSectorEc);
399 for (
int phi = 0; phi <
nPhi; phi++) {
400 GetPhi(part, phi)->SetVisibility(0);
405 for (
int part = 0; part < m_kPart; part++) {
406 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
407 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
409 TGeoNode *nodeTheta =
GetTheta(part, phi, theta);
410 if (nodeTheta) nodeTheta->SetVisibility(0);
411 TGeoNode *nodeCrystal =
GetCrystal(part, phi, theta);
412 if (nodeCrystal) nodeCrystal->SetVisibility(0);
414 TGeoNode *nodeTheta2 =
GetTheta2(part, phi, theta);
415 if (nodeTheta2) nodeTheta2->SetVisibility(0);
416 TGeoNode *nodeCrystal2 =
GetCrystal2(part, phi, theta);
417 if (nodeCrystal2) nodeCrystal2->SetVisibility(0);
433 m_Emc->SetLineColor(m_EmcColor);
434 m_Emc->SetVisibility(0);
436 for (
int part = 0; part < m_kPart-1; part++) {
438 int nPhi = (part == 1 ? m_kPhiBr : m_kSectorEc);
439 for (
int phi = 0; phi <
nPhi; phi++) {
444 for (
int theta = 0; theta < m_kThetaBr; theta++) {
451 else if (part == 0) {
452 int iPhi[3] = {0,1,2};
453 for (
int i = 0; i < 3; i++) {
455 int nTheta = (part == 1 ? m_kThetaBr : m_kNbEc);
456 for (
int theta = 0; theta < nTheta; theta++) {
467 for (
int part = 0; part < m_kPart; part++) {
468 GetPart(part)->SetVisibility(1);
469 int nPhi = (part == 1 ? m_kPhiBr : m_kSectorEc);
470 for (
int phi = 0; phi <
nPhi; phi++) {
471 GetPhi(part, phi)->SetVisibility(1);
476 for (
int part = 0; part < m_kPart; part++) {
477 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
478 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
480 TGeoNode *nodeTheta =
GetTheta(part, phi, theta);
481 if (nodeTheta) nodeTheta->SetVisibility(1);
482 TGeoNode *nodeCrystal =
GetCrystal(part, phi, theta);
483 if (nodeCrystal) nodeCrystal->SetVisibility(1);
485 TGeoNode *nodeTheta2 =
GetTheta2(part, phi, theta);
486 if (nodeTheta2) nodeTheta2->SetVisibility(1);
487 TGeoNode *nodeCrystal2 =
GetCrystal2(part, phi, theta);
488 if (nodeCrystal2) nodeCrystal2->SetVisibility(1);
597 if (gGeoManager == 0) std::cout <<
"Create gGeoManager first" << std::endl;
598 TGeoNode *
bes = gGeoManager->GetTopNode();
599 std::cout <<
"Emc m_childNo " <<
m_childNo << std::endl;
600 TGeoNode *emc =
bes->GetDaughter(2);
604 TGeoNode *nodePart =
GetPart(part);
605 for (
int phi = 0; phi <
GetPhiNb(part, 0); phi++) {
606 TGeoNode *nodePhi =
GetPhi(part, phi);
607 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
608 TGeoNode *nodeTheta =
GetTheta(part, phi, theta);
609 TGeoNode *nodeCrystal =
GetCrystal(part, phi, theta);
610 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
611 TString(
"/") + emc->GetName() +
612 TString(
"/") + nodePart->GetName() +
613 TString(
"/") + nodePhi->GetName() +
614 TString(
"/") + nodeTheta->GetName() +
615 TString(
"/") + nodeCrystal->GetName() );
616 m_PhysicalCrystal[part][phi][theta]->SetVisibility(0);
617 m_PhysicalCrystal[part][phi][theta]->SetIsVolAtt(kFALSE);
618 m_PhysicalCrystal[part][phi][theta]->SetLineColor(m_brCrystalColor);
624 for (part = 0; part < m_kPart; part++) {
625 if (part == 1)
continue;
627 for (
int sector = 0; sector < m_kSectorEc; sector++) {
628 TGeoNode *nodeSector =
GetPhi(part, sector);
629 for (
int nb = 0; nb < m_kNbEc; nb++) {
630 TGeoNode *nodeNb = nodeSector->GetDaughter(nb);
631 TGeoNode *nodeCrystal = nodeNb->GetDaughter(0);
634 if (nb < m_kRealNbEc) {
636 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
637 TString(
"/") + emc->GetName() +
638 TString(
"/") + nodePart->GetName() +
639 TString(
"/") + nodeSector->GetName() +
640 TString(
"/") + nodeNb->GetName() +
641 TString(
"/") + nodeCrystal->GetName() );
642 m_PhysicalCrystal[part][phi][theta]->SetVisibility(0);
643 m_PhysicalCrystal[part][phi][theta]->SetIsVolAtt(kFALSE);
644 m_PhysicalCrystal[part][phi][theta]->SetLineColor(m_ecCrystalColor);
649 m_PhysicalCrystal2[part][phi][theta] = gGeoManager->MakePhysicalNode( TString(
"/") +
bes->GetName() +
650 TString(
"/") + emc->GetName() +
651 TString(
"/") + nodePart->GetName() +
652 TString(
"/") + nodeSector->GetName() +
653 TString(
"/") + nodeNb->GetName() +
654 TString(
"/") + nodeCrystal->GetName() );
655 m_PhysicalCrystal2[part][phi][theta]->SetVisibility(0);
656 m_PhysicalCrystal2[part][phi][theta]->SetIsVolAtt(kFALSE);
657 m_PhysicalCrystal2[part][phi][theta]->SetLineColor(m_ecCrystalColor);
703 if (gPad) view = (
BesView*)gPad->GetView();
710 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
711 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
714 phyNode->SetVisibility(0);
715 if ( phi >= 0 && phi < m_kPhiBr*4/4
728 for (
int part = 0; part < m_kPart; part++) {
729 if (part == 1)
continue;
730 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
731 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
734 phyNode->SetVisibility(0);
735 if (part == 2 && phi <=
GetPhiNb(part, theta)||
736 part == 0 && phi <=
GetPhiNb(part, theta) ) {
747 phyNode->SetVisibility(0);
748 if (part == 2 && phi <=
GetPhiNb(part, theta)||
749 part == 0 && phi <=
GetPhiNb(part, theta) ) {
770 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
771 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
773 int color = m_brCrystalColor;
775 if (part == 0 || part == 2)
776 color = m_ecCrystalColor;
778 phyNode->SetLineColor(color);
779 phyNode->SetVisibility(0);
783 m_PhyNodeOrgArray->Clear(
"C");
790 aCrystal->
AddInfo(aCrystal->GetTitle());
798 for (
int i = 0; i < m_EmcDigiCol->GetEntries(); i++) {
809 TGeoPhysicalNode *phyNode = 0;
812 m_PhyNodeOrgArray->Add ( phyNode->GetNode() );
832 m_PhyNodeOrgArray->Add ( phyNode->GetNode() );
851 aCrystal = m_Emc2DCrystal[part][phi][theta];
854 aCrystal->
AddInfo(aCrystal->GetTitle());
857 sprintf(
data,
"time = %-.3f ns, charge = %-.3f MeV",
time, charge);
859 sprintf(
data,
"Fired");
873 if (gPad) view = (
BesView*)gPad->GetView();
877 phyNode->SetVisibility(0);
883 phyNode->SetVisibility(1);
892 if (gPad) view = (
BesView*)gPad->GetView();
894 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++) {
895 TGeoPhysicalNode *phyNode = (TGeoPhysicalNode*)
m_HitsArray->At(i);
901 phyNode->SetVisibility(1);
902 phyNode->SetLineColor(kMagenta);
906 phyNode->SetVisibility(0);
921 int thetaNb = m_kThetaBr;
922 if (part != 1) thetaNb = m_kThetaEc;
930 int phiNb = m_kPhiBr;
932 if (theta < 2) phiNb = 4*m_kSectorEc;
933 else if (theta >= 2 && theta < 4) phiNb = 5*m_kSectorEc;
934 else if (theta >= 4 && theta < m_kThetaEc) phiNb = 6*m_kSectorEc;
944 std::stringstream osname;
945 if (part != 1) osname <<
"logicalEndWorld";
946 else osname <<
"logicalBSCWorld";
949 if (part == 0 || part == 1) {
953 std::cout <<
"No volume " << osname.str() << std::endl;
962 std::stringstream osname;
964 if (part == 1) osname <<
"logicalBSCPhi" ;
966 if (phi == 15 || phi == 7) osname <<
"logicalEndPhi2" ;
967 else if (phi == 14 || phi == 6) osname <<
"logicalEndPhi1" ;
968 else osname <<
"logicalEndPhi0" ;
972 if ( (part == 0 && phi >= 0 && phi < 16) ||
973 (part == 1 && phi >= 0 && phi < 120) ) {
977 std::cout <<
"No volume " << osname.str() << std::endl;
987 std::stringstream osname;
988 if (part == 1 && theta >= 0 && theta < 44) {
990 osname <<
"logicalBSCCasing" << theta;
993 else if ( part != 1 && theta >= 0 && theta < 35 &&
996 osname <<
"logicalEndCasing_" << phi <<
"_" << theta;
1000 std::cout <<
"No volume " << osname.str() << std::endl;
1010 std::stringstream osname;
1011 if (part == 1 && theta >= 0 && theta < 44) {
1013 osname <<
"logicalCrystal";
1016 else if ( part == 0 && theta >= 0 && theta < 35 &&
1019 osname <<
"logicalEndCrystal_" << phi <<
"_" << theta;
1023 std::cout <<
"No volume " << osname.str() << std::endl;
1032 std::stringstream osname;
1034 if (part == 1) osname <<
"pv_logicalBSCWorld_2";
1035 if (part == 0) osname <<
"pv_logicalEndWorld_1";
1036 if (part == 2) osname <<
"pv_logicalEndWorld_0";
1038 return GetNode( osname.str() );
1041 if (m_NodePart[part] != 0) {
1042 return m_NodePart[part];
1045 std::cout <<
"Node: " <<
"Part" << part <<
" not found" << std::endl;
1057 int endphilist[16]= {15,7,14,6,13,12,11,10,9,8,5,4,3,2,1,0};
1058 int endphipos[16] = {15,14,13,12,11,10,3,1,9,8,7,6,5,4,2,0};
1061 if (phi==15||phi==7) realphi = 2;
1062 if (phi==14||phi==6) realphi = 1;
1064 std::stringstream osname;
1066 if (part == 1) osname <<
"pv_logicalBSCPhi" <<
"_" << 308-phi;
1067 else osname <<
"pv_logicalEndPhi"<<realphi<<
"_" <<endphipos[phi];
1068 return GetNode( osname.str() );
1071 if (m_NodePhi[part][phi] != 0) {
1072 return m_NodePhi[part][phi];
1075 std::cout <<
"Node: " <<
"Part" << part <<
"Phi" << phi <<
" not found" << std::endl;
1086 if (m_NodeTheta[part][phi][theta] != 0) {
1087 return m_NodeTheta[part][phi][theta];
1090 std::cout <<
"Node: " <<
"Part" << part <<
"Phi" << phi <<
"Theta" << theta <<
" not found" << std::endl;
1098 if (m_NodeTheta2[part][phi][theta] != 0) {
1099 return m_NodeTheta2[part][phi][theta];
1110 return GetTheta(part, phi, theta)->GetDaughter(0);
1117 if (
GetTheta2(part, phi, theta) == 0)
return 0;
1118 else return GetTheta2(part, phi, theta)->GetDaughter(0);
1124 if (m_PhysicalCrystal[part][phi][theta] != 0) {
1125 return m_PhysicalCrystal[part][phi][theta];
1128 std::cout <<
"PhysicalNode: " <<
"Part" << part <<
"Phi" << phi <<
"Theta" << theta <<
" not found" << std::endl;
1136 return m_PhysicalCrystal2[part][phi][theta];
1142 if (part == 1)
return false;
1150 if ((sector>=0)&&(sector<3))
1152 if ((sector!=7)&&(sector!=15))
1154 if ((nb>=0)&&(nb<4))
1157 CryNumberPhi = (sector-3)*4+nb;
1159 else if ((nb>=4)&&(nb<8))
1162 CryNumberPhi = (sector-3)*4+nb-4;
1164 else if ((nb>=8)&&(nb<13))
1167 CryNumberPhi = (sector-3)*5+nb-8;
1169 else if ((nb>=13)&&(nb<18))
1172 CryNumberPhi = (sector-3)*5+nb-13;
1174 else if ((nb>=18)&&(nb<24))
1177 CryNumberPhi = (sector-3)*6+nb-18;
1179 else if ((nb>=24)&&(nb<30))
1182 CryNumberPhi = (sector-3)*6+nb-24;
1187 if ((nb>=0)&&(nb<4))
1190 CryNumberPhi = (sector-3)*4+3-nb;
1192 else if ((nb>=4)&&(nb<8))
1195 CryNumberPhi = (sector-3)*4+7-nb;
1197 else if ((nb>=8)&&(nb<13))
1200 CryNumberPhi = (sector-3)*5+12-nb;
1202 else if ((nb>=13)&&(nb<18))
1205 CryNumberPhi = (sector-3)*5+17-nb;
1207 else if ((nb>=18)&&(nb<24))
1210 CryNumberPhi = (sector-3)*6+23-nb;
1212 else if ((nb>=24)&&(nb<30))
1215 CryNumberPhi = (sector-3)*6+29-nb;
1221 switch (CryNumberTheta)
1224 if (CryNumberPhi<32)
1225 CryNumberPhi = 31-CryNumberPhi;
1227 CryNumberPhi = 95-CryNumberPhi;
1230 if (CryNumberPhi<32)
1231 CryNumberPhi = 31-CryNumberPhi;
1233 CryNumberPhi = 95-CryNumberPhi;
1236 if (CryNumberPhi<40)
1237 CryNumberPhi = 39-CryNumberPhi;
1239 CryNumberPhi = 119-CryNumberPhi;
1242 if (CryNumberPhi<40)
1243 CryNumberPhi = 39-CryNumberPhi;
1245 CryNumberPhi = 119-CryNumberPhi;
1248 if (CryNumberPhi<48)
1249 CryNumberPhi = 47-CryNumberPhi;
1251 CryNumberPhi = 143-CryNumberPhi;
1254 if (CryNumberPhi<48)
1255 CryNumberPhi = 47-CryNumberPhi;
1257 CryNumberPhi = 143-CryNumberPhi;
1294 if (m_Emc2DCrystal[part][phi][theta])
return m_Emc2DCrystal[part][phi][theta];
1301 for (
int part = 0; part <
GetPartNb(); part++) {
1302 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
1303 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
1316 cout <<
"EmcROOTGeo::GetPart, this crystal physical node does not exist!" << endl;
1323 TString opt = option;
1326 if (!
m_2DGeoInit) cout <<
"EmcROOTGeo::Draw2D(), 2D Geometry not initialized!" << endl;
1328 if (!view) cout <<
"EmcROOTGeo::Draw(), BesView not found" << endl;
1335 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1336 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
1337 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
1339 if (m_Emc2DCrystal[part][phi][theta]) {
1341 m_Emc2DCrystal[part][phi][theta]->
SetFired(
false);
1345 m_Emc2DCrystal[part][phi][theta]->
Draw(crystalOpt);
1358 if (!view) cout <<
"EmcROOTGeo::DrawHits(), BesView not found" << endl;
1368 for (Int_t part =
GetPartNb()-1; part >= 0; part--) {
1369 for (
int theta = 0; theta <
GetThetaNb(part); theta++) {
1370 for (
int phi = 0; phi <
GetPhiNb(part, theta); phi++) {
1371 if (m_Emc2DCrystal[part][phi][theta]) {
1380 for (
int i = 0; i < m_EmcDigiCol->GetEntries(); i++) {
1390 aCrystal = m_Emc2DCrystal[part][phi][theta];
1398 if (aCrystal&&charge > 5) {
1411void EmcROOTGeo::Align(TGeoPhysicalNode *phyNode, TGeoMatrix *newmat, TGeoShape *newshape, Bool_t check)
1415 if (!newmat && !newshape)
return;
1416 TGeoNode *node = phyNode->GetNode();
1418 Int_t fLevel=phyNode->GetLevel();
1419 TGeoNode *nnode = 0;
1420 TGeoVolume *vm = phyNode->GetVolume(fLevel-2);
1424 TGeoNode *nodeArray[30];
1425 TString orgName = phyNode->GetName();
1427 if (!phyNode->IsAligned()) {
1428 for (i=0; i<=fLevel-2; i++) {
1429 nodeArray[i] = phyNode->GetNode(i);
1435 for (i=fLevel-2; i<fLevel; i++) {
1437 node = phyNode->GetNode(i+1);
1438 id = vm->GetIndex(node);
1445 vd = node->GetVolume()->CloneVolume();
1446 nnode = node->MakeCopyNode();
1448 nnode->SetName(node->GetName());
1449 nnode->SetVolume(vd);
1450 nnode->SetMotherVolume(vm);
1452 vm->GetNodes()->RemoveAt(
id);
1453 vm->GetNodes()->AddAt(nnode,
id);
1454 nodeArray[i+1] = nnode;
1458 nnode = phyNode->GetNode();
1462 for (Int_t j = 0; j < phyNode->GetLevel()+1; j++) {
1464 name += nodeArray[j]->GetName();
1467 phyNode->SetName(name);
1471 TGeoNodeMatrix *aligned = (TGeoNodeMatrix*)nnode;
1472 vm = nnode->GetMotherVolume();
1473 vd = nnode->GetVolume();
1476 if (!newmat->IsRegistered()) newmat->RegisterYourself();
1477 aligned->SetMatrix(newmat);
1479 TGeoHMatrix *global = phyNode->GetMatrix();
1480 TGeoHMatrix *up = phyNode->GetMatrix(fLevel-1);
1482 global->Multiply(newmat);
1485 if (newshape) vd->SetShape(newshape);
1487 vm->SetVoxelFinder(0);
1488 vm->Voxelize(
"ALL");
1491 if (check) vm->CheckOverlaps();
1497 Align(phyNode, node->GetMatrix(), node->GetVolume()->GetShape());
R__EXTERN BesEvent * gEvent
const TObjArray * GetEmcDigiCol() const
Bool_t GetVisEmcHitsBarrel()
Bool_t GetVisEmcHitsGlobal()
Bool_t GetVisEmcHitsWest()
Bool_t GetVisEmcHitsEast()
virtual void SetFired(bool status=true)
virtual void ResetTimeCharge()
virtual void Draw(Option_t *option="")
virtual void AddInfo(TString info)
virtual void SetCharge(Double_t charge)
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0)
static unsigned int theta_module(const Identifier &id)
static unsigned int phi_module(const Identifier &id)
TGeoVolume * GetVolumeCrystal(int part, int phi, int theta)
Get crystal volume;.
int ComputeEndCopyNb(int num)
Compute copyNb, copyNb 5,6,14,15,16 corresponding to two volume.
void SetVisEmcDetector()
Set Emc detector visibility;.
TGeoNode * GetCrystal(int part, int phi, int theta)
Get crystal one;.
TGeoVolume * GetVolumeTheta(int part, int phi, int theta)
Get theta volume;.
TGeoNode * GetTheta(int part, int phi, int theta)
Get theta node;.
int GetPartNb()
Get number of part;.
void SetVisEmcHits()
Set Emc hits visibility;.
TGeoVolume * GetVolumePart(int part)
Get part volume;.
TGeoNode * GetCrystal2(int part, int phi, int theta)
Get crystal2 one;.
void Align(TGeoPhysicalNode *phyNode, TGeoMatrix *newmat=0, TGeoShape *newshape=0, Bool_t check=kFALSE)
Align a physical node, change its position and shape.
void ComputeThetaPhi(int id, int sector, int nb, int &CryNumberTheta, int &CryNumberPhi)
Compute theta, phi from sector, nb.
TGeoNode * GetPart(int part)
Get part node;.
Emc2DCrystal * Get2DCrystal(Int_t part, Int_t phi, Int_t theta)
Get Emc2DCrystal;.
TGeoPhysicalNode * GetPhysicalCrystal2(int part, int phi, int theta)
Get crystal physical node2; EC nb 5,6,14,15,16 in any sector has two physicalNode.
void SetHalfVisible()
Set half visible;.
void Draw(Option_t *option)
Draw function.
int GetPhiNb(int part)
Get number of phi on part;.
void InitFromROOT(TGeoVolume *vol)
Initialize ROOTGeo from TGeoVolume logicalEmc.
void SetAllVisible()
Set all visible;.
TGeoVolume * GetVolumePhi(int part, int phi)
Get phi volume;
void InitFromGDML(const char *gdmlFile, const char *setupName)
Initialize ROOTGeo from GDML.
void SetNoEndVisible()
Set noend visible;.
void SetPhysicalNode()
Set the pointers to the physical nodes;.
void SetVolumeAppendInVis()
Set default visual attributes;.
void SetNode()
Set the pointers to theirs nodes;.
int GetThetaNb(int part)
Get number of theta on part;.
bool HasTwoNodes(int part, int phi, int theta)
Whether this id is combined of two nodes.
TGeoNode * GetPhi(int part, int phi)
Get phi node;.
void RestorePhyNode(TGeoPhysicalNode *phyNode, TGeoNode *node)
Restore the physical node to original shape.
void DrawHits(Option_t *option)
Draw 2D hits.
TGeoPhysicalNode * GetPhysicalCrystal(int part, int phi, int theta)
Get crystal physical node;.
TGeoNode * GetTheta2(int part, int phi, int theta)
Get theta2 node;.
void SetDetector()
Set default physical node attributes;.
void Init2DGeometry()
Initialize 2D Geometry.
void SetVolumeEmc(TGeoVolume *vol)
Set Emc volume, while initializing from ROOT;.
void SetVolumeDefaultVis()
Set default visual attributes;.
void SetQuarterVisible()
Set quater visible;.
void SetHits()
Set all physicalNodes corresponding to digiCol;.
static double EmcTime(int timeChannel)
static double EmcCharge(int measure, int chargeChannel)
TGeoNode * GetNode(const std::string &nn)
Get a node(physical volume) by name;.
TObjArray * m_2DHitsArray
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.
TObjArray * m_DetectorsArray
UInt_t getMeasure() const
UInt_t getChargeChannel() const
UInt_t getTimeChannel() const