Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

EmcRecEndCapGeo Class Reference

#include <EmcRecEndCapGeo.h>

List of all members.

Public Member Functions

 EmcRecEndCapGeo ()
 EmcRecEndCapGeo ()
HepPoint3D GetCCenter (const Identifier &id) const
HepPoint3D GetCCenter (const Identifier &id) const
HepPoint3D GetCFrontCenter (const Identifier &id) const
HepPoint3D GetCFrontCenter (const Identifier &id) const
EmcRecCrystal GetCrystal (const Identifier &id) const
EmcRecCrystal GetCrystal (const Identifier &id) const
 ~EmcRecEndCapGeo ()
 ~EmcRecEndCapGeo ()

Private Member Functions

void CalculateStandardSector1 ()
void CalculateStandardSector1 ()
void CalculateStandardSector2 ()
void CalculateStandardSector2 ()
void FillCCenterVector ()
void FillCCenterVector ()
void FindInt (const EmcRecGeoPlane &p1, const EmcRecGeoPlane &p2, const EmcRecGeoPlane &p3, HepPoint3D &p)
void FindInt (const EmcRecGeoPlane &p1, const EmcRecGeoPlane &p2, const EmcRecGeoPlane &p3, HepPoint3D &p)
void ParameterInitialize ()
void ParameterInitialize ()

Private Attributes

vector< HepPoint3DfCCenter
 vector of each crystal's center
vector< HepPoint3DfCCenter
 vector of each crystal's center
vector< HepPoint3DfCFrontCenter
vector< HepPoint3DfCFrontCenter
EmcRecCrystal fCrystal [2][6][6]
 put them together for easy reference
double flength
double fphi1 [5]
double fphi3 [6]
double fphi5 [7]
double fr [7]
EmcRecCrystal fRing0 [4]
EmcRecCrystal fRing0p [4]
EmcRecCrystal fRing1 [4]
EmcRecCrystal fRing1p [4]
EmcRecCrystal fRing2 [5]
EmcRecCrystal fRing2p [5]
EmcRecCrystal fRing3 [5]
EmcRecCrystal fRing3p [5]
EmcRecCrystal fRing4 [6]
EmcRecCrystal fRing4p [6]
EmcRecCrystal fRing5 [6]
EmcRecCrystal fRing5p [6]
double fz
double fzshift


Constructor & Destructor Documentation

EmcRecEndCapGeo::EmcRecEndCapGeo  ) 
 

00011 {
00012    ParameterInitialize();
00013    CalculateStandardSector1();
00014    CalculateStandardSector2();
00015    FillCCenterVector(); 
00016 }

EmcRecEndCapGeo::~EmcRecEndCapGeo  ) 
 

00019 {
00020 }

EmcRecEndCapGeo::EmcRecEndCapGeo  ) 
 

EmcRecEndCapGeo::~EmcRecEndCapGeo  ) 
 


Member Function Documentation

void EmcRecEndCapGeo::CalculateStandardSector1  )  [private]
 

void EmcRecEndCapGeo::CalculateStandardSector1  )  [private]
 

Finally, Ring 3 is done. The maximum descripancy is less than 1mm. However, it's hard to know where they from. There are too many approximation in structure design. It's already less than the tolerance of production. Then, omit them!

Get into Ring2

Ring2 is done. It seems a little easier.

************* Ring1 *************

Check it out!

Last ring! Ring0

Sector1 is finished. !!!

