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

TofFz_helix Class Reference

#include <Toffz_helix.h>

List of all members.

Public Member Functions

void debugOpt (int deb)
void debugOpt (int deb)
void pathlCut (double pathl_max)
void pathlCut (double pathl_max)
int TofFz_Get (double, int, double[])
int TofFz_Get (double, int, double[])
 TofFz_helix (void)
 TofFz_helix (void)
void ztofCut (double ztof_min, double ztof_max)
void ztofCut (double ztof_min, double ztof_max)
 ~TofFz_helix (void)
 ~TofFz_helix (void)

Public Attributes

double Dr
double Dz
double Fi_tof
double Kappa
int NTrk
double Path_tof
double Pathl
double Phi0
double Phi1
double r_endtof
double R_tof
double Tanl
int Tofid
double W_tof
double Z_tof

Private Attributes

int _debug
double _pathl_cut
double _ztof_cutm
double _ztof_cutx
double pi2
double piby1
double piby24
double piby44


Constructor & Destructor Documentation

TofFz_helix::TofFz_helix void   ) 
 

00061                              {
00062    piby1=3.141593;
00063    pi2=2.0*piby1;
00064    piby44=piby1/44.0;
00065    piby24=piby1/24.0;
00066    _debug=1;
00067    _pathl_cut= 500.0;
00068    _ztof_cutm=-140.0;
00069    _ztof_cutx= 140.0;
00070  
00071 }

TofFz_helix::~TofFz_helix void   )  [inline]
 

00024 {};

TofFz_helix::TofFz_helix void   ) 
 

TofFz_helix::~TofFz_helix void   )  [inline]
 

00024 {};


Member Function Documentation

void TofFz_helix::debugOpt int  deb  )  [inline]
 

00044                            {
00045       _debug = deb;
00046     }

void TofFz_helix::debugOpt int  deb  )  [inline]
 

00044                            {
00045       _debug = deb;
00046     }

void TofFz_helix::pathlCut double  pathl_max  )  [inline]
 

00048                                     {
00049       _pathl_cut = pathl_max;
00050     }

void TofFz_helix::pathlCut double  pathl_max  )  [inline]
 

00048                                     {
00049       _pathl_cut = pathl_max;
00050     }

int TofFz_helix::TofFz_Get double  ,
int  ,
double  []
 

int TofFz_helix::TofFz_Get double  ,
int  ,
double  []
 

