24#include <TGeoManager.h>
27#include "BesVisLib/BesEvent.h"
28#include "BesVisLib/BesView.h"
29#include "BesVisLib/EmcROOTGeo.h"
30#include "Identifier/EmcID.h"
31#include "RawEvent/RawDataUtil.h"
44 for (
int part = 0; part < m_kPart; part++ )
46 for (
int phi = 0; phi < m_kPhiBr; phi++ )
48 m_NodePhi[part][phi] = 0;
49 for (
int theta = 0; theta < m_kThetaBr; theta++ )
51 m_NodeTheta[part][phi][theta] = 0;
52 m_NodeTheta2[part][phi][theta] = 0;
53 m_PhysicalCrystal[part][phi][theta] = 0;
54 m_PhysicalCrystal2[part][phi][theta] = 0;
55 m_Emc2DCrystal[part][phi][theta] = 0;
59 m_PhyNodeOrgArray =
new TObjArray();
65 m_brCrystalColor = 861;
66 m_ecCrystalColor = 866;
71 cout <<
"delete old EmcROOTGeo" << endl;
72 for (
int part = 0; part <
GetPartNb(); part++ )
74 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
76 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
77 {
delete m_Emc2DCrystal[part][phi][theta]; }
80 delete m_PhyNodeOrgArray;
100 cout <<
"EmcROOTGeo::Init2DGeometry, ROOT Geometry not Initialized yet!" << endl;
105 Double_t local[3] = { 0.0, 0.0, 0.0 };
106 Double_t master[3] = { 0.0, 0.0, 0.0 };
114 for (
int part = 0; part <
GetPartNb(); part++ )
116 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
118 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
120 TGeoPhysicalNode* phyNode = 0;
122 if ( part == 1 ) name = TString(
"Barrel" );
125 if ( part == 0 ) name = TString(
"EastEc" );
126 else if ( part == 2 ) name = TString(
"WestEc" );
128 name = TString(
"Emc Part" );
131 if ( part == 1 ) name += m_kThetaBr - 1 - theta;
137 sprintf(
data,
"Emc part %i, #theta %i, #phi %i", part, theta, phi );
140 TGeoArb8* crystalShape = (TGeoArb8*)phyNode->GetShape();
141 Double_t *localArb8Point, masterArb8Point[24 * 2];
142 localArb8Point = crystalShape->GetVertices();
143 for ( Int_t i = 0; i < 8; i++ )
145 local[0] = localArb8Point[2 * i];
146 local[1] = localArb8Point[2 * i + 1];
147 if ( i < 4 ) local[2] = crystalShape->GetDz() * ( -1.0 );
148 else local[2] = crystalShape->GetDz();
150 phyNode->GetMatrix( -1 * phyNode->GetLevel() )->LocalToMaster( local, &master[0] );
152 for ( Int_t j = 0; j < 3; j++ ) { masterArb8Point[3 * i + j] = master[j]; }
155 TGeoPhysicalNode* phyNode2 = 0;
159 crystalShape = (TGeoArb8*)phyNode2->GetShape();
160 localArb8Point = crystalShape->GetVertices();
161 for ( Int_t i = 0; i < 8; i++ )
163 local[0] = localArb8Point[2 * i];
164 local[1] = localArb8Point[2 * i + 1];
165 if ( i < 4 ) local[2] = crystalShape->GetDz() * ( -1.0 );
166 else local[2] = crystalShape->GetDz();
167 phyNode2->GetMatrix( -1 * phyNode->GetLevel() )
168 ->LocalToMaster( local, &master[0] );
169 for ( Int_t j = 0; j < 3; j++ ) { masterArb8Point[24 + 3 * i + j] = master[j]; }
174 m_Emc2DCrystal[part][phi][theta] =
177 m_Emc2DCrystal[part][phi][theta] =
190 if ( !m_Emc ) std::cout <<
"m_Emc = 0" << std::endl;
195 for (
int part = 0; part < m_kPart; part++ )
198 if ( part == 1 ) ipart = 2;
199 if ( part == 0 ) ipart = 1;
201 m_NodePart[part] = m_Emc->GetNode( ipart );
205 for (
int phi = 0; phi < m_kPhiBr; phi++ )
210 m_NodePhi[part][phi] =
GetPart( part )->GetVolume()->GetNode( iphi );
215 int endphilist[16] = { 15, 7, 14, 6, 13, 12, 11, 10, 9, 8, 5, 4, 3, 2, 1, 0 };
216 int endphipos[16] = { 15, 14, 13, 12, 11, 10, 3, 1, 9, 8, 7, 6, 5, 4, 2, 0 };
218 for (
int sector = 0; sector < m_kSectorEc; sector++ )
220 m_NodePhi[part][sector] =
GetPart( part )->GetVolume()->GetNode( endphipos[sector] );
227 for (
int phi = 0; phi < m_kPhiBr; phi++ )
230 for (
int idaughter = 0; idaughter <
GetPhi( 1, phi )->GetNdaughters(); idaughter++ )
232 TString name =
GetPhi( 1, phi )->GetDaughter( idaughter )->GetName();
233 if ( name.Contains(
"logicalBSCCasing" ) )
236 m_NodeTheta[1][phi][theta] =
GetPhi( 1, phi )->GetDaughter( idaughter );
242 for (
int part = 0; part < m_kPart; part++ )
244 if ( part == 1 )
continue;
245 for (
int sector = 0; sector < m_kSectorEc; sector++ )
247 for (
int nb = 0; nb < m_kNbEc; nb++ )
250 if ( nb < m_kRealNbEc )
253 m_NodeTheta[part][phi][theta] =
GetPhi( part, sector )->GetDaughter( nb );
261 m_NodeTheta2[part][phi][theta] =
GetPhi( part, sector )->GetDaughter( nb );
278 TGeoVolume *logicRear, *logicOrgGlass, *logicRearCasing, *logicAlPlate, *logicPD,
279 *logicPreAmpBox, *logicAirInPABox, *logicHangingPlate, *logicWaterPipe;
280 TGeoVolume *logicCable, *logicOCGirder, *logicSupportBar, *logicSupportBar1, *logicEndRing,
281 *logicGear, *logicTaperRing1, *logicTaperRing2, *logicTaperRing3;
284 gErrorIgnoreLevel = kFatal;
296 for (
int i = 0; i < 44; i++ )
299 std::ostringstream osnameBSCCable1;
300 osnameBSCCable1 <<
"logicalBSCCable_1_" << i;
302 if ( logicCable ) logicCable->SetVisibility( 0 );
304 std::ostringstream osnameBSCCable2;
305 osnameBSCCable2 <<
"logicalBSCCable_2_" << i;
307 if ( logicCable ) logicCable->SetVisibility( 0 );
309 std::ostringstream osnameOCGirder1;
310 osnameOCGirder1 <<
"logicalOpenningCutGirder_1_" << i;
312 if ( logicOCGirder ) logicOCGirder->SetVisibility( 0 );
314 std::ostringstream osnameOCGirder2;
315 osnameOCGirder2 <<
"logicalOpenningCutGirder_2_" << i;
317 if ( logicOCGirder ) logicOCGirder->SetVisibility( 0 );
319 std::ostringstream osnameOCGirder3;
320 osnameOCGirder3 <<
"logicalOpenningCutGirder_3_" << i;
322 if ( logicOCGirder ) logicOCGirder->SetVisibility( 0 );
324 std::ostringstream osnameOCGirder4;
325 osnameOCGirder4 <<
"logicalOpenningCutGirder_4_" << i;
327 if ( logicOCGirder ) logicOCGirder->SetVisibility( 0 );
340 if ( logicRear ) logicRear->SetVisibility( 0 );
341 if ( logicOrgGlass ) logicOrgGlass->SetVisibility( 0 );
342 if ( logicRearCasing ) logicRearCasing->SetVisibility( 0 );
343 if ( logicAlPlate ) logicAlPlate->SetVisibility( 0 );
344 if ( logicPD ) logicPD->SetVisibility( 0 );
345 if ( logicPreAmpBox ) logicPreAmpBox->SetVisibility( 0 );
346 if ( logicAirInPABox ) logicAirInPABox->SetVisibility( 0 );
347 if ( logicHangingPlate ) logicHangingPlate->SetVisibility( 0 );
348 if ( logicWaterPipe ) logicWaterPipe->SetVisibility( 0 );
349 if ( logicGear ) logicGear->SetVisibility( 0 );
350 if ( logicTaperRing1 ) logicTaperRing1->SetVisibility( 0 );
351 if ( logicTaperRing2 ) logicTaperRing2->SetVisibility( 0 );
352 if ( logicTaperRing3 ) logicTaperRing3->SetVisibility( 0 );
353 if ( logicSupportBar ) logicSupportBar->SetVisibility( 0 );
354 if ( logicSupportBar1 ) logicSupportBar1->SetVisibility( 0 );
355 if ( logicEndRing ) logicEndRing->SetVisibility( 0 );
363 m_Emc->SetLineColor( m_EmcColor );
364 m_Emc->SetVisibility( 0 );
366 for (
int part = 0; part < m_kPart - 1; part++ )
369 int nPhi = ( part == 1 ? m_kPhiBr : m_kSectorEc );
370 for (
int phi = 0; phi <
nPhi; phi++ )
377 for (
int theta = 0; theta < m_kThetaBr; theta++ )
385 else if ( part == 0 )
387 int iPhi[3] = { 0, 1, 2 };
388 for (
int i = 0; i < 3; i++ )
391 int nTheta = ( part == 1 ? m_kThetaBr : m_kNbEc );
392 for (
int theta = 0; theta < nTheta; theta++ )
404 for (
int part = 0; part < m_kPart; part++ )
406 GetPart( part )->SetVisibility( 0 );
407 int nPhi = ( part == 1 ? m_kPhiBr : m_kSectorEc );
408 for (
int phi = 0; phi <
nPhi; phi++ ) {
GetPhi( part, phi )->SetVisibility( 0 ); }
412 for (
int part = 0; part < m_kPart; part++ )
414 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
416 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
419 TGeoNode* nodeTheta =
GetTheta( part, phi, theta );
420 if ( nodeTheta ) nodeTheta->SetVisibility( 0 );
421 TGeoNode* nodeCrystal =
GetCrystal( part, phi, theta );
422 if ( nodeCrystal ) nodeCrystal->SetVisibility( 0 );
424 TGeoNode* nodeTheta2 =
GetTheta2( part, phi, theta );
425 if ( nodeTheta2 ) nodeTheta2->SetVisibility( 0 );
426 TGeoNode* nodeCrystal2 =
GetCrystal2( part, phi, theta );
427 if ( nodeCrystal2 ) nodeCrystal2->SetVisibility( 0 );
439 m_Emc->SetLineColor( m_EmcColor );
440 m_Emc->SetVisibility( 0 );
442 for (
int part = 0; part < m_kPart - 1; part++ )
445 int nPhi = ( part == 1 ? m_kPhiBr : m_kSectorEc );
446 for (
int phi = 0; phi <
nPhi; phi++ )
453 for (
int theta = 0; theta < m_kThetaBr; theta++ )
461 else if ( part == 0 )
463 int iPhi[3] = { 0, 1, 2 };
464 for (
int i = 0; i < 3; i++ )
467 int nTheta = ( part == 1 ? m_kThetaBr : m_kNbEc );
468 for (
int theta = 0; theta < nTheta; theta++ )
480 for (
int part = 0; part < m_kPart; part++ )
482 GetPart( part )->SetVisibility( 1 );
483 int nPhi = ( part == 1 ? m_kPhiBr : m_kSectorEc );
484 for (
int phi = 0; phi <
nPhi; phi++ ) {
GetPhi( part, phi )->SetVisibility( 1 ); }
488 for (
int part = 0; part < m_kPart; part++ )
490 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
492 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
495 TGeoNode* nodeTheta =
GetTheta( part, phi, theta );
496 if ( nodeTheta ) nodeTheta->SetVisibility( 1 );
497 TGeoNode* nodeCrystal =
GetCrystal( part, phi, theta );
498 if ( nodeCrystal ) nodeCrystal->SetVisibility( 1 );
500 TGeoNode* nodeTheta2 =
GetTheta2( part, phi, theta );
501 if ( nodeTheta2 ) nodeTheta2->SetVisibility( 1 );
502 TGeoNode* nodeCrystal2 =
GetCrystal2( part, phi, theta );
503 if ( nodeCrystal2 ) nodeCrystal2->SetVisibility( 1 );
603 if ( gGeoManager == 0 ) std::cout <<
"Create gGeoManager first" << std::endl;
604 TGeoNode*
bes = gGeoManager->GetTopNode();
605 std::cout <<
"Emc m_childNo " <<
m_childNo << std::endl;
606 TGeoNode* emc =
bes->GetDaughter( 2 );
610 TGeoNode* nodePart =
GetPart( part );
611 for (
int phi = 0; phi <
GetPhiNb( part, 0 ); phi++ )
613 TGeoNode* nodePhi =
GetPhi( part, phi );
614 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
616 TGeoNode* nodeTheta =
GetTheta( part, phi, theta );
617 TGeoNode* nodeCrystal =
GetCrystal( part, phi, theta );
618 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode(
619 TString(
"/" ) +
bes->GetName() + TString(
"/" ) + emc->GetName() + TString(
"/" ) +
620 nodePart->GetName() + TString(
"/" ) + nodePhi->GetName() + TString(
"/" ) +
621 nodeTheta->GetName() + TString(
"/" ) + nodeCrystal->GetName() );
622 m_PhysicalCrystal[part][phi][theta]->SetVisibility( 0 );
623 m_PhysicalCrystal[part][phi][theta]->SetIsVolAtt( kFALSE );
624 m_PhysicalCrystal[part][phi][theta]->SetLineColor( m_brCrystalColor );
629 for ( part = 0; part < m_kPart; part++ )
631 if ( part == 1 )
continue;
633 for (
int sector = 0; sector < m_kSectorEc; sector++ )
635 TGeoNode* nodeSector =
GetPhi( part, sector );
636 for (
int nb = 0; nb < m_kNbEc; nb++ )
638 TGeoNode* nodeNb = nodeSector->GetDaughter( nb );
639 TGeoNode* nodeCrystal = nodeNb->GetDaughter( 0 );
642 if ( nb < m_kRealNbEc )
645 m_PhysicalCrystal[part][phi][theta] = gGeoManager->MakePhysicalNode(
646 TString(
"/" ) + bes->GetName() + TString(
"/" ) + emc->GetName() +
647 TString(
"/" ) + nodePart->GetName() + TString(
"/" ) + nodeSector->GetName() +
648 TString(
"/" ) + nodeNb->GetName() + TString(
"/" ) + nodeCrystal->GetName() );
649 m_PhysicalCrystal[part][phi][theta]->SetVisibility( 0 );
650 m_PhysicalCrystal[part][phi][theta]->SetIsVolAtt( kFALSE );
651 m_PhysicalCrystal[part][phi][theta]->SetLineColor( m_ecCrystalColor );
658 m_PhysicalCrystal2[part][phi][theta] = gGeoManager->MakePhysicalNode(
659 TString(
"/" ) + bes->GetName() + TString(
"/" ) + emc->GetName() +
660 TString(
"/" ) + nodePart->GetName() + TString(
"/" ) + nodeSector->GetName() +
661 TString(
"/" ) + nodeNb->GetName() + TString(
"/" ) + nodeCrystal->GetName() );
662 m_PhysicalCrystal2[part][phi][theta]->SetVisibility( 0 );
663 m_PhysicalCrystal2[part][phi][theta]->SetIsVolAtt( kFALSE );
664 m_PhysicalCrystal2[part][phi][theta]->SetLineColor( m_ecCrystalColor );
677 for (
int part = 0; part < m_kPart; part++ )
679 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
681 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
689 phyCrystal->SetIsVolAtt( kFALSE );
690 phyCrystal->SetLineColor( m_brCrystalColor );
697 phyCrystal->SetIsVolAtt( kFALSE );
698 phyCrystal->SetLineColor( m_ecCrystalColor );
702 phyCrystal2->SetIsVolAtt( kFALSE );
703 phyCrystal2->SetLineColor( m_ecCrystalColor );
714 if ( gPad ) view =
dynamic_cast<BesView*
>( gPad->GetView() );
721 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
723 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
728 phyNode->SetVisibility( 0 );
729 if ( phi >= 0 && phi < m_kPhiBr * 4 / 4
739 for (
int part = 0; part < m_kPart; part++ )
741 if ( part == 1 )
continue;
742 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
744 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
749 phyNode->SetVisibility( 0 );
750 if ( part == 2 && phi <=
GetPhiNb( part, theta ) ||
751 part == 0 && phi <=
GetPhiNb( part, theta ) )
760 phyNode->SetVisibility( 0 );
761 if ( part == 2 && phi <=
GetPhiNb( part, theta ) ||
762 part == 0 && phi <=
GetPhiNb( part, theta ) )
778 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++ )
780 TGeoPhysicalNode* phyNode = (TGeoPhysicalNode*)
m_HitsArray->At( i );
782 int color = m_brCrystalColor;
784 if ( part == 0 || part == 2 ) color = m_ecCrystalColor;
786 phyNode->SetLineColor( color );
787 phyNode->SetVisibility( 0 );
791 m_PhyNodeOrgArray->Clear(
"C" );
799 aCrystal->
AddInfo( aCrystal->GetTitle() );
809 m_EmcDigiCol =
gEvent->GetEmcDigiCol();
811 if ( m_EmcDigiCol ) NDigiCol = m_EmcDigiCol->GetEntries();
815 for (
int i = 0; i < NDigiCol; i++ )
827 TGeoPhysicalNode* phyNode = 0;
831 m_PhyNodeOrgArray->Add( phyNode->GetNode() );
852 m_PhyNodeOrgArray->Add( phyNode->GetNode() );
871 aCrystal = m_Emc2DCrystal[part][phi][theta];
878 aCrystal->
AddInfo( aCrystal->GetTitle() );
895 if ( gPad ) view =
dynamic_cast<BesView*
>( gPad->GetView() );
900 phyNode->SetVisibility( 0 );
906 phyNode->SetVisibility( 1 );
913 if ( gPad ) view =
dynamic_cast<BesView*
>( gPad->GetView() );
915 for (
int i = 0; i <
m_HitsArray->GetEntries(); i++ )
917 TGeoPhysicalNode* phyNode = (TGeoPhysicalNode*)
m_HitsArray->At( i );
924 phyNode->SetVisibility( 1 );
925 phyNode->SetLineColor( 881 );
931 if ( part == 1 ) phyNode->SetLineColor( m_brCrystalColor );
932 else phyNode->SetLineColor( m_ecCrystalColor );
943 if ( part == 1 )
return m_kThetaBr;
944 else return m_kThetaEc;
949 int phiNb = m_kPhiBr;
952 if ( theta < 2 ) phiNb = 4 * m_kSectorEc;
953 else if ( theta >= 2 && theta < 4 ) phiNb = 5 * m_kSectorEc;
954 else if ( theta >= 4 && theta < m_kThetaEc ) phiNb = 6 * m_kSectorEc;
962 std::stringstream osname;
963 if ( part != 1 ) osname <<
"logicalEndWorld";
964 else osname <<
"logicalBSCWorld";
970 std::cout <<
"No volume " << osname.str() << std::endl;
977 std::stringstream osname;
979 if ( part == 1 ) osname <<
"logicalBSCPhi";
982 if ( phi == 15 || phi == 7 ) osname <<
"logicalEndPhi2";
983 else if ( phi == 14 || phi == 6 ) osname <<
"logicalEndPhi1";
984 else osname <<
"logicalEndPhi0";
987 if ( ( part == 0 && phi >= 0 && phi < 16 ) || ( part == 1 && phi >= 0 && phi < 120 ) )
991 std::cout <<
"No volume " << osname.str() << std::endl;
999 std::stringstream osname;
1000 if ( part == 1 && theta >= 0 && theta < 44 )
1003 osname <<
"logicalBSCCasing" << theta;
1006 else if ( part != 1 && theta >= 0 && theta < 35 && ( phi < 3 ) )
1009 osname <<
"logicalEndCasing_" << phi <<
"_" << theta;
1014 std::cout <<
"No volume " << osname.str() << std::endl;
1022 std::stringstream osname;
1023 if ( part == 1 && theta >= 0 && theta < 44 )
1026 osname <<
"logicalCrystal";
1029 else if ( part == 0 && theta >= 0 && theta < 35 && ( phi < 3 ) )
1033 osname <<
"logicalEndCrystal_" << phi <<
"_" << theta;
1038 std::cout <<
"No volume " << osname.str() << std::endl;
1046 std::stringstream osname;
1049 if ( part == 1 ) osname <<
"pv_logicalBSCWorld_2";
1050 if ( part == 0 ) osname <<
"pv_logicalEndWorld_1";
1051 if ( part == 2 ) osname <<
"pv_logicalEndWorld_0";
1053 return GetNode( osname.str() );
1057 if ( m_NodePart[part] != 0 ) {
return m_NodePart[part]; }
1060 std::cout <<
"Node: "
1061 <<
"Part" << part <<
" not found" << std::endl;
1073 int endphilist[16] = { 15, 7, 14, 6, 13, 12, 11, 10, 9, 8, 5, 4, 3, 2, 1, 0 };
1074 int endphipos[16] = { 15, 14, 13, 12, 11, 10, 3, 1,
1075 9, 8, 7, 6, 5, 4, 2, 0 };
1078 if ( phi == 15 || phi == 7 ) realphi = 2;
1079 if ( phi == 14 || phi == 6 ) realphi = 1;
1081 std::stringstream osname;
1085 osname <<
"pv_logicalBSCPhi"
1086 <<
"_" << 308 - phi;
1087 else osname <<
"pv_logicalEndPhi" << realphi <<
"_" << endphipos[phi];
1088 return GetNode( osname.str() );
1092 if ( m_NodePhi[part][phi] != 0 ) {
return m_NodePhi[part][phi]; }
1095 std::cout <<
"Node: "
1096 <<
"Part" << part <<
"Phi" << phi <<
" not found" << std::endl;
1106 if ( m_NodeTheta[part][phi][theta] != 0 ) {
return m_NodeTheta[part][phi][theta]; }
1109 std::cout <<
"Node: "
1110 <<
"Part" << part <<
"Phi" << phi <<
"Theta" << theta <<
" not found"
1118 if ( m_NodeTheta2[part][phi][theta] != 0 ) {
return m_NodeTheta2[part][phi][theta]; }
1125 return GetTheta( part, phi, theta )->GetDaughter( 0 );
1131 if (
GetTheta2( part, phi, theta ) == 0 )
return 0;
1132 else return GetTheta2( part, phi, theta )->GetDaughter( 0 );
1138 if ( m_PhysicalCrystal[part][phi][theta] != 0 )
1139 {
return m_PhysicalCrystal[part][phi][theta]; }
1142 std::cout <<
"PhysicalNode: "
1143 <<
"Part" << part <<
"Phi" << phi <<
"Theta" << theta <<
" not found"
1152 return m_PhysicalCrystal2[part][phi][theta];
1156 if ( part == 1 )
return false;
1161 int& CryNumberPhi ) {
1162 if ( ( sector >= 0 ) && ( sector < 3 ) ) sector += 16;
1163 if ( ( sector != 7 ) && ( sector != 15 ) )
1165 if ( ( nb >= 0 ) && ( nb < 4 ) )
1168 CryNumberPhi = ( sector - 3 ) * 4 + nb;
1170 else if ( ( nb >= 4 ) && ( nb < 8 ) )
1173 CryNumberPhi = ( sector - 3 ) * 4 + nb - 4;
1175 else if ( ( nb >= 8 ) && ( nb < 13 ) )
1178 CryNumberPhi = ( sector - 3 ) * 5 + nb - 8;
1180 else if ( ( nb >= 13 ) && ( nb < 18 ) )
1183 CryNumberPhi = ( sector - 3 ) * 5 + nb - 13;
1185 else if ( ( nb >= 18 ) && ( nb < 24 ) )
1188 CryNumberPhi = ( sector - 3 ) * 6 + nb - 18;
1190 else if ( ( nb >= 24 ) && ( nb < 30 ) )
1193 CryNumberPhi = ( sector - 3 ) * 6 + nb - 24;
1198 if ( ( nb >= 0 ) && ( nb < 4 ) )
1201 CryNumberPhi = ( sector - 3 ) * 4 + 3 - nb;
1203 else if ( ( nb >= 4 ) && ( nb < 8 ) )
1206 CryNumberPhi = ( sector - 3 ) * 4 + 7 - nb;
1208 else if ( ( nb >= 8 ) && ( nb < 13 ) )
1211 CryNumberPhi = ( sector - 3 ) * 5 + 12 - nb;
1213 else if ( ( nb >= 13 ) && ( nb < 18 ) )
1216 CryNumberPhi = ( sector - 3 ) * 5 + 17 - nb;
1218 else if ( ( nb >= 18 ) && ( nb < 24 ) )
1221 CryNumberPhi = ( sector - 3 ) * 6 + 23 - nb;
1223 else if ( ( nb >= 24 ) && ( nb < 30 ) )
1226 CryNumberPhi = ( sector - 3 ) * 6 + 29 - nb;
1232 switch ( CryNumberTheta )
1235 if ( CryNumberPhi < 32 ) CryNumberPhi = 31 - CryNumberPhi;
1236 else CryNumberPhi = 95 - CryNumberPhi;
1239 if ( CryNumberPhi < 32 ) CryNumberPhi = 31 - CryNumberPhi;
1240 else CryNumberPhi = 95 - CryNumberPhi;
1243 if ( CryNumberPhi < 40 ) CryNumberPhi = 39 - CryNumberPhi;
1244 else CryNumberPhi = 119 - CryNumberPhi;
1247 if ( CryNumberPhi < 40 ) CryNumberPhi = 39 - CryNumberPhi;
1248 else CryNumberPhi = 119 - CryNumberPhi;
1251 if ( CryNumberPhi < 48 ) CryNumberPhi = 47 - CryNumberPhi;
1252 else CryNumberPhi = 143 - CryNumberPhi;
1255 if ( CryNumberPhi < 48 ) CryNumberPhi = 47 - CryNumberPhi;
1256 else CryNumberPhi = 143 - CryNumberPhi;
1266 case 30: copyNb = 5;
break;
1267 case 31: copyNb = 6;
break;
1268 case 32: copyNb = 14;
break;
1269 case 33: copyNb = 15;
break;
1270 case 34: copyNb = 16;
break;
1271 default: copyNb =
num;
break;
1277 if ( m_Emc2DCrystal[part][phi][theta] )
return m_Emc2DCrystal[part][phi][theta];
1282 for (
int part = 0; part <
GetPartNb(); part++ )
1284 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
1286 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
1302 cout <<
"EmcROOTGeo::GetPart, this crystal physical node does not exist!" << endl;
1307 TString opt = option;
1310 if ( !
m_2DGeoInit ) cout <<
"EmcROOTGeo::Draw2D(), 2D Geometry not initialized!" << endl;
1312 if ( !view ) cout <<
"EmcROOTGeo::Draw(), BesView not found" << endl;
1320 for ( Int_t part =
GetPartNb() - 1; part >= 0; part-- )
1322 for (
int theta = 0; theta <
GetThetaNb( part ); theta++ )
1324 for (
int phi = 0; phi <
GetPhiNb( part, theta ); phi++ )
1327 if ( m_Emc2DCrystal[part][phi][theta] )
1330 m_Emc2DCrystal[part][phi][theta]->SetFired(
false );
1334 m_Emc2DCrystal[part][phi][theta]->Draw( crystalOpt );
1345 if ( !view ) cout <<
"EmcROOTGeo::DrawHits(), BesView not found" << endl;
1359 if ( aCrystal && aCrystal->
GetCharge() > 5 )
1419 if ( !newmat && !newshape )
return;
1420 TGeoNode* node = phyNode->GetNode();
1422 Int_t fLevel = phyNode->GetLevel();
1423 TGeoNode* nnode = 0;
1424 TGeoVolume* vm = phyNode->GetVolume( fLevel - 2 );
1428 TGeoNode* nodeArray[30];
1429 TString orgName = phyNode->GetName();
1431 if ( !phyNode->IsAligned() )
1433 for ( i = 0; i <= fLevel - 2; i++ ) { nodeArray[i] = phyNode->GetNode( i ); }
1438 for ( i = fLevel - 2; i < fLevel; i++ )
1441 node = phyNode->GetNode( i + 1 );
1442 id = vm->GetIndex( node );
1450 vd = node->GetVolume()->CloneVolume();
1451 nnode = node->MakeCopyNode();
1453 nnode->SetName( node->GetName() );
1454 nnode->SetVolume( vd );
1455 nnode->SetMotherVolume( vm );
1457 vm->GetNodes()->RemoveAt(
id );
1458 vm->GetNodes()->AddAt( nnode,
id );
1459 nodeArray[i + 1] = nnode;
1463 else { nnode = phyNode->GetNode(); }
1466 for ( Int_t j = 0; j < phyNode->GetLevel() + 1; j++ )
1469 name += nodeArray[j]->GetName();
1472 phyNode->SetName( name );
1476 TGeoNodeMatrix* aligned = (TGeoNodeMatrix*)nnode;
1477 vm = nnode->GetMotherVolume();
1478 vd = nnode->GetVolume();
1482 if ( !newmat->IsRegistered() ) newmat->RegisterYourself();
1483 aligned->SetMatrix( newmat );
1485 TGeoHMatrix* global = phyNode->GetMatrix();
1486 TGeoHMatrix* up = phyNode->GetMatrix( fLevel - 1 );
1488 global->Multiply( newmat );
1491 if ( newshape ) vd->SetShape( newshape );
1493 vm->SetVoxelFinder( 0 );
1494 vm->Voxelize(
"ALL" );
1497 if ( check ) vm->CheckOverlaps();
1502 Align( phyNode, node->GetMatrix(), node->GetVolume()->GetShape() );
sprintf(cut, "kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_" "pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
R__EXTERN BesEvent * gEvent
Bool_t GetVisEmcHitsBarrel()
Bool_t GetVisEmcHitsGlobal()
Bool_t GetVisEmcHitsWest()
Bool_t GetVisEmcHitsEast()
virtual void SetFired(bool status=true)
virtual void SetTime(Double_t time)
virtual void Draw(Option_t *option="")
virtual void AddInfo(TString info)
virtual void SetCharge(Double_t charge)
virtual Double_t GetCharge()
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;.
void SetPhysicalDefaultVis()
Set default physical node attributes;.
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 Detecor (what is detector depends on you).
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