00076 {
00077    int i,j;
00078    EmcRecGeoPlane pl1,pl2,pl3;
00079    HepPoint3D po0,po1,po2,po3,po4,po5,po6,po7,po8,po9;
00080    
00081    double tantheta1,costheta1,sintheta1;
00082 
00083    HepPoint3D O,n1;               // very important
00084    O.setX(0); O.setY(0); O.setZ(0); 
00085    n1.setX(0); n1.setY(0); n1.setZ(fzshift);
00086    
00087    // ******** Ring 5 ********
00088    HepPoint3D t,n2,n;
00089    HepPoint3D w,m;
00090    double dphi1=fphi5[1]-fphi5[0];
00091    double dphi2=fphi5[2]-fphi5[1];   
00092    double dphi;
00093    double l,ll,lp;
00094    
00095    t.setX(fr[0]);
00096    t.setY(0);
00097    t.setZ(fzshift+fz);
00098 
00099    tantheta1=fr[0]/fz;
00100    costheta1=1/sqrt(1+tantheta1*tantheta1);
00101    sintheta1=costheta1*tantheta1;
00102    
00103    for(i=0;i<6;++i){
00104       fRing5[i].Type(EmcRecCrystal::SixPlane());
00105    }
00106    
00107    // No. 0,1'
00108    for(i=0;i<2;++i) {
00109       if(i==0) { 
00110          dphi=dphi1; 
00111       } else {
00112          dphi=dphi2;
00113       }
00114       // first, point 3
00115       po3=t;
00116       fRing5[i].Set(3,po3);
00117       // then, point 0
00118       po0=t;                
00119       fRing5[i].Set(0,po0.rotateZ(dphi));
00120       // point 7 and point 4
00121       l=fRing5[i].Get(3).distance(fRing5[i].Get(0))/2;
00122       ll=sqrt(fz*fz+fr[0]*fr[0]);
00123       lp=ll*flength/sqrt(ll*ll-l*l);
00124       po7=t;
00125       po7.setX(po7.x()+lp*sintheta1);
00126       po7.setZ(po7.z()+lp*costheta1);
00127       fRing5[i].Set(7,po7);
00128       po4=po7;
00129       fRing5[i].Set(4,po4.rotateZ(dphi));
00130       // point 1,2
00131       pl1.Build(0,1,0,0);
00132       n2=(fRing5[i].Get(0)+fRing5[i].Get(3))/2;
00133       n=n2-n1;
00134       pl2.Build(n,fRing5[i].Get(3));
00135       m.setX(fr[1]);
00136       m.setY(0);
00137       m.setZ(fzshift+fz);
00138       w=m;
00139       w.rotateZ(dphi);
00140       pl3.Build(n1,m,w);
00141       FindInt(pl1,pl2,pl3,po2);
00142       
00143       fRing5[i].Set(2,po2);
00144       po1=po2;
00145       fRing5[i].Set(1,po1.rotateZ(dphi));
00146       // point 6,5
00147       pl2.Build(n,fRing5[i].Get(7));
00148       FindInt(pl1,pl2,pl3,po6);
00149       fRing5[i].Set(6,po6);
00150       po5=po6;
00151       fRing5[i].Set(5,po5.rotateZ(dphi));
00152    }
00153    
00154    // No. 1
00155    for(i=0;i<8;++i) {
00156       fRing5[1].Set(i,fRing5[1].Get(i).rotateZ(dphi1));
00157    }
00158    
00159    //===== No. 2--5 =====
00160    for(i=2;i<6;++i) {
00161       for(j=0;j<8;++j) {
00162          fRing5[i].Set(j,fRing5[1].Get(j).rotateZ(fphi5[i]-fphi5[1]));
00163       }
00164    }
00165    // Finally, ring 5 is done. 
00166    // Check for ring 5
00167 //   for(i=0;i<6;++i) {      
00168 //      cout<<fRing5[i]<<endl;
00169 //      fRing5[i].EndCapCheckout();
00170 //   }
00171 
00172    // ******** Ring 4 ********
00173    EmcRecGeoPlane pl4,pl5,pl6;
00174    double dphip;
00175    HepPoint3D ttt;
00176    
00177    t.setX(fr[1]);
00178    t.setY(0);
00179    t.setZ(fzshift+fz);
00180    
00181    dphi1=fphi5[1]-fphi5[0];
00182    dphi2=fphi5[2]-fphi5[1];
00183 
00184    tantheta1=fr[1]/fz;
00185    costheta1=1/sqrt(1+tantheta1*tantheta1);
00186    sintheta1=costheta1*tantheta1;
00187    
00188    for(i=0;i<6;++i){
00189       fRing4[i].Type(EmcRecCrystal::SixPlane());
00190    }
00191    
00192    // It's too complicated. Boring!
00193    // up and down for crystal 0,1 and 4,5
00194    EmcRecCrystal up[2],down[2];
00195    for(i=0;i<2;++i) {
00196       if(i==0) {
00197          dphi=dphi1;
00198       } else {
00199          dphi=dphi2;
00200       }
00201       // first point 3,0, up still needs a rotation
00202       po3=t;
00203       down[i].Set(3,po3);
00204       po0=t;
00205       down[i].Set(0,po0.rotateZ(dphi));
00206       //
00207       po3=t;
00208       up[i].Set(3,po3);
00209       po0=t;
00210       up[i].Set(0,po0.rotateZ(dphi2));
00211       // then point 7,4, up still needs a rotation
00212       l=down[i].Get(3).distance(down[i].Get(0))/2;
00213       ll=sqrt(fz*fz+fr[1]*fr[1]);
00214       lp=ll*flength/sqrt(ll*ll-l*l);
00215       po7=t;
00216       po7.setX(po7.x()+lp*sintheta1);
00217       po7.setZ(po7.z()+lp*costheta1);
00218       down[i].Set(7,po7);
00219       po4=po7;
00220       down[i].Set(4,po4.rotateZ(dphi));
00221       
00222       l=up[i].Get(3).distance(up[i].Get(0))/2;
00223       ll=sqrt(fz*fz+fr[1]*fr[1]);
00224       lp=ll*flength/sqrt(ll*ll-l*l);
00225       po7=t;
00226       po7.setX(po7.x()+lp*sintheta1);
00227       po7.setZ(po7.z()+lp*costheta1);
00228       up[i].Set(7,po7);
00229       po4=po7;
00230       up[i].Set(4,po4.rotateZ(dphi2));
00231       
00232       up[i].Set(0,up[i].Get(0).rotateZ(dphi));
00233       up[i].Set(3,up[i].Get(3).rotateZ(dphi));
00234       up[i].Set(4,up[i].Get(4).rotateZ(dphi));
00235       up[i].Set(7,up[i].Get(7).rotateZ(dphi));
00236       // 0,3,4,7 is done.
00237       // switch to 1,2,5,6
00238       // for down
00239       pl1.Build(0,1,0,0);
00240       n2=(down[i].Get(0)+down[i].Get(3))/2;
00241       n=n2-n1;
00242       pl2.Build(n,down[i].Get(3));
00243       m.setX(fr[2]);
00244       m.setY(0);
00245       m.setZ(fzshift+fz);
00246       w=m;
00247       if(i==0) {
00248          dphip=fphi5[2]-fphi5[0];
00249       } else {
00250          dphip=fphi5[6]-fphi5[4];
00251       }
00252       w.rotateZ(dphip);      
00253       pl3.Build(n1,m,w);  // very important
00254       FindInt(pl1,pl2,pl3,po2);
00255       down[i].Set(2,po2);
00256       //
00257       pl4.Build(O,n1,down[i].Get(0));
00258       FindInt(pl4,pl2,pl3,po1);
00259       down[i].Set(1,po1);
00260       //
00261       // point 6,5
00262       pl2.Build(n,down[i].Get(7));
00263       FindInt(pl1,pl2,pl3,po6);
00264       down[i].Set(6,po6);
00265       //
00266       FindInt(pl4,pl2,pl3,po5);
00267       down[i].Set(5,po5);
00268       // for up
00269       // point 2, 1
00270       n2=(up[i].Get(0)+up[i].Get(3))/2;
00271       n=n2-n1;
00272       pl1.Build(O,n1,up[i].Get(3));
00273       pl2.Build(n,up[i].Get(3));
00274       FindInt(pl1,pl2,pl3,po2);
00275       up[i].Set(2,po2);
00276       //
00277       pl4.Build(O,n1,up[i].Get(0));
00278       FindInt(pl4,pl2,pl3,po1);
00279       up[i].Set(1,po1);
00280       // point 5, 6
00281       pl2.Build(n,up[i].Get(7));
00282       FindInt(pl1,pl2,pl3,po6);
00283       up[i].Set(6,po6);
00284       //
00285       FindInt(pl4,pl2,pl3,po5);
00286       up[i].Set(5,po5);
00287    
00288    }
00289 
00290    for(i=0;i<8;++i) {
00291       fRing4[0].Set(i,down[0].Get(i));
00292       fRing4[1].Set(i,up[0].Get(i));
00293       fRing4[4].Set(i,down[1].Get(i).rotateZ(fphi5[4]));
00294       fRing4[5].Set(i,up[1].Get(i).rotateZ(fphi5[4]));
00295    }
00296 
00297    // crystal 2 and 3
00298    dphi=fphi5[3]-fphi5[2];  
00299    // first, point 3
00300    po3=t;
00301    fRing4[2].Set(3,po3);
00302    // then, point 0
00303    po0=t;
00304    fRing4[2].Set(0,po0.rotateZ(dphi));
00305    // point 7 and point 4
00306    l=fRing4[2].Get(3).distance(fRing4[2].Get(0))/2;
00307    ll=sqrt(fz*fz+fr[1]*fr[1]);
00308    lp=ll*flength/sqrt(ll*ll-l*l);
00309    po7=t;
00310    po7.setX(po7.x()+lp*sintheta1);
00311    po7.setZ(po7.z()+lp*costheta1);
00312    fRing4[2].Set(7,po7);
00313    po4=po7;
00314    fRing4[2].Set(4,po4.rotateZ(dphi));
00315    //point 2, 1
00316    pl1.Build(0,1,0,0);
00317    n2=(fRing4[2].Get(0)+fRing4[2].Get(3))/2;
00318    n=n2-n1;
00319    pl2.Build(n,fRing4[2].Get(3));
00320    m.setX(fr[2]);
00321    m.setY(0);
00322    m.setZ(fzshift+fz);
00323    w=m;
00324    w.rotateZ(dphi);
00325    pl3.Build(n1,m,w);
00326    FindInt(pl1,pl2,pl3,po2);   
00327    fRing4[2].Set(2,po2);
00328    po1=po2;
00329    fRing4[2].Set(1,po1.rotateZ(dphi));
00330    // point 6,5
00331    pl2.Build(n,fRing4[2].Get(7));
00332    FindInt(pl1,pl2,pl3,po6);
00333    fRing4[2].Set(6,po6);
00334    po5=po6;
00335    fRing4[2].Set(5,po5.rotateZ(dphi));
00336    
00337    // Crystal 2, 3 still need a rotation.
00338    for(i=0;i<8;++i) {
00339       fRing4[2].Set(i,fRing4[2].Get(i).rotateZ(fphi5[2]));
00340    }
00341    for(i=0;i<8;++i) {
00342       fRing4[3].Set(i,fRing4[2].Get(i).rotateZ(fphi5[3]-fphi5[2]));
00343    }   
00344    
00345    // Finally done. Check it out.
00346 //   for(i=0;i<6;++i) {
00347 //      cout<<fRing4[i]<<endl;
00348 //      fRing4[i].EndCapCheckout();
00349 //   }
00350 
00351    // ***************** Ring3 ********************
00352    // Here I changed my way of calculation. 
00353    // Don't care for it. Still BORING!
00354    // do some preparation
00355    HepPoint3D base3[5];
00356    base3[0].setX(fr[2]); base3[0].setY(0); base3[0].setZ(fz+fzshift);
00357    for(i=1;i<5;++i) {
00358       base3[i]=base3[0];
00359    }
00360    base3[1].rotateZ(fphi5[2]);
00361    base3[2].rotateZ(fphi5[3]);
00362    base3[3].rotateZ(fphi5[4]);
00363    base3[4].rotateZ(fphi5[6]);
00364 //   for(i=0;i<5;++i) {
00365 //      cout<<base3[i]<<endl;
00366 //   }
00367    
00368    HepPoint3D base2[6];
00369    base2[0].setX(fr[3]); base2[0].setY(0); base2[0].setZ(fz+fzshift); 
00370    for(i=1;i<6;++i) {
00371       base2[i]=base2[0];
00372       base2[i].rotateZ(fphi3[i]);
00373    }
00374 //   for(i=0;i<6;++i) {
00375 //      cout<<base2[i]<<endl;
00376 //   }
00377 //   cout<<endl;
00378    
00379    EmcRecGeoPlane pphi[6];
00380    for(i=0;i<6;++i) {
00381       pphi[i].Build(O,n1,base2[i]);
00382    }
00383    EmcRecGeoPlane ptheta[4];
00384    for(i=0;i<4;++i) {
00385       ptheta[i].Build(n1,base3[i],base3[i+1]);
00386    }
00387    EmcRecGeoPlane pthetap[5];
00388    for(i=0;i<5;++i) {
00389       pthetap[i].Build(n1,base2[i],base2[i+1]);
00390    }   
00391 
00392    // Once an error occor here. I just declare HepPoint3D nn[4];
00393    // Finally, the operation of nn[4] gets out of range. 
00394    // It has overlaped another varible.
00395    HepPoint3D nn[5];
00396    nn[0]=(base3[0]+base3[1])/2-n1;
00397    nn[1]=base3[1]-n1;
00398    nn[2]=base3[2]-n1;
00399    nn[3]=base3[3]-n1;
00400    nn[4]=(base3[3]+base3[4])/2-n1;
00401    
00402    EmcRecGeoPlane psection[5];
00403    for(i=0;i<5;++i) {
00404       psection[i].Build(nn[i],base3[i]);
00405    }
00406 
00407    EmcRecGeoPlane psection2[5];
00408    HepPoint3D bp[5];
00409    for(i=0;i<5;++i) {
00410       bp[i]=base3[i];
00411       bp[i].setX(bp[i].x()+flength*nn[i].x()/nn[i].mag());
00412       bp[i].setY(bp[i].y()+flength*nn[i].y()/nn[i].mag());
00413       bp[i].setZ(bp[i].z()+flength*nn[i].z()/nn[i].mag());
00414       psection2[i].Build(nn[i],bp[i]);
00415    }
00416    
00417    EmcRecGeoPlane pthetatmp;
00418    for(i=0;i<5;++i) {
00419       if(i==0||i==4) {
00420          fRing3[i].Type(EmcRecCrystal::SixPlane());
00421          if(i==0) { 
00422             pthetatmp=ptheta[0]; 
00423          }
00424          if(i==4) { 
00425             pthetatmp=ptheta[3];
00426          }
00427          FindInt(pphi[i],pthetatmp,psection[i],po3);
00428          FindInt(pphi[i],pthetap[i],psection[i],po2);
00429          FindInt(pphi[i+1],pthetatmp,psection[i],po0);
00430          FindInt(pphi[i+1],pthetap[i],psection[i],po1);
00431          fRing3[i].Set(0,po0);
00432          fRing3[i].Set(1,po1); 
00433          fRing3[i].Set(2,po2); 
00434          fRing3[i].Set(3,po3);
00435          FindInt(pphi[i],pthetatmp,psection2[i],po7);
00436          FindInt(pphi[i],pthetap[i],psection2[i],po6);
00437          FindInt(pphi[i+1],pthetatmp,psection2[i],po4);
00438          FindInt(pphi[i+1],pthetap[i],psection2[i],po5);
00439          fRing3[i].Set(4,po4);
00440          fRing3[i].Set(5,po5);
00441          fRing3[i].Set(6,po6);
00442          fRing3[i].Set(7,po7);
00443       } else { 
00444          fRing3[i].Type(EmcRecCrystal::SevenPlane());
00445          po0=base3[i];
00446          FindInt(pphi[i],ptheta[i-1],psection[i],po4);
00447          FindInt(pphi[i],pthetap[i],psection[i],po3);
00448          FindInt(pphi[i+1],ptheta[i],psection[i],po1);
00449          FindInt(pphi[i+1],pthetap[i],psection[i],po2);
00450          fRing3[i].Set(0,po0);
00451          fRing3[i].Set(1,po1);
00452          fRing3[i].Set(2,po2);
00453          fRing3[i].Set(3,po3);
00454          fRing3[i].Set(4,po4);
00455          po5=bp[i];
00456          FindInt(pphi[i],ptheta[i-1],psection2[i],po9);
00457          FindInt(pphi[i],pthetap[i],psection2[i],po8);
00458          FindInt(pphi[i+1],ptheta[i],psection2[i],po6);
00459          FindInt(pphi[i+1],pthetap[i],psection2[i],po7);
00460          fRing3[i].Set(5,po5);
00461          fRing3[i].Set(6,po6);
00462          fRing3[i].Set(7,po7);
00463          fRing3[i].Set(8,po8);
00464          fRing3[i].Set(9,po9);
00465       }
00466    }
00473 //   for(i=0;i<5;++i) {
00474 //      cout<<fRing3[i]<<endl;
00475 //      fRing3[i].EndCapCheckout();
00476 //   }
00477 
00479    HepPoint3D base1[4];
00480    base1[0].setX(fr[4]); base1[0].setY(0); base1[0].setZ(fz+fzshift);
00481    for(i=1;i<4;++i) {
00482       base1[i]=base1[0];
00483    }
00484    base1[1].rotateZ(fphi3[2]);
00485    base1[2].rotateZ(fphi3[3]);
00486    base1[3].rotateZ(fphi3[5]);
00487    EmcRecGeoPlane ptheta1[3];
00488    for(i=0;i<3;++i) {
00489       ptheta1[i].Build(n1,base1[i],base1[i+1]);
00490    }
00491       
00492    HepPoint3D nn2[5];
00493    for(i=0;i<5;++i) {
00494       nn2[i]=(base2[i]+base2[i+1])/2-n1;
00495    }
00496    EmcRecGeoPlane psec2[5];
00497    for(i=0;i<5;++i) {
00498       psec2[i].Build(nn2[i],base2[i]);
00499    }
00500 
00501    EmcRecGeoPlane psec2p[5];
00502    HepPoint3D bpp[5];
00503    for(i=0;i<5;++i) {
00504       bpp[i]=base2[i];
00505       bpp[i].setX(bpp[i].x()+flength*nn2[i].x()/nn2[i].mag());
00506       bpp[i].setY(bpp[i].y()+flength*nn2[i].y()/nn2[i].mag());
00507       bpp[i].setZ(bpp[i].z()+flength*nn2[i].z()/nn2[i].mag());
00508       psec2p[i].Build(nn2[i],bpp[i]);
00509    }
00510    
00511    EmcRecGeoPlane ptheta1tmp;
00512    for(i=0;i<5;++i) {
00513       fRing2[i].Type(EmcRecCrystal::SixPlane());
00514       if(i<2) { 
00515          ptheta1tmp=ptheta1[0]; 
00516       }
00517       if(i==2) {
00518          ptheta1tmp=ptheta1[1];
00519       }
00520       if(i>2) {
00521          ptheta1tmp=ptheta1[2];
00522       }      
00523       po3=base2[i];
00524       FindInt(pphi[i],ptheta1tmp,psec2[i],po2); 
00525       po0=base2[i+1]; 
00526       FindInt(pphi[i+1],ptheta1tmp,psec2[i],po1);
00527       FindInt(pphi[i],pthetap[i],psec2p[i],po7);
00528       FindInt(pphi[i],ptheta1tmp,psec2p[i],po6);
00529       FindInt(pphi[i+1],pthetap[i],psec2p[i],po4);
00530       FindInt(pphi[i+1],ptheta1tmp,psec2p[i],po5);
00531       fRing2[i].Set(0,po0);
00532       fRing2[i].Set(1,po1);
00533       fRing2[i].Set(2,po2);
00534       fRing2[i].Set(3,po3);
00535       fRing2[i].Set(4,po4);
00536       fRing2[i].Set(5,po5);
00537       fRing2[i].Set(6,po6);
00538       fRing2[i].Set(7,po7);
00539    }
00540    
00542 //   for(i=0;i<5;++i) {
00543 //      cout<<fRing2[i]<<endl;
00544 //      fRing2[i].EndCapCheckout();
00545 //   }
00546   
00548    HepPoint3D base0[5];
00549    base0[0].setX(fr[5]); base0[0].setY(0); base0[0].setZ(fz+fzshift);
00550    for(i=1;i<5;++i) {
00551       base0[i]=base0[0];
00552       base0[i].rotateZ(fphi1[i]);
00553    }
00554    
00555    EmcRecGeoPlane pphi1[5];
00556    for(i=0;i<5;++i) {
00557       pphi1[i].Build(O,n1,base0[i]);
00558    }
00559    
00560    EmcRecGeoPlane ptheta0[4];
00561    for(i=0;i<4;++i) {
00562       ptheta0[i].Build(n1,base0[i],base0[i+1]);
00563    }
00564    
00565    HepPoint3D nn1[4];
00566    nn1[0]=(base1[0]+base1[1])/2-n1;
00567    nn1[1]=base1[1]-n1;
00568    nn1[2]=base1[2]-n1;
00569    nn1[3]=(base1[2]+base1[3])/2-n1;
00570    
00571    EmcRecGeoPlane psec1[4];
00572    for(i=0;i<4;++i) {
00573       psec1[i].Build(nn1[i],base1[i]);
00574    }
00575    
00576    EmcRecGeoPlane psec1p[4];
00577    HepPoint3D qq[4];
00578    for(i=0;i<4;++i) {
00579       qq[i]=base1[i];
00580       qq[i].setX(qq[i].x()+flength*nn1[i].x()/nn1[i].mag());
00581       qq[i].setY(qq[i].y()+flength*nn1[i].y()/nn1[i].mag());
00582       qq[i].setZ(qq[i].z()+flength*nn1[i].z()/nn1[i].mag());
00583       psec1p[i].Build(nn1[i],qq[i]);
00584    }   
00585    
00586    EmcRecGeoPlane pt1tmp;
00587    for(i=0;i<4;++i) {
00588       if(i==0||i==3) {
00589          fRing1[i].Type(EmcRecCrystal::SixPlane());
00590          if(i==0) {
00591             pt1tmp=ptheta1[0];
00592          } else {
00593             pt1tmp=ptheta1[2];
00594          }
00595          FindInt(pphi1[i],pt1tmp,psec1[i],po3);
00596          FindInt(pphi1[i],ptheta0[i],psec1[i],po2);
00597          FindInt(pphi1[i+1],pt1tmp,psec1[i],po0);
00598          FindInt(pphi1[i+1],ptheta0[i],psec1[i],po1);
00599          FindInt(pphi1[i],pt1tmp,psec1p[i],po7);
00600          FindInt(pphi1[i],ptheta0[i],psec1p[i],po6);
00601          FindInt(pphi1[i+1],pt1tmp,psec1p[i],po4);
00602          FindInt(pphi1[i+1],ptheta0[i],psec1p[i],po5);
00603          fRing1[i].Set(0,po0);
00604          fRing1[i].Set(1,po1);
00605          fRing1[i].Set(2,po2);
00606          fRing1[i].Set(3,po3);
00607          fRing1[i].Set(4,po4);
00608          fRing1[i].Set(5,po5);
00609          fRing1[i].Set(6,po6);
00610          fRing1[i].Set(7,po7);
00611       } else {
00612          fRing1[i].Type(EmcRecCrystal::SevenPlane());
00613          po0=base1[i];
00614          FindInt(pphi1[i],ptheta1[i-1],psec1[i],po4);
00615          FindInt(pphi1[i],ptheta0[i],psec1[i],po3);
00616          FindInt(pphi1[i+1],ptheta1[i],psec1[i],po1);
00617          FindInt(pphi1[i+1],ptheta0[i],psec1[i],po2);    
00618          fRing1[i].Set(0,po0);
00619          fRing1[i].Set(1,po1);
00620          fRing1[i].Set(2,po2);
00621          fRing1[i].Set(3,po3);
00622          fRing1[i].Set(4,po4);
00623          po5=qq[i];
00624          FindInt(pphi1[i],ptheta1[i-1],psec1p[i],po9);
00625          FindInt(pphi1[i],ptheta0[i],psec1p[i],po8);
00626          FindInt(pphi1[i+1],ptheta1[i],psec1p[i],po6);
00627          FindInt(pphi1[i+1],ptheta0[i],psec1p[i],po7);
00628          fRing1[i].Set(5,po5);
00629          fRing1[i].Set(6,po6);
00630          fRing1[i].Set(7,po7);
00631          fRing1[i].Set(8,po8);
00632          fRing1[i].Set(9,po9);   
00633       }
00634    }
00635 
00637 //   for(i=0;i<4;++i) {
00638 //      cout<<fRing1[i]<<endl;
00639 //      fRing1[i].EndCapCheckout();
00640 //   }
00642    HepPoint3D basem1[5];
00643    basem1[0].setX(fr[6]); basem1[0].setY(0); basem1[0].setZ(fz+fzshift);
00644    for(i=1;i<5;++i) {
00645       basem1[i]=basem1[0];
00646       basem1[i].rotateZ(fphi1[i]);
00647    }
00648 
00649    EmcRecGeoPlane pthetam1[4];
00650    for(i=0;i<4;++i) {
00651       pthetam1[i].Build(n1,basem1[i],basem1[i+1]);
00652    }
00653    
00654    HepPoint3D nn0[4];
00655    for(i=0;i<4;++i) {
00656       nn0[i]=(base0[i]+base0[i+1])/2-n1;
00657    }
00658    
00659    EmcRecGeoPlane psec0[4];
00660    for(i=0;i<4;++i) {
00661       psec0[i].Build(nn0[i],base0[i]);
00662    }
00663    
00664    EmcRecGeoPlane psec0p[4];
00665    HepPoint3D qq0[4];
00666    for(i=0;i<4;++i) {
00667       qq0[i]=base0[i];
00668       qq0[i].setX(qq0[i].x()+flength*nn0[i].x()/nn0[i].mag());
00669       qq0[i].setY(qq0[i].y()+flength*nn0[i].y()/nn0[i].mag());
00670       qq0[i].setZ(qq0[i].z()+flength*nn0[i].z()/nn0[i].mag());
00671       psec0p[i].Build(nn0[i],qq0[i]);
00672    }
00673 
00674    for(i=0;i<4;++i) {
00675       fRing0[i].Type(EmcRecCrystal::SixPlane());
00676       po3=base0[i];
00677       FindInt(pphi1[i],pthetam1[i],psec0[i],po2);
00678       po0=base0[i+1];
00679       FindInt(pphi1[i+1],pthetam1[i],psec0[i],po1);
00680       FindInt(pphi1[i],ptheta0[i],psec0p[i],po7);
00681       FindInt(pphi1[i],pthetam1[i],psec0p[i],po6);
00682       FindInt(pphi1[i+1],ptheta0[i],psec0p[i],po4);
00683       FindInt(pphi1[i+1],pthetam1[i],psec0p[i],po5);
00684       fRing0[i].Set(0,po0);
00685       fRing0[i].Set(1,po1);
00686       fRing0[i].Set(2,po2);
00687       fRing0[i].Set(3,po3);
00688       fRing0[i].Set(4,po4);
00689       fRing0[i].Set(5,po5);
00690       fRing0[i].Set(6,po6);
00691       fRing0[i].Set(7,po7);
00692    }
00693    
00695 //   for(i=0;i<4;++i) {
00696 //      cout<<fRing0[i]<<endl;
00697 //      fRing0[i].EndCapCheckout();
00698 //   }
00699    for(i=0;i<6;++i) {
00700       if(i<4) {
00701          fCrystal[0][0][i]=fRing0[i];
00702          fCrystal[0][1][i]=fRing1[i];
00703       }
00704       if(i<5) {
00705          fCrystal[0][2][i]=fRing2[i];
00706          fCrystal[0][3][i]=fRing3[i];
00707       }
00708       fCrystal[0][4][i]=fRing4[i];
00709       fCrystal[0][5][i]=fRing5[i];
00710    }
00711 }