00074                                                                {
00075    // crossing points of the helix on the tof cylinder
00076    double xc,yc;            // center of the circle
00077    double rho;              // radius of tof cyclinder
00078    double  xx[2],yy[2];      // coordinates of hits
00079    double  tofx,tofy;        // (x,y) on the radius of R_tof
00080    double  nx,ny;            // direction cosines of mom vector at vertex
00081    double  cosx,sinx;
00082    double aa,ca,cb,cc,detm;
00083   
00084    // fzisan track ID and TOF radius
00085    int Id_cdfztrk = id; R_tof = rtof;
00086 
00087     if( Id_cdfztrk<0 ) {
00088      if (_debug) std::cout << " TofFz_helix *** wrong id_cdfztrk ="
00089                            << Id_cdfztrk << std::endl;
00090                                                   return(-1);
00091    }
00092    
00093    // fzisan track
00094    /*   FTFinder * ftrk = FTFinder:: GetPointer();
00095    FTList<FTTrack *> & FsTrks = ftrk->tracks();
00096    NTrk = FsTrks.length();
00097      
00098    cout<< "Toffz_helix:: NTrk="<<NTrk<<endl;
00099    if (NTrk<=0)                                   return (-3);
00100 
00101    // get helix params for Id_cdfztrk 
00102    FTTrack & trk = * FsTrks[Id_cdfztrk];
00103    const Helix hel = * trk.helix();
00104 
00105    const HepPoint3D pivot1(0.,0.,0.);
00106    HepVector  a(5,0);
00107    a[0] = hel.a()[0];
00108    a[1] = hel.a()[1];
00109    a[2] = hel.a()[2];
00110    a[3] = hel.a()[3];
00111    a[4] = hel.a()[4];
00112    */
00113    const HepPoint3D pivot1(0.,0.,0.);
00114    HepVector  a(5,0);
00115    a[0] = fzisan[0];
00116    a[1] = fzisan[1];
00117    a[2] = fzisan[2];
00118    a[3] = fzisan[3];
00119    a[4] = fzisan[4];
00120 
00121 
00122    // Ill-fitted track in fzisan (dz=tanl=-9999.)
00123    if (abs(a[3])>50.0 || abs(a[4])>500.0)          return (-5);
00124   // if (abs(a[3])>10.0 || abs(a[4])>500.0)          return (-5);
00125 
00126    // D e f i n e   h e l i x
00127    Helix helix1(pivot1,a);
00128    Dr    = helix1.a()[0];   
00129    Phi0  = helix1.a()[1];   
00130    Kappa = helix1.a()[2];    
00131    Dz    = helix1.a()[3];   
00132    Tanl  = helix1.a()[4];
00133 
00134    /*   double detaphi=asin(0.5*0.81*0.3*fabs(Kappa));
00135        double phi=Phi0+detaphi+ piby1/2;
00136       //  int  tofid = (int) ( phi/piby44 + 1.0 );
00137      int  tofid = (int) ( phi/piby44 );
00138      */
00139 
00140    // check cdfztrk hit on tof cyclinder
00141    rho  = helix1.radius(); 
00142    // cout<<" Toffz_helix:: rho  ="<<rho<<endl;  // radius of the circle in cm
00143    HepPoint3D    xyz    = helix1.center();
00144    xc   = xyz(0);
00145    yc   = xyz(1);
00146    // cout<<"Toffz_helix::helix center:xc="<<xc<<",yc= "<<yc<<endl;
00147 
00148    Hep3Vector vxyz   = helix1.direction();
00149    nx   = vxyz(0);              // direction of track at the vertex
00150    ny   = vxyz(1); 
00151    // cout<<"Toffz_helix::direction: nx= "<<nx<<", ny="<<ny<<endl;
00152   
00153    if(fabs(rho)>R_tof/2){
00154    
00155    // get hit on tof cylinder at radius R_tof;
00156 
00157    if( xc==0.0 && yc==0.0 ) return(-3); 
00158    // coefficients of quadratic equation
00159    ca = xc*xc + yc*yc ;
00160    aa = 0.5 * ( ca - rho*rho + R_tof*R_tof );
00161    
00162    if ( xc != 0.0 ) {
00163       cb = aa * yc;
00164       cc = aa*aa - R_tof*R_tof*xc*xc; 
00165       // determinant
00166       detm = cb*cb - ca*cc;
00167       if ( detm > 0.0 ) {
00168          yy[0] = ( cb + sqrt(detm) )/ ca;
00169          xx[0] = ( aa - yy[0]*yc )/xc;
00170          yy[1] = ( cb - sqrt(detm) )/ ca;
00171          xx[1] = ( aa - yy[1]*yc )/xc;
00172       } else  return(-1);
00173    }
00174    else{
00175       cb = aa * xc;
00176       cc = aa*aa - R_tof*R_tof*yc*yc;
00177       // determinant
00178       detm = cb*cb - ca*cc;
00179       if ( detm > 0.0 ) {
00180          xx[0] = ( cb + sqrt(detm) )/ca;
00181          yy[0] = ( aa - xx[0]*xc )/yc;
00182          xx[1] = ( cb - sqrt(detm) )/ca;
00183          yy[1] = ( aa - xx[1]*xc )/yc;
00184       } else return(-2);
00185    }
00186  
00187    // choose one of hits according to track direction at the vertex.
00188   
00189   if( xx[0]*nx + yy[0]*ny > 0.0 ) { tofx = xx[0]; tofy = yy[0]; }
00190    else                            { tofx = xx[1]; tofy = yy[1]; }
00191   
00192    double fi = atan2(tofy ,tofx );    // atna2 from -pi to pi
00193 
00194    
00195   if( fi < 0.0 ) fi=pi2+fi;
00196    Fi_tof = fi;         
00197    //  Tofid = (int) ( Fi_tof/piby44 + 1.0 );
00198     Tofid = (int) ( Fi_tof/piby44  );
00199 
00200    /*   double fi2 = atan2(yy[1] , xx[1]);    // atna2 from -pi to pi
00201 
00202       if( fi2 < 0.0 ) fi2=pi2+fi2;
00203    Fi_tof = fi2;         
00204   int  Tofid2 = (int) ( Fi_tof/piby44 + 1.0 );
00205   
00206    W_tof = ( Fi_tof - piby44*( (double) Tofid -1.0 ) )/ piby44; */
00207    
00208    // get phi and z on the tof counter
00209    const HepPoint3D pivot2( tofx, tofy, 0.0);
00210    helix1.pivot(pivot2);
00211    
00212    // corrected by Ozaki san to avoid negative path length on Aug.10,99   
00213    Phi1=helix1.a()[1];
00214    Z_tof=helix1.a()[3];
00215    
00216    double dphi = (-xc*(tofx-xc)-yc*(tofy-yc))/sqrt(xc*xc+yc*yc)/fabs(rho);
00217    dphi = acos(dphi);
00218    Pathl = fabs(rho*dphi);
00219    double coscor=sqrt(1.0+Tanl*Tanl);
00220    Pathl=Pathl*coscor;
00221 
00222    // path length in tof scintillator
00223    Hep3Vector vxyz1   = helix1.direction();
00224    nx   = vxyz1(0);            // direction of track at the vertex
00225    ny   = vxyz1(1); 
00226    //   cout<<" Toffz_helix::track direction: nx="<<nx<<",ny="<<ny<<endl;
00227    double corxy=(nx*tofx+ny*tofy)/R_tof;
00228    Path_tof=4.0*coscor/corxy;
00229    // cout<<" Toffz_helix::Path_tof="<< Path_tof<<endl;
00230    if(abs(Z_tof)<115)  return (1);
00231    //  if(Z_tof>116.5){
00232  if(Z_tof>=115){
00233      Z_tof=133;
00234      Pathl=Z_tof/sin(atan(Tanl));
00235     double phi0=-(Z_tof/Tanl)/rho;
00236     double phi=-(Z_tof-Dz)/Tanl/rho;
00237     double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00238     double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00239  
00240     double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00241     double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00242     r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00243    
00244     Helix helix1(pivot1,a); 
00245 
00246    double x1_endtof=helix1.x(phi).x();
00247    double y1_endtof=helix1.x(phi).y();
00248    double z1_endtof=helix1.x(phi).z(); 
00249    
00250    double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00251    if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00252 
00253      Tofid =(int)(fi_endtof/piby24);
00254      if(Tofid>47)Tofid=Tofid-48;
00255    
00256      //  }else if (Z_tof<-116.5){
00257      return (0);
00258 
00259  }else if (Z_tof<=-115){
00260      Z_tof=-133;
00261      Pathl=Z_tof/sin(atan(Tanl));      
00262     double phi0=-(Z_tof/Tanl)/rho;
00263     double phi=-(Z_tof-Dz)/Tanl/rho;
00264     double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00265     double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00266  
00267     double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00268     double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00269     r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00270      
00271     Helix helix1(pivot1,a);   
00272  
00273     double x1_endtof=helix1.x(phi).x();
00274     double y1_endtof=helix1.x(phi).y();
00275     double z1_endtof=helix1.x(phi).z(); 
00276     
00277     double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00278     if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00279 
00280      Tofid =(int)(fi_endtof/piby24);
00281      if(Tofid>47) Tofid=Tofid-48;
00282      return (2);
00283 
00284     
00285  }
00286 
00287    }
00288    else {
00289   
00290      if(Tanl>0){
00291       Z_tof=133;
00292     
00293       Pathl=Z_tof/sin(atan(Tanl));
00294     double phi0=-(Z_tof/Tanl)/rho;
00295     double phi=-(Z_tof-Dz)/Tanl/rho;
00296     double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00297     double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00298  
00299     double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00300     double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00301      r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00302      // double x2_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi2));
00303     //double y2_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi2));
00304     //double r2_endtof=sqrt(x2_endtof * x2_endtof + y2_endtof * y2_endtof);
00305    
00306      double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00307      if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00308 
00309      Tofid =(int)(fi_endtof/piby24);
00310      if(Tofid>47)Tofid=Tofid-48;
00311      return (0);
00312 
00313      }
00314      else{
00315        Z_tof=-133;
00316        Pathl=Z_tof/sin(atan(Tanl));
00317        double phi0=-(Z_tof/Tanl)/rho;
00318        double phi=-(Z_tof-Dz)/Tanl/rho;
00319        double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00320        double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00321   
00322 
00323     double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00324     double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00325     r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00326     //double x2_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi2));
00327     //double y2_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi2));
00328     //double r2_endtof=sqrt(x2_endtof * x2_endtof + y2_endtof * y2_endtof);
00329    
00330     double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00331     if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00332 
00333      Tofid =(int)(fi_endtof/piby24);
00334      if(Tofid>47)Tofid=Tofid-48;
00335      return (2);
00336       }
00337    }
00338 
00339   if (abs(Pathl) > _pathl_cut || 
00340        Z_tof < _ztof_cutm || Z_tof > _ztof_cutx) {
00341      // Bad path length or Z_tof
00342      if (_debug) {
00343          printf("\n TofFz_helix> Trk=%3d  params(dr,phi,kappa,dz,tanl)="
00344               "(%5.1f,%6.3f,%6.4f,%6.1f,%6.3f) R_tof %5.1f\n",
00345               Id_cdfztrk,Dr,Phi0,Kappa,Dz,Tanl,R_tof);
00346       
00347        printf(" TofFz_helix> rho=%8.1f, (xc,yc)=(%8.1f,%8.1f)"
00348               " (nx,ny)=(%5.2f,%5.2f)\n",rho,xc,yc,nx,ny);
00349       
00350        printf(" TofFz_helix> tof (x,y)=(%5.1f,%5.1f) and (%5.1f,%5.1f)\n",
00351               xx[0],yy[0],xx[1],yy[1]);
00352      
00353        printf(" TofFz_helix> tofid=%3d, fitof=%6.3f, w=%5.3f"
00354               " (x,y,z)=(%5.1f,%5.1f,%5.1f)  pathl=%5.1f cm  path=%5.1f cm\n",
00355               Tofid,Fi_tof,W_tof,tofx,tofy,Z_tof,Pathl,Path_tof);
00356      }
00357                                                   return (-7);
00358    }
00359    
00360   
00361   //  return(1);
00362              
00363 }

