12 ParameterInitialize();
13 CalculateStandardSector1();
14 CalculateStandardSector2();
22void EmcRecEndCapGeo::ParameterInitialize()
50 fphi5[i]=fphi5[i]*3.14159265358979/180;
61 fphi3[i]=fphi3[i]*3.14159265358979/180;
71 fphi1[i]=fphi1[i]*3.14159265358979/180;
75void EmcRecEndCapGeo::CalculateStandardSector1()
79 HepPoint3D po0,po1,po2,po3,po4,po5,po6,po7,po8,po9;
81 double tantheta1,costheta1,sintheta1;
84 O.setX(0); O.setY(0); O.setZ(0);
85 n1.setX(0);
n1.setY(0);
n1.setZ(fzshift);
90 double dphi1=fphi5[1]-fphi5[0];
91 double dphi2=fphi5[2]-fphi5[1];
100 costheta1=1/sqrt(1+tantheta1*tantheta1);
101 sintheta1=costheta1*tantheta1;
116 fRing5[i].
Set(3,po3);
119 fRing5[i].
Set(0,po0.rotateZ(dphi));
121 l=fRing5[i].
Get(3).distance(fRing5[i].Get(0))/2;
122 ll=sqrt(fz*fz+fr[0]*fr[0]);
123 lp=ll*flength/sqrt(ll*ll-l*l);
125 po7.setX(po7.x()+lp*sintheta1);
126 po7.setZ(po7.z()+lp*costheta1);
127 fRing5[i].
Set(7,po7);
129 fRing5[i].
Set(4,po4.rotateZ(dphi));
132 n2=(fRing5[i].
Get(0)+fRing5[i].
Get(3))/2;
134 pl2.
Build(n,fRing5[i].Get(3));
141 FindInt(pl1,pl2,pl3,po2);
143 fRing5[i].
Set(2,po2);
145 fRing5[i].
Set(1,po1.rotateZ(dphi));
147 pl2.
Build(n,fRing5[i].Get(7));
148 FindInt(pl1,pl2,pl3,po6);
149 fRing5[i].
Set(6,po6);
151 fRing5[i].
Set(5,po5.rotateZ(dphi));
156 fRing5[1].
Set(i,fRing5[1].Get(i).rotateZ(dphi1));
162 fRing5[i].
Set(j,fRing5[1].Get(j).rotateZ(fphi5[i]-fphi5[1]));
181 dphi1=fphi5[1]-fphi5[0];
182 dphi2=fphi5[2]-fphi5[1];
185 costheta1=1/sqrt(1+tantheta1*tantheta1);
186 sintheta1=costheta1*tantheta1;
205 down[i].
Set(0,po0.rotateZ(dphi));
210 up[i].
Set(0,po0.rotateZ(dphi2));
212 l=down[i].
Get(3).distance(down[i].Get(0))/2;
213 ll=sqrt(fz*fz+fr[1]*fr[1]);
214 lp=ll*flength/sqrt(ll*ll-l*l);
216 po7.setX(po7.x()+lp*sintheta1);
217 po7.setZ(po7.z()+lp*costheta1);
220 down[i].
Set(4,po4.rotateZ(dphi));
222 l=up[i].
Get(3).distance(up[i].Get(0))/2;
223 ll=sqrt(fz*fz+fr[1]*fr[1]);
224 lp=ll*flength/sqrt(ll*ll-l*l);
226 po7.setX(po7.x()+lp*sintheta1);
227 po7.setZ(po7.z()+lp*costheta1);
230 up[i].
Set(4,po4.rotateZ(dphi2));
232 up[i].
Set(0,up[i].Get(0).rotateZ(dphi));
233 up[i].
Set(3,up[i].Get(3).rotateZ(dphi));
234 up[i].
Set(4,up[i].Get(4).rotateZ(dphi));
235 up[i].
Set(7,up[i].Get(7).rotateZ(dphi));
240 n2=(down[i].
Get(0)+down[i].
Get(3))/2;
242 pl2.
Build(n,down[i].Get(3));
248 dphip=fphi5[2]-fphi5[0];
250 dphip=fphi5[6]-fphi5[4];
254 FindInt(pl1,pl2,pl3,po2);
257 pl4.
Build(O,
n1,down[i].Get(0));
258 FindInt(pl4,pl2,pl3,po1);
262 pl2.
Build(n,down[i].Get(7));
263 FindInt(pl1,pl2,pl3,po6);
266 FindInt(pl4,pl2,pl3,po5);
273 pl2.
Build(n,up[i].Get(3));
274 FindInt(pl1,pl2,pl3,po2);
278 FindInt(pl4,pl2,pl3,po1);
281 pl2.
Build(n,up[i].Get(7));
282 FindInt(pl1,pl2,pl3,po6);
285 FindInt(pl4,pl2,pl3,po5);
291 fRing4[0].
Set(i,down[0].Get(i));
292 fRing4[1].
Set(i,up[0].Get(i));
293 fRing4[4].
Set(i,down[1].Get(i).rotateZ(fphi5[4]));
294 fRing4[5].
Set(i,up[1].Get(i).rotateZ(fphi5[4]));
298 dphi=fphi5[3]-fphi5[2];
301 fRing4[2].
Set(3,po3);
304 fRing4[2].
Set(0,po0.rotateZ(dphi));
306 l=fRing4[2].
Get(3).distance(fRing4[2].Get(0))/2;
307 ll=sqrt(fz*fz+fr[1]*fr[1]);
308 lp=ll*flength/sqrt(ll*ll-l*l);
310 po7.setX(po7.x()+lp*sintheta1);
311 po7.setZ(po7.z()+lp*costheta1);
312 fRing4[2].
Set(7,po7);
314 fRing4[2].
Set(4,po4.rotateZ(dphi));
317 n2=(fRing4[2].
Get(0)+fRing4[2].
Get(3))/2;
319 pl2.
Build(n,fRing4[2].Get(3));
326 FindInt(pl1,pl2,pl3,po2);
327 fRing4[2].
Set(2,po2);
329 fRing4[2].
Set(1,po1.rotateZ(dphi));
331 pl2.
Build(n,fRing4[2].Get(7));
332 FindInt(pl1,pl2,pl3,po6);
333 fRing4[2].
Set(6,po6);
335 fRing4[2].
Set(5,po5.rotateZ(dphi));
339 fRing4[2].
Set(i,fRing4[2].Get(i).rotateZ(fphi5[2]));
342 fRing4[3].
Set(i,fRing4[2].Get(i).rotateZ(fphi5[3]-fphi5[2]));
356 base3[0].setX(fr[2]); base3[0].setY(0); base3[0].setZ(fz+fzshift);
360 base3[1].rotateZ(fphi5[2]);
361 base3[2].rotateZ(fphi5[3]);
362 base3[3].rotateZ(fphi5[4]);
363 base3[4].rotateZ(fphi5[6]);
369 base2[0].setX(fr[3]); base2[0].setY(0); base2[0].setZ(fz+fzshift);
372 base2[i].rotateZ(fphi3[i]);
385 ptheta[i].
Build(
n1,base3[i],base3[i+1]);
389 pthetap[i].
Build(
n1,base2[i],base2[i+1]);
396 nn[0]=(base3[0]+base3[1])/2-
n1;
400 nn[4]=(base3[3]+base3[4])/2-
n1;
404 psection[i].
Build(nn[i],base3[i]);
411 bp[i].setX(bp[i].
x()+flength*nn[i].x()/nn[i].mag());
412 bp[i].setY(bp[i].
y()+flength*nn[i].y()/nn[i].mag());
413 bp[i].setZ(bp[i].z()+flength*nn[i].z()/nn[i].mag());
414 psection2[i].
Build(nn[i],bp[i]);
427 FindInt(pphi[i],pthetatmp,psection[i],po3);
428 FindInt(pphi[i],pthetap[i],psection[i],po2);
429 FindInt(pphi[i+1],pthetatmp,psection[i],po0);
430 FindInt(pphi[i+1],pthetap[i],psection[i],po1);
431 fRing3[i].
Set(0,po0);
432 fRing3[i].
Set(1,po1);
433 fRing3[i].
Set(2,po2);
434 fRing3[i].
Set(3,po3);
435 FindInt(pphi[i],pthetatmp,psection2[i],po7);
436 FindInt(pphi[i],pthetap[i],psection2[i],po6);
437 FindInt(pphi[i+1],pthetatmp,psection2[i],po4);
438 FindInt(pphi[i+1],pthetap[i],psection2[i],po5);
439 fRing3[i].
Set(4,po4);
440 fRing3[i].
Set(5,po5);
441 fRing3[i].
Set(6,po6);
442 fRing3[i].
Set(7,po7);
446 FindInt(pphi[i],ptheta[i-1],psection[i],po4);
447 FindInt(pphi[i],pthetap[i],psection[i],po3);
448 FindInt(pphi[i+1],ptheta[i],psection[i],po1);
449 FindInt(pphi[i+1],pthetap[i],psection[i],po2);
450 fRing3[i].
Set(0,po0);
451 fRing3[i].
Set(1,po1);
452 fRing3[i].
Set(2,po2);
453 fRing3[i].
Set(3,po3);
454 fRing3[i].
Set(4,po4);
456 FindInt(pphi[i],ptheta[i-1],psection2[i],po9);
457 FindInt(pphi[i],pthetap[i],psection2[i],po8);
458 FindInt(pphi[i+1],ptheta[i],psection2[i],po6);
459 FindInt(pphi[i+1],pthetap[i],psection2[i],po7);
460 fRing3[i].
Set(5,po5);
461 fRing3[i].
Set(6,po6);
462 fRing3[i].
Set(7,po7);
463 fRing3[i].
Set(8,po8);
464 fRing3[i].
Set(9,po9);
480 base1[0].setX(fr[4]); base1[0].setY(0); base1[0].setZ(fz+fzshift);
484 base1[1].rotateZ(fphi3[2]);
485 base1[2].rotateZ(fphi3[3]);
486 base1[3].rotateZ(fphi3[5]);
489 ptheta1[i].
Build(
n1,base1[i],base1[i+1]);
494 nn2[i]=(base2[i]+base2[i+1])/2-
n1;
498 psec2[i].
Build(nn2[i],base2[i]);
505 bpp[i].setX(bpp[i].
x()+flength*nn2[i].x()/nn2[i].mag());
506 bpp[i].setY(bpp[i].
y()+flength*nn2[i].y()/nn2[i].mag());
507 bpp[i].setZ(bpp[i].z()+flength*nn2[i].z()/nn2[i].mag());
508 psec2p[i].
Build(nn2[i],bpp[i]);
515 ptheta1tmp=ptheta1[0];
518 ptheta1tmp=ptheta1[1];
521 ptheta1tmp=ptheta1[2];
524 FindInt(pphi[i],ptheta1tmp,psec2[i],po2);
526 FindInt(pphi[i+1],ptheta1tmp,psec2[i],po1);
527 FindInt(pphi[i],pthetap[i],psec2p[i],po7);
528 FindInt(pphi[i],ptheta1tmp,psec2p[i],po6);
529 FindInt(pphi[i+1],pthetap[i],psec2p[i],po4);
530 FindInt(pphi[i+1],ptheta1tmp,psec2p[i],po5);
531 fRing2[i].
Set(0,po0);
532 fRing2[i].
Set(1,po1);
533 fRing2[i].
Set(2,po2);
534 fRing2[i].
Set(3,po3);
535 fRing2[i].
Set(4,po4);
536 fRing2[i].
Set(5,po5);
537 fRing2[i].
Set(6,po6);
538 fRing2[i].
Set(7,po7);
549 base0[0].setX(fr[5]); base0[0].setY(0); base0[0].setZ(fz+fzshift);
552 base0[i].rotateZ(fphi1[i]);
562 ptheta0[i].
Build(
n1,base0[i],base0[i+1]);
566 nn1[0]=(base1[0]+base1[1])/2-
n1;
569 nn1[3]=(base1[2]+base1[3])/2-
n1;
573 psec1[i].
Build(nn1[i],base1[i]);
580 qq[i].setX(qq[i].
x()+flength*nn1[i].x()/nn1[i].mag());
581 qq[i].setY(qq[i].
y()+flength*nn1[i].y()/nn1[i].mag());
582 qq[i].setZ(qq[i].z()+flength*nn1[i].z()/nn1[i].mag());
583 psec1p[i].
Build(nn1[i],qq[i]);
595 FindInt(pphi1[i],pt1tmp,psec1[i],po3);
596 FindInt(pphi1[i],ptheta0[i],psec1[i],po2);
597 FindInt(pphi1[i+1],pt1tmp,psec1[i],po0);
598 FindInt(pphi1[i+1],ptheta0[i],psec1[i],po1);
599 FindInt(pphi1[i],pt1tmp,psec1p[i],po7);
600 FindInt(pphi1[i],ptheta0[i],psec1p[i],po6);
601 FindInt(pphi1[i+1],pt1tmp,psec1p[i],po4);
602 FindInt(pphi1[i+1],ptheta0[i],psec1p[i],po5);
603 fRing1[i].
Set(0,po0);
604 fRing1[i].
Set(1,po1);
605 fRing1[i].
Set(2,po2);
606 fRing1[i].
Set(3,po3);
607 fRing1[i].
Set(4,po4);
608 fRing1[i].
Set(5,po5);
609 fRing1[i].
Set(6,po6);
610 fRing1[i].
Set(7,po7);
614 FindInt(pphi1[i],ptheta1[i-1],psec1[i],po4);
615 FindInt(pphi1[i],ptheta0[i],psec1[i],po3);
616 FindInt(pphi1[i+1],ptheta1[i],psec1[i],po1);
617 FindInt(pphi1[i+1],ptheta0[i],psec1[i],po2);
618 fRing1[i].
Set(0,po0);
619 fRing1[i].
Set(1,po1);
620 fRing1[i].
Set(2,po2);
621 fRing1[i].
Set(3,po3);
622 fRing1[i].
Set(4,po4);
624 FindInt(pphi1[i],ptheta1[i-1],psec1p[i],po9);
625 FindInt(pphi1[i],ptheta0[i],psec1p[i],po8);
626 FindInt(pphi1[i+1],ptheta1[i],psec1p[i],po6);
627 FindInt(pphi1[i+1],ptheta0[i],psec1p[i],po7);
628 fRing1[i].
Set(5,po5);
629 fRing1[i].
Set(6,po6);
630 fRing1[i].
Set(7,po7);
631 fRing1[i].
Set(8,po8);
632 fRing1[i].
Set(9,po9);
643 basem1[0].setX(fr[6]); basem1[0].setY(0); basem1[0].setZ(fz+fzshift);
646 basem1[i].rotateZ(fphi1[i]);
651 pthetam1[i].
Build(
n1,basem1[i],basem1[i+1]);
656 nn0[i]=(base0[i]+base0[i+1])/2-
n1;
661 psec0[i].
Build(nn0[i],base0[i]);
668 qq0[i].setX(qq0[i].
x()+flength*nn0[i].x()/nn0[i].mag());
669 qq0[i].setY(qq0[i].
y()+flength*nn0[i].y()/nn0[i].mag());
670 qq0[i].setZ(qq0[i].z()+flength*nn0[i].z()/nn0[i].mag());
671 psec0p[i].
Build(nn0[i],qq0[i]);
677 FindInt(pphi1[i],pthetam1[i],psec0[i],po2);
679 FindInt(pphi1[i+1],pthetam1[i],psec0[i],po1);
680 FindInt(pphi1[i],ptheta0[i],psec0p[i],po7);
681 FindInt(pphi1[i],pthetam1[i],psec0p[i],po6);
682 FindInt(pphi1[i+1],ptheta0[i],psec0p[i],po4);
683 FindInt(pphi1[i+1],pthetam1[i],psec0p[i],po5);
684 fRing0[i].
Set(0,po0);
685 fRing0[i].
Set(1,po1);
686 fRing0[i].
Set(2,po2);
687 fRing0[i].
Set(3,po3);
688 fRing0[i].
Set(4,po4);
689 fRing0[i].
Set(5,po5);
690 fRing0[i].
Set(6,po6);
691 fRing0[i].
Set(7,po7);
701 fCrystal[0][0][i]=fRing0[i];
702 fCrystal[0][1][i]=fRing1[i];
705 fCrystal[0][2][i]=fRing2[i];
706 fCrystal[0][3][i]=fRing3[i];
708 fCrystal[0][4][i]=fRing4[i];
709 fCrystal[0][5][i]=fRing5[i];
713void EmcRecEndCapGeo::CalculateStandardSector2()
720 fRing5p[i]=fRing5[i];
721 fRing4p[i]=fRing4[i];
724 fRing3p[i]=fRing3[i];
725 fRing2p[i]=fRing2[i];
728 fRing1p[i]=fRing1[i];
729 fRing0p[i]=fRing0[i];
740 p10mm.
Build(0,1,0,-10);
748 sec1.
Build(edge[i].Get(0),edge[i].Get(1),edge[i].Get(2));
749 sec2.
Build(edge[i].Get(4),edge[i].Get(5),edge[i].Get(6));
750 theta1.Build(edge[i].Get(2),edge[i].Get(5),edge[i].Get(6));
751 theta2.Build(edge[i].Get(3),edge[i].Get(4),edge[i].Get(7));
753 FindInt(sec1,
theta1,p10mm,po2);
754 FindInt(sec1,
theta2,p10mm,po3);
755 FindInt(sec2,
theta1,p10mm,po6);
756 FindInt(sec2,
theta2,p10mm,po7);
771 double pio2=3.14159265358979/2;
776 fRing5p[i].
Set(j,fRing5p[i].Get(j).rotateZ(pio2));
777 fRing4p[i].
Set(j,fRing4p[i].Get(j).rotateZ(pio2));
782 fRing3p[i].
Set(j,fRing3p[i].Get(j).rotateZ(pio2));
783 fRing2p[i].
Set(j,fRing2p[i].Get(j).rotateZ(pio2));
788 fRing1p[i].
Set(j,fRing1p[i].Get(j).rotateZ(pio2));
789 fRing0p[i].
Set(j,fRing0p[i].Get(j).rotateZ(pio2));
805 fCrystal[1][0][i]=fRing0p[i];
806 fCrystal[1][1][i]=fRing1p[i];
809 fCrystal[1][2][i]=fRing2p[i];
810 fCrystal[1][3][i]=fRing3p[i];
812 fCrystal[1][4][i]=fRing4p[i];
813 fCrystal[1][5][i]=fRing5p[i];
817void EmcRecEndCapGeo::FillCCenterVector()
820 unsigned int phi,phimax,theta;
827 for(theta=0;theta<=5;++theta) {
829 for(phi=0;phi<=phimax;++phi) {
834 fCCenter.push_back(aCenter);
835 fCFrontCenter.push_back(aFrontCenter);
840 for(theta=0;theta<=5;++theta) {
842 for(phi=0;phi<=phimax;++phi) {
847 fCCenter.push_back(aCenter);
848 fCFrontCenter.push_back(aFrontCenter);
861 unsigned int phiMax,phiMax16;
862 unsigned int phiQuotient,phiRemainder;
865 phiMax16=(phiMax+1)/16;
866 phiQuotient=(
unsigned int)(phi/phiMax16);
867 phiRemainder=phi%phiMax16;
872 if(phiQuotient!=3&&phiQuotient!=4&&
873 phiQuotient!=11&&phiQuotient!=12) {
874 cry=fCrystal[0][theta][phiRemainder];
876 cry.
Set(i,cry.
Get(i).rotateZ(phiQuotient*fphi5[6]));
880 cry=fCrystal[1][theta][phiRemainder];
883 cry=fCrystal[1][theta][phiMax16-1-phiRemainder];
888 if(phiQuotient==11) {
889 cry=fCrystal[1][theta][phiMax16-1-phiRemainder];
894 if(phiQuotient==12) {
895 cry=fCrystal[1][theta][phiRemainder];
906 unsigned int phiMax2=(phiMax+1)/2;
910 phipp=phiMax+phiMax2-phi;
925 unsigned int module,theta,phi;
934 for(j=0;j<theta;++j) {
942 for(j=0;j<theta;++j) {
948 return fCCenter[i-1];
953 unsigned int module,theta,phi;
962 for(j=0;j<theta;++j) {
970 for(j=0;j<theta;++j) {
976 return fCFrontCenter[i-1];
991 A(1,1)=p1.a(); A(1,2)=p1.b(); A(1,3)=p1.c(); B(1)=-p1.d();
992 A(2,1)=p2.a(); A(2,2)=p2.b(); A(2,3)=p2.c(); B(2)=-p2.d();
993 A(3,1)=p3.a(); A(3,2)=p3.b(); A(3,3)=p3.c(); B(3)=-p3.d();
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)