void EmcRecEndCapGeo::CalculateStandardSector2  )  [private]
 

void EmcRecEndCapGeo::CalculateStandardSector2  )  [private]
 

rotate 90 degrees

00714 {
00715    EmcRecCrystal edge[6];
00716    
00717    int i,j;
00718 
00719    for(i=1;i<6;++i) {
00720       fRing5p[i]=fRing5[i];
00721       fRing4p[i]=fRing4[i];
00722    }
00723    for(i=1;i<5;++i) {
00724       fRing3p[i]=fRing3[i];
00725       fRing2p[i]=fRing2[i];
00726    }
00727    for(i=1;i<4;++i) {
00728       fRing1p[i]=fRing1[i];
00729       fRing0p[i]=fRing0[i];
00730    }
00731    
00732    edge[5]=fRing5[0];
00733    edge[4]=fRing4[0]; 
00734    edge[3]=fRing3[0]; 
00735    edge[2]=fRing2[0]; 
00736    edge[1]=fRing1[0]; 
00737    edge[0]=fRing0[0]; 
00738    
00739    EmcRecGeoPlane p10mm;
00740    p10mm.Build(0,1,0,-10);
00741 
00742    EmcRecGeoPlane sec1,sec2;
00743    EmcRecGeoPlane theta1,theta2;
00744    
00745    HepPoint3D po3,po2,po7,po6;
00746    
00747    for(i=0;i<6;++i) {
00748       sec1.Build(edge[i].Get(0),edge[i].Get(1),edge[i].Get(2));
00749       sec2.Build(edge[i].Get(4),edge[i].Get(5),edge[i].Get(6));
00750       theta1.Build(edge[i].Get(2),edge[i].Get(5),edge[i].Get(6));
00751       theta2.Build(edge[i].Get(3),edge[i].Get(4),edge[i].Get(7));
00752       
00753       FindInt(sec1,theta1,p10mm,po2);
00754       FindInt(sec1,theta2,p10mm,po3); 
00755       FindInt(sec2,theta1,p10mm,po6); 
00756       FindInt(sec2,theta2,p10mm,po7);
00757       
00758       edge[i].Set(2,po2);
00759       edge[i].Set(3,po3);
00760       edge[i].Set(6,po6);
00761       edge[i].Set(7,po7);
00762    }
00763    
00764    fRing5p[0]=edge[5];
00765    fRing4p[0]=edge[4];
00766    fRing3p[0]=edge[3];
00767    fRing2p[0]=edge[2];
00768    fRing1p[0]=edge[1];
00769    fRing0p[0]=edge[0];   
00770    
00771    double pio2=3.14159265358979/2;
00772 
00774    for(i=0;i<6;++i) {
00775       for(j=0;j<10;++j) {
00776          fRing5p[i].Set(j,fRing5p[i].Get(j).rotateZ(pio2));
00777          fRing4p[i].Set(j,fRing4p[i].Get(j).rotateZ(pio2));
00778       }
00779    }
00780    for(i=0;i<5;++i) {
00781       for(j=0;j<10;++j) { 
00782          fRing3p[i].Set(j,fRing3p[i].Get(j).rotateZ(pio2));
00783          fRing2p[i].Set(j,fRing2p[i].Get(j).rotateZ(pio2));
00784       }
00785    }
00786    for(i=0;i<4;++i) {
00787       for(j=0;j<10;++j) { 
00788          fRing1p[i].Set(j,fRing1p[i].Get(j).rotateZ(pio2));
00789          fRing0p[i].Set(j,fRing0p[i].Get(j).rotateZ(pio2));
00790       }
00791    }
00792    
00793    // check it!!!
00794 //   for(i=0;i<4;++i) {
00795 //      cout<<fRing1p[i]<<endl;
00796 //   }
00797 //   for(i=0;i<5;++i) {   
00798 //      cout<<fRing3p[i]<<endl;
00799 //   }
00800 //   for(i=0;i<6;++i) {
00801 //      cout<<fRing5p[i]<<endl;
00802 //   }
00803    for(i=0;i<6;++i) {
00804       if(i<4) {
00805          fCrystal[1][0][i]=fRing0p[i];
00806          fCrystal[1][1][i]=fRing1p[i];
00807       }
00808       if(i<5) {
00809          fCrystal[1][2][i]=fRing2p[i];
00810          fCrystal[1][3][i]=fRing3p[i];
00811       }
00812       fCrystal[1][4][i]=fRing4p[i];
00813       fCrystal[1][5][i]=fRing5p[i];
00814    }
00815 }

