8#include "EmcRecGeoSvc/EmcRecEndCapGeo.h"
11 ParameterInitialize();
12 CalculateStandardSector1();
13 CalculateStandardSector2();
19void EmcRecEndCapGeo::ParameterInitialize() {
45 for ( i = 0; i < 7; ++i ) { fphi5[i] = fphi5[i] * 3.14159265358979 / 180; }
54 for ( i = 0; i < 6; ++i ) { fphi3[i] = fphi3[i] * 3.14159265358979 / 180; }
62 for ( i = 0; i < 5; ++i ) { fphi1[i] = fphi1[i] * 3.14159265358979 / 180; }
65void EmcRecEndCapGeo::CalculateStandardSector1() {
67 EmcRecGeoPlane pl1, pl2, pl3;
68 HepPoint3D po0, po1, po2, po3, po4, po5, po6, po7, po8, po9;
70 double tantheta1, costheta1, sintheta1;
83 double dphi1 = fphi5[1] - fphi5[0];
84 double dphi2 = fphi5[2] - fphi5[1];
90 t.setZ( fzshift + fz );
92 tantheta1 = fr[0] / fz;
93 costheta1 = 1 / sqrt( 1 + tantheta1 * tantheta1 );
94 sintheta1 = costheta1 * tantheta1;
99 for ( i = 0; i < 2; ++i )
101 if ( i == 0 ) { dphi = dphi1; }
102 else { dphi = dphi2; }
105 fRing5[i].Set( 3, po3 );
108 fRing5[i].Set( 0, po0.rotateZ( dphi ) );
110 l = fRing5[i].Get( 3 ).distance( fRing5[i].Get( 0 ) ) / 2;
111 ll = sqrt( fz * fz + fr[0] * fr[0] );
112 lp = ll * flength / sqrt( ll * ll - l * l );
114 po7.setX( po7.x() + lp * sintheta1 );
115 po7.setZ( po7.z() + lp * costheta1 );
116 fRing5[i].Set( 7, po7 );
118 fRing5[i].Set( 4, po4.rotateZ( dphi ) );
120 pl1.
Build( 0, 1, 0, 0 );
121 n2 = ( fRing5[i].Get( 0 ) + fRing5[i].Get( 3 ) ) / 2;
123 pl2.
Build(
n, fRing5[i].Get( 3 ) );
126 m.setZ( fzshift + fz );
130 FindInt( pl1, pl2, pl3, po2 );
132 fRing5[i].Set( 2, po2 );
134 fRing5[i].Set( 1, po1.rotateZ( dphi ) );
136 pl2.
Build(
n, fRing5[i].Get( 7 ) );
137 FindInt( pl1, pl2, pl3, po6 );
138 fRing5[i].Set( 6, po6 );
140 fRing5[i].Set( 5, po5.rotateZ( dphi ) );
144 for ( i = 0; i < 8; ++i ) { fRing5[1].Set( i, fRing5[1].Get( i ).rotateZ( dphi1 ) ); }
147 for ( i = 2; i < 6; ++i )
149 for ( j = 0; j < 8; ++j )
150 { fRing5[i].Set( j, fRing5[1].Get( j ).rotateZ( fphi5[i] - fphi5[1] ) ); }
160 EmcRecGeoPlane pl4, pl5, pl6;
166 t.setZ( fzshift + fz );
168 dphi1 = fphi5[1] - fphi5[0];
169 dphi2 = fphi5[2] - fphi5[1];
171 tantheta1 = fr[1] / fz;
172 costheta1 = 1 / sqrt( 1 + tantheta1 * tantheta1 );
173 sintheta1 = costheta1 * tantheta1;
179 EmcRecCrystal up[2], down[2];
180 for ( i = 0; i < 2; ++i )
182 if ( i == 0 ) { dphi = dphi1; }
183 else { dphi = dphi2; }
186 down[i].
Set( 3, po3 );
188 down[i].
Set( 0, po0.rotateZ( dphi ) );
193 up[i].
Set( 0, po0.rotateZ( dphi2 ) );
195 l = down[i].
Get( 3 ).distance( down[i].Get( 0 ) ) / 2;
196 ll = sqrt( fz * fz + fr[1] * fr[1] );
197 lp = ll * flength / sqrt( ll * ll - l * l );
199 po7.setX( po7.x() + lp * sintheta1 );
200 po7.setZ( po7.z() + lp * costheta1 );
201 down[i].
Set( 7, po7 );
203 down[i].
Set( 4, po4.rotateZ( dphi ) );
205 l = up[i].
Get( 3 ).distance( up[i].Get( 0 ) ) / 2;
206 ll = sqrt( fz * fz + fr[1] * fr[1] );
207 lp = ll * flength / sqrt( ll * ll - l * l );
209 po7.setX( po7.x() + lp * sintheta1 );
210 po7.setZ( po7.z() + lp * costheta1 );
213 up[i].
Set( 4, po4.rotateZ( dphi2 ) );
215 up[i].
Set( 0, up[i].Get( 0 ).rotateZ( dphi ) );
216 up[i].
Set( 3, up[i].Get( 3 ).rotateZ( dphi ) );
217 up[i].
Set( 4, up[i].Get( 4 ).rotateZ( dphi ) );
218 up[i].
Set( 7, up[i].Get( 7 ).rotateZ( dphi ) );
222 pl1.
Build( 0, 1, 0, 0 );
223 n2 = ( down[i].
Get( 0 ) + down[i].Get( 3 ) ) / 2;
225 pl2.
Build(
n, down[i].Get( 3 ) );
228 m.setZ( fzshift + fz );
230 if ( i == 0 ) { dphip = fphi5[2] - fphi5[0]; }
231 else { dphip = fphi5[6] - fphi5[4]; }
234 FindInt( pl1, pl2, pl3, po2 );
235 down[i].
Set( 2, po2 );
237 pl4.
Build( O,
n1, down[i].Get( 0 ) );
238 FindInt( pl4, pl2, pl3, po1 );
239 down[i].
Set( 1, po1 );
242 pl2.
Build(
n, down[i].Get( 7 ) );
243 FindInt( pl1, pl2, pl3, po6 );
244 down[i].
Set( 6, po6 );
246 FindInt( pl4, pl2, pl3, po5 );
247 down[i].
Set( 5, po5 );
250 n2 = ( up[i].
Get( 0 ) + up[i].Get( 3 ) ) / 2;
252 pl1.
Build( O,
n1, up[i].Get( 3 ) );
253 pl2.
Build(
n, up[i].Get( 3 ) );
254 FindInt( pl1, pl2, pl3, po2 );
257 pl4.
Build( O,
n1, up[i].Get( 0 ) );
258 FindInt( pl4, pl2, pl3, po1 );
261 pl2.
Build(
n, up[i].Get( 7 ) );
262 FindInt( pl1, pl2, pl3, po6 );
265 FindInt( pl4, pl2, pl3, po5 );
269 for ( i = 0; i < 8; ++i )
271 fRing4[0].Set( i, down[0].Get( i ) );
272 fRing4[1].Set( i, up[0].Get( i ) );
273 fRing4[4].Set( i, down[1].Get( i ).rotateZ( fphi5[4] ) );
274 fRing4[5].Set( i, up[1].Get( i ).rotateZ( fphi5[4] ) );
278 dphi = fphi5[3] - fphi5[2];
281 fRing4[2].Set( 3, po3 );
284 fRing4[2].Set( 0, po0.rotateZ( dphi ) );
286 l = fRing4[2].Get( 3 ).distance( fRing4[2].Get( 0 ) ) / 2;
287 ll = sqrt( fz * fz + fr[1] * fr[1] );
288 lp = ll * flength / sqrt( ll * ll - l * l );
290 po7.setX( po7.x() + lp * sintheta1 );
291 po7.setZ( po7.z() + lp * costheta1 );
292 fRing4[2].Set( 7, po7 );
294 fRing4[2].Set( 4, po4.rotateZ( dphi ) );
296 pl1.
Build( 0, 1, 0, 0 );
297 n2 = ( fRing4[2].Get( 0 ) + fRing4[2].Get( 3 ) ) / 2;
299 pl2.
Build(
n, fRing4[2].Get( 3 ) );
302 m.setZ( fzshift + fz );
306 FindInt( pl1, pl2, pl3, po2 );
307 fRing4[2].Set( 2, po2 );
309 fRing4[2].Set( 1, po1.rotateZ( dphi ) );
311 pl2.
Build(
n, fRing4[2].Get( 7 ) );
312 FindInt( pl1, pl2, pl3, po6 );
313 fRing4[2].Set( 6, po6 );
315 fRing4[2].Set( 5, po5.rotateZ( dphi ) );
318 for ( i = 0; i < 8; ++i ) { fRing4[2].Set( i, fRing4[2].Get( i ).rotateZ( fphi5[2] ) ); }
319 for ( i = 0; i < 8; ++i )
320 { fRing4[3].Set( i, fRing4[2].Get( i ).rotateZ( fphi5[3] - fphi5[2] ) ); }
333 base3[0].setX( fr[2] );
335 base3[0].setZ( fz + fzshift );
336 for ( i = 1; i < 5; ++i ) { base3[i] = base3[0]; }
337 base3[1].rotateZ( fphi5[2] );
338 base3[2].rotateZ( fphi5[3] );
339 base3[3].rotateZ( fphi5[4] );
340 base3[4].rotateZ( fphi5[6] );
346 base2[0].setX( fr[3] );
348 base2[0].setZ( fz + fzshift );
349 for ( i = 1; i < 6; ++i )
352 base2[i].rotateZ( fphi3[i] );
359 EmcRecGeoPlane pphi[6];
360 for ( i = 0; i < 6; ++i ) { pphi[i].
Build( O,
n1, base2[i] ); }
361 EmcRecGeoPlane ptheta[4];
362 for ( i = 0; i < 4; ++i ) { ptheta[i].
Build(
n1, base3[i], base3[i + 1] ); }
363 EmcRecGeoPlane pthetap[5];
364 for ( i = 0; i < 5; ++i ) { pthetap[i].
Build(
n1, base2[i], base2[i + 1] ); }
370 nn[0] = ( base3[0] + base3[1] ) / 2 -
n1;
371 nn[1] = base3[1] -
n1;
372 nn[2] = base3[2] -
n1;
373 nn[3] = base3[3] -
n1;
374 nn[4] = ( base3[3] + base3[4] ) / 2 -
n1;
376 EmcRecGeoPlane psection[5];
377 for ( i = 0; i < 5; ++i ) { psection[i].
Build( nn[i], base3[i] ); }
379 EmcRecGeoPlane psection2[5];
381 for ( i = 0; i < 5; ++i )
384 bp[i].setX( bp[i].
x() + flength * nn[i].
x() / nn[i].mag() );
385 bp[i].setY( bp[i].y() + flength * nn[i].y() / nn[i].mag() );
386 bp[i].setZ( bp[i].z() + flength * nn[i].z() / nn[i].mag() );
387 psection2[i].
Build( nn[i], bp[i] );
390 EmcRecGeoPlane pthetatmp;
391 for ( i = 0; i < 5; ++i )
393 if ( i == 0 || i == 4 )
396 if ( i == 0 ) { pthetatmp = ptheta[0]; }
397 if ( i == 4 ) { pthetatmp = ptheta[3]; }
398 FindInt( pphi[i], pthetatmp, psection[i], po3 );
399 FindInt( pphi[i], pthetap[i], psection[i], po2 );
400 FindInt( pphi[i + 1], pthetatmp, psection[i], po0 );
401 FindInt( pphi[i + 1], pthetap[i], psection[i], po1 );
402 fRing3[i].Set( 0, po0 );
403 fRing3[i].Set( 1, po1 );
404 fRing3[i].Set( 2, po2 );
405 fRing3[i].Set( 3, po3 );
406 FindInt( pphi[i], pthetatmp, psection2[i], po7 );
407 FindInt( pphi[i], pthetap[i], psection2[i], po6 );
408 FindInt( pphi[i + 1], pthetatmp, psection2[i], po4 );
409 FindInt( pphi[i + 1], pthetap[i], psection2[i], po5 );
410 fRing3[i].Set( 4, po4 );
411 fRing3[i].Set( 5, po5 );
412 fRing3[i].Set( 6, po6 );
413 fRing3[i].Set( 7, po7 );
419 FindInt( pphi[i], ptheta[i - 1], psection[i], po4 );
420 FindInt( pphi[i], pthetap[i], psection[i], po3 );
421 FindInt( pphi[i + 1], ptheta[i], psection[i], po1 );
422 FindInt( pphi[i + 1], pthetap[i], psection[i], po2 );
423 fRing3[i].Set( 0, po0 );
424 fRing3[i].Set( 1, po1 );
425 fRing3[i].Set( 2, po2 );
426 fRing3[i].Set( 3, po3 );
427 fRing3[i].Set( 4, po4 );
429 FindInt( pphi[i], ptheta[i - 1], psection2[i], po9 );
430 FindInt( pphi[i], pthetap[i], psection2[i], po8 );
431 FindInt( pphi[i + 1], ptheta[i], psection2[i], po6 );
432 FindInt( pphi[i + 1], pthetap[i], psection2[i], po7 );
433 fRing3[i].Set( 5, po5 );
434 fRing3[i].Set( 6, po6 );
435 fRing3[i].Set( 7, po7 );
436 fRing3[i].Set( 8, po8 );
437 fRing3[i].Set( 9, po9 );
453 base1[0].setX( fr[4] );
455 base1[0].setZ( fz + fzshift );
456 for ( i = 1; i < 4; ++i ) { base1[i] = base1[0]; }
457 base1[1].rotateZ( fphi3[2] );
458 base1[2].rotateZ( fphi3[3] );
459 base1[3].rotateZ( fphi3[5] );
460 EmcRecGeoPlane ptheta1[3];
461 for ( i = 0; i < 3; ++i ) { ptheta1[i].
Build(
n1, base1[i], base1[i + 1] ); }
464 for ( i = 0; i < 5; ++i ) { nn2[i] = ( base2[i] + base2[i + 1] ) / 2 -
n1; }
465 EmcRecGeoPlane psec2[5];
466 for ( i = 0; i < 5; ++i ) { psec2[i].
Build( nn2[i], base2[i] ); }
468 EmcRecGeoPlane psec2p[5];
470 for ( i = 0; i < 5; ++i )
473 bpp[i].setX( bpp[i].
x() + flength * nn2[i].
x() / nn2[i].mag() );
474 bpp[i].setY( bpp[i].y() + flength * nn2[i].y() / nn2[i].mag() );
475 bpp[i].setZ( bpp[i].z() + flength * nn2[i].z() / nn2[i].mag() );
476 psec2p[i].
Build( nn2[i], bpp[i] );
479 EmcRecGeoPlane ptheta1tmp;
480 for ( i = 0; i < 5; ++i )
483 if ( i < 2 ) { ptheta1tmp = ptheta1[0]; }
484 if ( i == 2 ) { ptheta1tmp = ptheta1[1]; }
485 if ( i > 2 ) { ptheta1tmp = ptheta1[2]; }
487 FindInt( pphi[i], ptheta1tmp, psec2[i], po2 );
489 FindInt( pphi[i + 1], ptheta1tmp, psec2[i], po1 );
490 FindInt( pphi[i], pthetap[i], psec2p[i], po7 );
491 FindInt( pphi[i], ptheta1tmp, psec2p[i], po6 );
492 FindInt( pphi[i + 1], pthetap[i], psec2p[i], po4 );
493 FindInt( pphi[i + 1], ptheta1tmp, psec2p[i], po5 );
494 fRing2[i].Set( 0, po0 );
495 fRing2[i].Set( 1, po1 );
496 fRing2[i].Set( 2, po2 );
497 fRing2[i].Set( 3, po3 );
498 fRing2[i].Set( 4, po4 );
499 fRing2[i].Set( 5, po5 );
500 fRing2[i].Set( 6, po6 );
501 fRing2[i].Set( 7, po7 );
512 base0[0].setX( fr[5] );
514 base0[0].setZ( fz + fzshift );
515 for ( i = 1; i < 5; ++i )
518 base0[i].rotateZ( fphi1[i] );
521 EmcRecGeoPlane pphi1[5];
522 for ( i = 0; i < 5; ++i ) { pphi1[i].
Build( O,
n1, base0[i] ); }
524 EmcRecGeoPlane ptheta0[4];
525 for ( i = 0; i < 4; ++i ) { ptheta0[i].
Build(
n1, base0[i], base0[i + 1] ); }
528 nn1[0] = ( base1[0] + base1[1] ) / 2 -
n1;
529 nn1[1] = base1[1] -
n1;
530 nn1[2] = base1[2] -
n1;
531 nn1[3] = ( base1[2] + base1[3] ) / 2 -
n1;
533 EmcRecGeoPlane psec1[4];
534 for ( i = 0; i < 4; ++i ) { psec1[i].
Build( nn1[i], base1[i] ); }
536 EmcRecGeoPlane psec1p[4];
538 for ( i = 0; i < 4; ++i )
541 qq[i].setX( qq[i].
x() + flength * nn1[i].
x() / nn1[i].mag() );
542 qq[i].setY( qq[i].y() + flength * nn1[i].y() / nn1[i].mag() );
543 qq[i].setZ( qq[i].z() + flength * nn1[i].z() / nn1[i].mag() );
544 psec1p[i].
Build( nn1[i], qq[i] );
547 EmcRecGeoPlane pt1tmp;
548 for ( i = 0; i < 4; ++i )
550 if ( i == 0 || i == 3 )
553 if ( i == 0 ) { pt1tmp = ptheta1[0]; }
554 else { pt1tmp = ptheta1[2]; }
555 FindInt( pphi1[i], pt1tmp, psec1[i], po3 );
556 FindInt( pphi1[i], ptheta0[i], psec1[i], po2 );
557 FindInt( pphi1[i + 1], pt1tmp, psec1[i], po0 );
558 FindInt( pphi1[i + 1], ptheta0[i], psec1[i], po1 );
559 FindInt( pphi1[i], pt1tmp, psec1p[i], po7 );
560 FindInt( pphi1[i], ptheta0[i], psec1p[i], po6 );
561 FindInt( pphi1[i + 1], pt1tmp, psec1p[i], po4 );
562 FindInt( pphi1[i + 1], ptheta0[i], psec1p[i], po5 );
563 fRing1[i].Set( 0, po0 );
564 fRing1[i].Set( 1, po1 );
565 fRing1[i].Set( 2, po2 );
566 fRing1[i].Set( 3, po3 );
567 fRing1[i].Set( 4, po4 );
568 fRing1[i].Set( 5, po5 );
569 fRing1[i].Set( 6, po6 );
570 fRing1[i].Set( 7, po7 );
576 FindInt( pphi1[i], ptheta1[i - 1], psec1[i], po4 );
577 FindInt( pphi1[i], ptheta0[i], psec1[i], po3 );
578 FindInt( pphi1[i + 1], ptheta1[i], psec1[i], po1 );
579 FindInt( pphi1[i + 1], ptheta0[i], psec1[i], po2 );
580 fRing1[i].Set( 0, po0 );
581 fRing1[i].Set( 1, po1 );
582 fRing1[i].Set( 2, po2 );
583 fRing1[i].Set( 3, po3 );
584 fRing1[i].Set( 4, po4 );
586 FindInt( pphi1[i], ptheta1[i - 1], psec1p[i], po9 );
587 FindInt( pphi1[i], ptheta0[i], psec1p[i], po8 );
588 FindInt( pphi1[i + 1], ptheta1[i], psec1p[i], po6 );
589 FindInt( pphi1[i + 1], ptheta0[i], psec1p[i], po7 );
590 fRing1[i].Set( 5, po5 );
591 fRing1[i].Set( 6, po6 );
592 fRing1[i].Set( 7, po7 );
593 fRing1[i].Set( 8, po8 );
594 fRing1[i].Set( 9, po9 );
605 basem1[0].setX( fr[6] );
607 basem1[0].setZ( fz + fzshift );
608 for ( i = 1; i < 5; ++i )
610 basem1[i] = basem1[0];
611 basem1[i].rotateZ( fphi1[i] );
614 EmcRecGeoPlane pthetam1[4];
615 for ( i = 0; i < 4; ++i ) { pthetam1[i].
Build(
n1, basem1[i], basem1[i + 1] ); }
618 for ( i = 0; i < 4; ++i ) { nn0[i] = ( base0[i] + base0[i + 1] ) / 2 -
n1; }
620 EmcRecGeoPlane psec0[4];
621 for ( i = 0; i < 4; ++i ) { psec0[i].
Build( nn0[i], base0[i] ); }
623 EmcRecGeoPlane psec0p[4];
625 for ( i = 0; i < 4; ++i )
628 qq0[i].setX( qq0[i].
x() + flength * nn0[i].
x() / nn0[i].mag() );
629 qq0[i].setY( qq0[i].y() + flength * nn0[i].y() / nn0[i].mag() );
630 qq0[i].setZ( qq0[i].z() + flength * nn0[i].z() / nn0[i].mag() );
631 psec0p[i].
Build( nn0[i], qq0[i] );
634 for ( i = 0; i < 4; ++i )
638 FindInt( pphi1[i], pthetam1[i], psec0[i], po2 );
640 FindInt( pphi1[i + 1], pthetam1[i], psec0[i], po1 );
641 FindInt( pphi1[i], ptheta0[i], psec0p[i], po7 );
642 FindInt( pphi1[i], pthetam1[i], psec0p[i], po6 );
643 FindInt( pphi1[i + 1], ptheta0[i], psec0p[i], po4 );
644 FindInt( pphi1[i + 1], pthetam1[i], psec0p[i], po5 );
645 fRing0[i].Set( 0, po0 );
646 fRing0[i].Set( 1, po1 );
647 fRing0[i].Set( 2, po2 );
648 fRing0[i].Set( 3, po3 );
649 fRing0[i].Set( 4, po4 );
650 fRing0[i].Set( 5, po5 );
651 fRing0[i].Set( 6, po6 );
652 fRing0[i].Set( 7, po7 );
660 for ( i = 0; i < 6; ++i )
664 fCrystal[0][0][i] = fRing0[i];
665 fCrystal[0][1][i] = fRing1[i];
669 fCrystal[0][2][i] = fRing2[i];
670 fCrystal[0][3][i] = fRing3[i];
672 fCrystal[0][4][i] = fRing4[i];
673 fCrystal[0][5][i] = fRing5[i];
677void EmcRecEndCapGeo::CalculateStandardSector2() {
678 EmcRecCrystal edge[6];
682 for ( i = 1; i < 6; ++i )
684 fRing5p[i] = fRing5[i];
685 fRing4p[i] = fRing4[i];
687 for ( i = 1; i < 5; ++i )
689 fRing3p[i] = fRing3[i];
690 fRing2p[i] = fRing2[i];
692 for ( i = 1; i < 4; ++i )
694 fRing1p[i] = fRing1[i];
695 fRing0p[i] = fRing0[i];
705 EmcRecGeoPlane p10mm;
706 p10mm.
Build( 0, 1, 0, -10 );
708 EmcRecGeoPlane sec1, sec2;
713 for ( i = 0; i < 6; ++i )
715 sec1.
Build( edge[i].Get( 0 ), edge[i].Get( 1 ), edge[i].Get( 2 ) );
716 sec2.
Build( edge[i].Get( 4 ), edge[i].Get( 5 ), edge[i].Get( 6 ) );
717 theta1.Build( edge[i].Get( 2 ), edge[i].Get( 5 ), edge[i].Get( 6 ) );
718 theta2.Build( edge[i].Get( 3 ), edge[i].Get( 4 ), edge[i].Get( 7 ) );
720 FindInt( sec1,
theta1, p10mm, po2 );
721 FindInt( sec1,
theta2, p10mm, po3 );
722 FindInt( sec2,
theta1, p10mm, po6 );
723 FindInt( sec2,
theta2, p10mm, po7 );
725 edge[i].
Set( 2, po2 );
726 edge[i].
Set( 3, po3 );
727 edge[i].
Set( 6, po6 );
728 edge[i].
Set( 7, po7 );
731 fRing5p[0] = edge[5];
732 fRing4p[0] = edge[4];
733 fRing3p[0] = edge[3];
734 fRing2p[0] = edge[2];
735 fRing1p[0] = edge[1];
736 fRing0p[0] = edge[0];
738 double pio2 = 3.14159265358979 / 2;
741 for ( i = 0; i < 6; ++i )
743 for ( j = 0; j < 10; ++j )
745 fRing5p[i].Set( j, fRing5p[i].Get( j ).rotateZ( pio2 ) );
746 fRing4p[i].Set( j, fRing4p[i].Get( j ).rotateZ( pio2 ) );
749 for ( i = 0; i < 5; ++i )
751 for ( j = 0; j < 10; ++j )
753 fRing3p[i].Set( j, fRing3p[i].Get( j ).rotateZ( pio2 ) );
754 fRing2p[i].Set( j, fRing2p[i].Get( j ).rotateZ( pio2 ) );
757 for ( i = 0; i < 4; ++i )
759 for ( j = 0; j < 10; ++j )
761 fRing1p[i].Set( j, fRing1p[i].Get( j ).rotateZ( pio2 ) );
762 fRing0p[i].Set( j, fRing0p[i].Get( j ).rotateZ( pio2 ) );
776 for ( i = 0; i < 6; ++i )
780 fCrystal[1][0][i] = fRing0p[i];
781 fCrystal[1][1][i] = fRing1p[i];
785 fCrystal[1][2][i] = fRing2p[i];
786 fCrystal[1][3][i] = fRing3p[i];
788 fCrystal[1][4][i] = fRing4p[i];
789 fCrystal[1][5][i] = fRing5p[i];
793void EmcRecEndCapGeo::FillCCenterVector() {
795 unsigned int phi, phimax, theta;
801 module = EmcID::getENDCAP_EAST();
802 for ( theta = 0; theta <= 5; ++theta )
805 for ( phi = 0; phi <= phimax; ++phi )
811 fCCenter.push_back( aCenter );
812 fCFrontCenter.push_back( aFrontCenter );
816 module = EmcID::getENDCAP_WEST();
817 for ( theta = 0; theta <= 5; ++theta )
820 for ( phi = 0; phi <= phimax; ++phi )
826 fCCenter.push_back( aCenter );
827 fCFrontCenter.push_back( aFrontCenter );
839 unsigned int phiMax, phiMax16;
840 unsigned int phiQuotient, phiRemainder;
843 phiMax16 = ( phiMax + 1 ) / 16;
844 phiQuotient = (
unsigned int)( phi / phiMax16 );
845 phiRemainder = phi % phiMax16;
851 if ( phiQuotient != 3 && phiQuotient != 4 && phiQuotient != 11 && phiQuotient != 12 )
853 cry = fCrystal[0][theta][phiRemainder];
854 for ( i = 0; i < 10; ++i )
855 { cry.
Set( i, cry.
Get( i ).rotateZ( phiQuotient * fphi5[6] ) ); }
859 if ( phiQuotient == 4 ) { cry = fCrystal[1][theta][phiRemainder]; }
860 if ( phiQuotient == 3 )
862 cry = fCrystal[1][theta][phiMax16 - 1 - phiRemainder];
863 for ( i = 0; i < 10; ++i ) { cry.
SetX( i, -cry.
Get( i ).x() ); }
865 if ( phiQuotient == 11 )
867 cry = fCrystal[1][theta][phiMax16 - 1 - phiRemainder];
868 for ( i = 0; i < 10; ++i ) { cry.
SetY( i, -cry.
Get( i ).y() ); }
870 if ( phiQuotient == 12 )
872 cry = fCrystal[1][theta][phiRemainder];
873 for ( i = 0; i < 10; ++i )
875 cry.
SetX( i, -cry.
Get( i ).x() );
876 cry.
SetY( i, -cry.
Get( i ).y() );
885 unsigned int phiMax2 = ( phiMax + 1 ) / 2;
886 if ( phi < phiMax2 ) { phipp = phiMax2 - 1 - phi; }
887 else { phipp = phiMax + phiMax2 - phi; }
890 for ( i = 0; i < 10; ++i )
892 cry.
SetX( i, -cry.
Get( i ).x() );
893 cry.
SetZ( i, -cry.
Get( i ).z() );
901 unsigned int module, theta, phi;
904 module = EmcID::barrel_ec( id );
921 return fCCenter[i - 1];
925 unsigned int module, theta, phi;
928 module = EmcID::barrel_ec( id );
945 return fCFrontCenter[i - 1];
HepGeom::Point3D< double > HepPoint3D
HepGeom::Point3D< double > HepPoint3D
static Identifier crystal_id(const unsigned int barrel_ec, const unsigned int theta_module, const unsigned int phi_module)
For a single crystal.
static unsigned int getENDCAP_WEST()
static unsigned int barrel_ec(const Identifier &id)
Values of different levels (failure returns 0).
static unsigned int getENDCAP_EAST()
static unsigned int theta_module(const Identifier &id)
static unsigned int getPHI_ENDCAP_MAX(const unsigned int theta)
static unsigned int phi_module(const Identifier &id)
HepPoint3D Center() const
void SetY(int index, double value)
HepPoint3D Get(int index) const
void SetX(int index, double value)
HepPoint3D FrontCenter() const
void SetZ(int index, double value)
void Set(int index, const HepPoint3D &aPoint)
EmcRecCrystal GetCrystal(const Identifier &id) const
HepPoint3D GetCCenter(const Identifier &id) const
HepPoint3D GetCFrontCenter(const Identifier &id) const
void Build(double a=0, double b=0, double c=0, double d=0)