void TofFz_helix::ztofCut double  ztof_min,
double  ztof_max
[inline]
 

00052                                                    {
00053       _ztof_cutm = ztof_min;
00054       _ztof_cutx = ztof_max;
00055     }

void TofFz_helix::ztofCut double  ztof_min,
double  ztof_max
[inline]
 

00052                                                    {
00053       _ztof_cutm = ztof_min;
00054       _ztof_cutx = ztof_max;
00055     }


Member Data Documentation

int TofFz_helix::_debug [private]
 

double TofFz_helix::_pathl_cut [private]
 

double TofFz_helix::_ztof_cutm [private]
 

double TofFz_helix::_ztof_cutx [private]
 

double TofFz_helix::Dr
 

double TofFz_helix::Dz
 

double TofFz_helix::Fi_tof
 

double TofFz_helix::Kappa
 

int TofFz_helix::NTrk
 

double TofFz_helix::Path_tof
 

double TofFz_helix::Pathl
 

double TofFz_helix::Phi0
 

double TofFz_helix::Phi1
 

double TofFz_helix::pi2 [private]
 

double TofFz_helix::piby1 [private]
 

double TofFz_helix::piby24 [private]
 

double TofFz_helix::piby44 [private]
 

double TofFz_helix::r_endtof
 

double TofFz_helix::R_tof
 

double TofFz_helix::Tanl
 

int TofFz_helix::Tofid
 

double TofFz_helix::W_tof
 

double TofFz_helix::Z_tof
 


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