void EmcRecEndCapGeo::FillCCenterVector  )  [private]
 

void EmcRecEndCapGeo::FillCCenterVector  )  [private]
 

00818 {
00819    unsigned int module;
00820    unsigned int phi,phimax,theta;
00821    Identifier id;
00822    EmcRecCrystal aCry;
00823    HepPoint3D aCenter;
00824    HepPoint3D aFrontCenter;
00825    
00826    module=EmcID::getENDCAP_EAST();
00827    for(theta=0;theta<=5;++theta) {
00828       phimax=EmcID::getPHI_ENDCAP_MAX(theta);
00829       for(phi=0;phi<=phimax;++phi) {
00830          id=EmcID::crystal_id(module,theta,phi);
00831          aCry=GetCrystal(id);
00832          aCenter=aCry.Center();
00833    aFrontCenter=aCry.FrontCenter();
00834          fCCenter.push_back(aCenter);
00835    fCFrontCenter.push_back(aFrontCenter);
00836       }
00837    }
00838 
00839    module=EmcID::getENDCAP_WEST();
00840    for(theta=0;theta<=5;++theta) {
00841       phimax=EmcID::getPHI_ENDCAP_MAX(theta);
00842       for(phi=0;phi<=phimax;++phi) {
00843          id=EmcID::crystal_id(module,theta,phi);
00844          aCry=GetCrystal(id);
00845          aCenter=aCry.Center();
00846    aFrontCenter=aCry.FrontCenter();
00847          fCCenter.push_back(aCenter);
00848    fCFrontCenter.push_back(aFrontCenter);
00849       }
00850    }
00851 }

