25 if ( !gGeoManager ) gGeoManager =
new TGeoManager(
"BesGeo",
"Bes geometry" );
31 for (
int part = 0; part < fEmcROOTGeo->
GetPartNb(); part++ )
33 for (
int phi = 0; phi < fEmcROOTGeo->
GetPhiNb( part ); phi++ )
35 for (
int theta = 0; theta < fEmcROOTGeo->
GetThetaNb( part ); theta++ )
37 TGeoPhysicalNode* crystalPhysicalNode =
40 TGeoArb8* arb = (TGeoArb8*)crystalPhysicalNode->GetShape();
44 pRot = crystalPhysicalNode->GetMatrix()->GetRotationMatrix();
45 Hep3Vector rotX( pRot[0], pRot[3], pRot[6] );
46 Hep3Vector rotY( pRot[1], pRot[4], pRot[7] );
47 Hep3Vector rotZ( pRot[2], pRot[5], pRot[8] );
48 HepRotation rotateCrystalToGlobal( rotX, rotY, rotZ );
51 Hep3Vector rotTX( pRot[0], pRot[1], pRot[2] );
52 Hep3Vector rotTY( pRot[3], pRot[4], pRot[5] );
53 Hep3Vector rotTZ( pRot[6], pRot[7], pRot[8] );
54 HepRotation rotateGlobalToCrystal( rotTX, rotTY, rotTZ );
57 pTrans = crystalPhysicalNode->GetMatrix()->GetTranslation();
58 Hep3Vector translateCrystalToGlobal( pTrans[0], pTrans[1], pTrans[2] );
61 for (
int i = 0; i < 8; i++ )
65 fPnt[i] = Hep3Vector( arb->GetVertices()[i * 2], arb->GetVertices()[i * 2 + 1],
70 fPnt[i] = Hep3Vector( arb->GetVertices()[i * 2], arb->GetVertices()[i * 2 + 1],
74 fPnt[i] *= rotateCrystalToGlobal;
75 fPnt[i] += translateCrystalToGlobal;
95 for (
int i = 0; i < 8; i++ ) { aCrystal.
Set( i, fPnt[i] ); }
100 for (
int i = 0; i < 8; i++ )
105 fPnt[i] = fPnt[i + 1];
106 fPnt[i + 1] = tempVec;
108 aCrystal.
Set( i, fPnt[i] );
121 if ( theta >= 30 && theta < 32 ) { nb = theta - 25; }
122 else { nb = theta - 18; }
123 int newTheta, newPhi;
128 aCrystal.
Set( 0, tempCrystal.
Get( 0 ) );
129 aCrystal.
Set( 1, fPnt[0] );
130 aCrystal.
Set( 2, fPnt[1] );
131 aCrystal.
Set( 3, tempCrystal.
Get( 2 ) );
132 aCrystal.
Set( 4, tempCrystal.
Get( 3 ) );
133 aCrystal.
Set( 5, tempCrystal.
Get( 4 ) );
134 aCrystal.
Set( 6, fPnt[4] );
135 aCrystal.
Set( 7, fPnt[5] );
136 aCrystal.
Set( 8, tempCrystal.
Get( 6 ) );
137 aCrystal.
Set( 9, tempCrystal.
Get( 7 ) );
179 int& newTheta,
int& newPhi ) {
181 if ( ( sector >= 0 ) && ( sector < 3 ) ) sector += 16;
184 if ( ( theta >= 0 ) && ( theta < 4 ) )
187 newPhi = ( sector - 3 ) * 4 + theta;
189 else if ( ( theta >= 4 ) && ( theta < 8 ) )
192 newPhi = ( sector - 3 ) * 4 + theta - 4;
194 else if ( ( theta >= 8 ) && ( theta < 13 ) )
197 newPhi = ( sector - 3 ) * 5 + theta - 8;
199 else if ( ( theta >= 13 ) && ( theta < 18 ) )
202 newPhi = ( sector - 3 ) * 5 + theta - 13;
204 else if ( ( theta >= 18 ) && ( theta < 24 ) )
207 newPhi = ( sector - 3 ) * 6 + theta - 18;
209 else if ( ( theta >= 24 ) && ( theta < 30 ) )
212 newPhi = ( sector - 3 ) * 6 + theta - 24;
221 if ( newPhi < 32 ) newPhi = 31 - newPhi;
222 else newPhi = 95 - newPhi;
225 if ( newPhi < 32 ) newPhi = 31 - newPhi;
226 else newPhi = 95 - newPhi;
229 if ( newPhi < 40 ) newPhi = 39 - newPhi;
230 else newPhi = 119 - newPhi;
233 if ( newPhi < 40 ) newPhi = 39 - newPhi;
234 else newPhi = 119 - newPhi;
237 if ( newPhi < 48 ) newPhi = 47 - newPhi;
238 else newPhi = 143 - newPhi;
241 if ( newPhi < 48 ) newPhi = 47 - newPhi;
242 else newPhi = 143 - newPhi;