void EmcRecEndCapGeo::FindInt const EmcRecGeoPlane p1,
const EmcRecGeoPlane p2,
const EmcRecGeoPlane p3,
HepPoint3D p
[private]
 

void EmcRecEndCapGeo::FindInt const EmcRecGeoPlane p1,
const EmcRecGeoPlane p2,
const EmcRecGeoPlane p3,
HepPoint3D p
[private]
 

00984 {
00985    // solve a system of linear equation 
00986    // The form is AX=B
00987    HepMatrix A(3,3);
00988    HepVector B(3);
00989    HepVector X(3);
00990    
00991    A(1,1)=p1.a();   A(1,2)=p1.b();   A(1,3)=p1.c();   B(1)=-p1.d();
00992    A(2,1)=p2.a();   A(2,2)=p2.b();   A(2,3)=p2.c();   B(2)=-p2.d();
00993    A(3,1)=p3.a();   A(3,2)=p3.b();   A(3,3)=p3.c();   B(3)=-p3.d();
00994    
00995    X=solve(A,B);
00996 //   cout<<A;
00997 //   cout<<B;
00998 //   cout<<X;
00999  
01000    p.setX(X(1));
01001    p.setY(X(2));
01002    p.setZ(X(3));
01003 //   cout<<p;
01004 }

HepPoint3D EmcRecEndCapGeo::GetCCenter const Identifier id  )  const
 

HepPoint3D EmcRecEndCapGeo::GetCCenter const Identifier id  )  const
 

00924 {
00925    unsigned int module,theta,phi;   
00926    unsigned int i,j;
00927    
00928    module=EmcID::barrel_ec(id);
00929    theta=EmcID::theta_module(id);
00930    phi=EmcID::phi_module(id);
00931    
00932    i=0;
00933    if(module==EmcID::getENDCAP_EAST()) {
00934       for(j=0;j<theta;++j) {
00935          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00936       }
00937       i+=(phi+1);
00938    } else {
00939       for(j=0;j<6;++j) {
00940          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00941       }
00942       for(j=0;j<theta;++j) {
00943          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00944       }
00945       i+=(phi+1); 
00946    }
00947    
00948    return fCCenter[i-1];
00949 }

HepPoint3D EmcRecEndCapGeo::GetCFrontCenter const Identifier id  )  const
 

HepPoint3D EmcRecEndCapGeo::GetCFrontCenter const Identifier id  )  const
 

00952 {
00953    unsigned int module,theta,phi;   
00954    unsigned int i,j;
00955    
00956    module=EmcID::barrel_ec(id);
00957    theta=EmcID::theta_module(id);
00958    phi=EmcID::phi_module(id);
00959    
00960    i=0;
00961    if(module==EmcID::getENDCAP_EAST()) {
00962       for(j=0;j<theta;++j) {
00963          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00964       }
00965       i+=(phi+1);
00966    } else {
00967       for(j=0;j<6;++j) {
00968          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00969       }
00970       for(j=0;j<theta;++j) {
00971          i+=(EmcID::getPHI_ENDCAP_MAX(j)+1);
00972       }
00973       i+=(phi+1); 
00974    }
00975    
00976    return fCFrontCenter[i-1];
00977 }

EmcRecCrystal EmcRecEndCapGeo::GetCrystal const Identifier id  )  const
 

EmcRecCrystal EmcRecEndCapGeo::GetCrystal const Identifier id  )  const
 

00854 {
00855    int i;
00856    EmcRecCrystal cry;
00857    unsigned int module=EmcID::barrel_ec(id);
00858    unsigned int theta=EmcID::theta_module(id);
00859    unsigned int phi=EmcID::phi_module(id);
00860    
00861    unsigned int phiMax,phiMax16;
00862    unsigned int phiQuotient,phiRemainder;
00863    
00864    phiMax=EmcID::getPHI_ENDCAP_MAX(theta);
00865    phiMax16=(phiMax+1)/16;   
00866    phiQuotient=(unsigned int)(phi/phiMax16);
00867    phiRemainder=phi%phiMax16;
00868 
00869    //cout<<phiQuotient<<" "<<phiRemainder<<endl;
00870    
00871    if(module==EmcID::getENDCAP_EAST()) {
00872       if(phiQuotient!=3&&phiQuotient!=4&&
00873          phiQuotient!=11&&phiQuotient!=12) {
00874          cry=fCrystal[0][theta][phiRemainder];
00875          for(i=0;i<10;++i) {
00876             cry.Set(i,cry.Get(i).rotateZ(phiQuotient*fphi5[6]));
00877          }
00878       }  else {
00879          if(phiQuotient==4) {
00880             cry=fCrystal[1][theta][phiRemainder];
00881          }
00882          if(phiQuotient==3) {
00883             cry=fCrystal[1][theta][phiMax16-1-phiRemainder];
00884             for(i=0;i<10;++i) {
00885                cry.SetX(i,-cry.Get(i).x());
00886             }
00887          }
00888          if(phiQuotient==11) {
00889             cry=fCrystal[1][theta][phiMax16-1-phiRemainder];
00890             for(i=0;i<10;++i) {
00891                cry.SetY(i,-cry.Get(i).y());
00892             }
00893          }
00894          if(phiQuotient==12) {
00895             cry=fCrystal[1][theta][phiRemainder];
00896             for(i=0;i<10;++i) {
00897                cry.SetX(i,-cry.Get(i).x());
00898                cry.SetY(i,-cry.Get(i).y());
00899             }
00900          }
00901       }
00902    }
00903    
00904    if(module==EmcID::getENDCAP_WEST()) {
00905       unsigned int phipp;
00906       unsigned int phiMax2=(phiMax+1)/2;
00907       if(phi<phiMax2) {
00908          phipp=phiMax2-1-phi;
00909       } else {
00910          phipp=phiMax+phiMax2-phi;
00911       }
00912       Identifier idd=EmcID::crystal_id(EmcID::getENDCAP_EAST(),theta,phipp);
00913       cry=GetCrystal(idd);
00914       for(i=0;i<10;++i) {
00915          cry.SetX(i,-cry.Get(i).x());
00916          cry.SetZ(i,-cry.Get(i).z());
00917       }
00918    }      
00919    
00920    return cry;
00921 }

void EmcRecEndCapGeo::ParameterInitialize  )  [private]
 

void EmcRecEndCapGeo::ParameterInitialize  )  [private]
 

for Ring1 and 0

00023 {
00024    // EndCap is too complex. More careful and detailed initialization
00025    // will be done to make the later calculation easier.
00026    int i;
00027    
00028    // Read constant for Database
00029    // general
00030    flength=280;
00031    fzshift=100;
00032    fz=1285;
00033    fr[0]=880;
00034    fr[1]=813.60278843;
00035    fr[2]=748.39248406;
00036    fr[3]=684.54540341;
00037    fr[4]=621.94216056;
00038    fr[5]=560.46548641;
00039    fr[6]=500;
00040    
00041    // for Ring5 and 4
00042    fphi5[0]=0;
00043    fphi5[1]=4.4;
00044    fphi5[2]=8.02;
00045    fphi5[3]=11.64;
00046    fphi5[4]=15.26;
00047    fphi5[5]=18.88;
00048    fphi5[6]=22.50;
00049    for(i=0;i<7;++i) {
00050       fphi5[i]=fphi5[i]*3.14159265358979/180;
00051    }
00052    
00053    // for Ring3 and 2
00054    fphi3[0]=0;
00055    fphi3[1]=5.124;
00056    fphi3[2]=9.468;
00057    fphi3[3]=13.812;
00058    fphi3[4]=18.156;
00059    fphi3[5]=22.50;
00060    for(i=0;i<6;++i) {
00061       fphi3[i]=fphi3[i]*3.14159265358979/180;
00062    }
00063 
00065    fphi1[0]=0;
00066    fphi1[1]=6.21;
00067    fphi1[2]=11.64;
00068    fphi1[3]=17.07;
00069    fphi1[4]=22.50;
00070    for(i=0;i<5;++i) {
00071       fphi1[i]=fphi1[i]*3.14159265358979/180;
00072    }
00073 }


Member Data Documentation

vector<HepPoint3D> EmcRecEndCapGeo::fCCenter [private]
 

vector of each crystal's center

vector<HepPoint3D> EmcRecEndCapGeo::fCCenter [private]
 

vector of each crystal's center

vector<HepPoint3D> EmcRecEndCapGeo::fCFrontCenter [private]
 

vector<HepPoint3D> EmcRecEndCapGeo::fCFrontCenter [private]
 

EmcRecCrystal EmcRecEndCapGeo::fCrystal [private]
 

put them together for easy reference

double EmcRecEndCapGeo::flength [private]
 

double EmcRecEndCapGeo::fphi1 [private]
 

double EmcRecEndCapGeo::fphi3 [private]
 

double EmcRecEndCapGeo::fphi5 [private]
 

double EmcRecEndCapGeo::fr [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing0 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing0p [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing1 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing1p [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing2 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing2p [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing3 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing3p [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing4 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing4p [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing5 [private]
 

EmcRecCrystal EmcRecEndCapGeo::fRing5p [private]
 

double EmcRecEndCapGeo::fz [private]
 

double EmcRecEndCapGeo::fzshift [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:01:59 2011 for BOSS6.5.5 by  doxygen 1.3.9.1