TofFz_helix Class Reference

#include <Toffz_helix.h>

List of all members.

Public Member Functions

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

Public Attributes

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

Private Attributes

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


Detailed Description

Definition at line 18 of file Toffz_helix.h.


Constructor & Destructor Documentation

TofFz_helix::TofFz_helix ( void   ) 

Definition at line 61 of file Toffz_helix.cxx.

References _debug, _pathl_cut, _ztof_cutm, _ztof_cutx, pi2, piby1, piby18, piby24, and piby44.

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

TofFz_helix::~TofFz_helix ( void   )  [inline]

Definition at line 24 of file Toffz_helix.h.

00024 {};


Member Function Documentation

void TofFz_helix::debugOpt ( int  deb  )  [inline]

Definition at line 48 of file Toffz_helix.h.

References _debug.

00048                            {
00049       _debug = deb;
00050     }

void TofFz_helix::pathlCut ( double  pathl_max  )  [inline]

Definition at line 52 of file Toffz_helix.h.

References _pathl_cut.

Referenced by EsTimeAlg::execute().

00052                                     {
00053       _pathl_cut = pathl_max;
00054     }

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

Definition at line 76 of file Toffz_helix.cxx.

References _debug, _pathl_cut, _ztof_cutx, Helix::a(), abs, Helix::center(), cos(), Helix::direction(), Dr, Dz, Etfid, Fi_tof, Kappa, Path_etf, Path_tof, Pathl, phi0, Phi0, phi1, Phi1, phi2, pi2, piby1, piby18, piby24, piby44, Helix::pivot(), r_endtof, r_etf, R_tof, Helix::radius(), sin(), Tanl, Tofid, W_tof, Helix::x(), Z_etf, and Z_tof.

Referenced by EsTimeAlg::execute().

00076                                                                {
00077    // crossing points of the helix on the tof cylinder
00078    double xc,yc;            // center of the circle
00079    double rho;              // radius of tof cyclinder
00080    double  xx[2],yy[2];      // coordinates of hits
00081    double  tofx,tofy;        // (x,y) on the radius of R_tof
00082    double  nx,ny;            // direction cosines of mom vector at vertex
00083    double  cosx,sinx;
00084    double aa,ca,cb,cc,detm;
00085   
00086    // fzisan track ID and TOF radius
00087    int Id_cdfztrk = id; R_tof = rtof;
00088 
00089     if( Id_cdfztrk<0 ) {
00090      if (_debug) std::cout << " TofFz_helix *** wrong id_cdfztrk ="
00091                            << Id_cdfztrk << std::endl;
00092                                                   return(-1);
00093    }
00094    
00095    const HepPoint3D pivot1(0.,0.,0.);
00096    HepVector  a(5,0);
00097    a[0] = fzisan[0];
00098    a[1] = fzisan[1];
00099    a[2] = fzisan[2];
00100    a[3] = fzisan[3];
00101    a[4] = fzisan[4];
00102 
00103 
00104    // Ill-fitted track in fzisan (dz=tanl=-9999.)
00105    if (abs(a[3])>50.0 || abs(a[4])>500.0)          return (-5);
00106   // if (abs(a[3])>10.0 || abs(a[4])>500.0)          return (-5);
00107 
00108    // D e f i n e   h e l i x
00109    Helix helix1(pivot1,a);
00110    Dr    = helix1.a()[0];   
00111    Phi0  = helix1.a()[1];   
00112    Kappa = helix1.a()[2];    
00113    Dz    = helix1.a()[3];   
00114    Tanl  = helix1.a()[4];
00115 
00116    // check cdfztrk hit on tof cyclinder
00117    rho  = helix1.radius(); 
00118    // cout<<" Toffz_helix:: rho  ="<<rho<<endl;  // radius of the circle in cm
00119    HepPoint3D    xyz    = helix1.center();
00120    xc   = xyz(0);
00121    yc   = xyz(1);
00122    // cout<<"Toffz_helix::helix center:xc="<<xc<<",yc= "<<yc<<endl;
00123 
00124    Hep3Vector vxyz   = helix1.direction();
00125    nx   = vxyz(0);              // direction of track at the vertex
00126    ny   = vxyz(1); 
00127    // cout<<"Toffz_helix::direction: nx= "<<nx<<", ny="<<ny<<endl;
00128   
00129    if(fabs(rho)>R_tof/2){
00130    
00131    // get hit on tof cylinder at radius R_tof;
00132 
00133    if( xc==0.0 && yc==0.0 ) return(-3); 
00134    // coefficients of quadratic equation
00135    ca = xc*xc + yc*yc ;
00136    aa = 0.5 * ( ca - rho*rho + R_tof*R_tof );
00137    
00138    if ( xc != 0.0 ) {
00139       cb = aa * yc;
00140       cc = aa*aa - R_tof*R_tof*xc*xc; 
00141       // determinant
00142       detm = cb*cb - ca*cc;
00143       if ( detm > 0.0 ) {
00144          yy[0] = ( cb + sqrt(detm) )/ ca;
00145          xx[0] = ( aa - yy[0]*yc )/xc;
00146          yy[1] = ( cb - sqrt(detm) )/ ca;
00147          xx[1] = ( aa - yy[1]*yc )/xc;
00148       } else  return(-1);
00149    }
00150    else{
00151       cb = aa * xc;
00152       cc = aa*aa - R_tof*R_tof*yc*yc;
00153       // determinant
00154       detm = cb*cb - ca*cc;
00155       if ( detm > 0.0 ) {
00156          xx[0] = ( cb + sqrt(detm) )/ca;
00157          yy[0] = ( aa - xx[0]*xc )/yc;
00158          xx[1] = ( cb - sqrt(detm) )/ca;
00159          yy[1] = ( aa - xx[1]*xc )/yc;
00160       } else return(-2);
00161    }
00162  
00163    // choose one of hits according to track direction at the vertex.
00164   
00165    if( xx[0]*nx + yy[0]*ny > 0.0 ) { tofx = xx[0]; tofy = yy[0]; }
00166    else                            { tofx = xx[1]; tofy = yy[1]; }
00167   
00168    double fi = atan2(tofy ,tofx );    // atna2 from -pi to pi
00169 
00170    
00171    if( fi < 0.0 ) fi=pi2+fi;
00172    Fi_tof = fi;         
00173    //  Tofid = (int) ( Fi_tof/piby44 + 1.0 );
00174    Tofid = (int) ( Fi_tof/piby44  );
00175    
00176    // get phi and z on the tof counter
00177    const HepPoint3D pivot2( tofx, tofy, 0.0);
00178    helix1.pivot(pivot2);
00179    
00180    // corrected by Ozaki san to avoid negative path length on Aug.10,99   
00181    Phi1=helix1.a()[1];
00182    Z_tof=helix1.a()[3];
00183    
00184    double dphi = (-xc*(tofx-xc)-yc*(tofy-yc))/sqrt(xc*xc+yc*yc)/fabs(rho);
00185    dphi = acos(dphi);
00186    Pathl = fabs(rho*dphi);
00187    double coscor=sqrt(1.0+Tanl*Tanl);
00188    Pathl=Pathl*coscor;
00189 
00190    // path length in tof scintillator
00191    Hep3Vector vxyz1   = helix1.direction();
00192    nx   = vxyz1(0);            // direction of track at the vertex
00193    ny   = vxyz1(1); 
00194    //   cout<<" Toffz_helix::track direction: nx="<<nx<<",ny="<<ny<<endl;
00195    double corxy=(nx*tofx+ny*tofy)/R_tof;
00196    Path_tof=4.0*coscor/corxy;
00197    // cout<<" Toffz_helix::Path_tof="<< Path_tof<<endl;
00198    if(abs(Z_tof)<115)  return (1);
00199    //  if(Z_tof>116.5){
00200 
00201 
00202    //std::cout << "   helix1.a()[3]    " << helix1.a()[3] <<std::endl;
00203 
00204    if(Z_tof>=115){
00205      // Scintillator East Endcap TOF
00206      Z_tof = 133;
00207      Pathl = Z_tof/sin(atan(Tanl));
00208      double phi0 = -(Z_tof/Tanl)/rho;
00209      double phi  = -(Z_tof-Dz)/Tanl/rho;
00210      double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00211      double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00212      
00213      double x_endtof = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00214      double y_endtof = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00215      r_endtof = sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00216      
00217      Helix helix1(pivot1,a); 
00218      
00219      double x1_endtof=helix1.x(phi).x();
00220      double y1_endtof=helix1.x(phi).y();
00221      double z1_endtof=helix1.x(phi).z(); 
00222      
00223      double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00224      if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00225      
00226      Tofid =(int)(fi_endtof/piby24);
00227      if(Tofid>47)Tofid=Tofid-48;
00228    
00229      // MRPC East Endcap TOF
00230      // using hardware provide number: 1330+1+1+4.73 / mingming 133.7
00231      double Z_etf_1 = 133.673;
00232      double Pathl_1 = Z_etf_1/sin(atan(Tanl));
00233      double phi0_1 = -(Z_etf_1/Tanl)/rho;
00234      double phi_1  = -(Z_etf_1-Dz)/Tanl/rho;
00235      double phi1_1 = (Z_etf_1*Kappa*0.003)/Tanl;
00236      double phi2_1 = (Z_etf_1-Dz)*Kappa*0.003/Tanl;
00237      
00238      double x1_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_1));
00239      double y1_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_1));
00240      double r_etf_1 = sqrt( x1_etf*x1_etf + y1_etf*y1_etf );
00241      
00242      double x_etf_1 = helix1.x(phi_1).x();
00243      double y_etf_1 = helix1.x(phi_1).y();
00244      double z_etf_1 = helix1.x(phi_1).z(); 
00245      
00246      // the sysmetric axis of east endcap has a degree shift
00247      double fi_etf_1 = atan2( y1_etf, x1_etf ) + 1.25*piby1/180.0;
00248      if( fi_etf_1<0 ) { fi_etf_1 = pi2 + fi_etf_1; }
00249 
00250      int Etfid_1 = (int)(fi_etf_1/piby18);
00251      if( Etfid_1>35 ) { Etfid_1 = Etfid_1 - 36; }
00252      
00253      // Inner Layer
00254      if( Etfid_1%2 == 1 ) {
00255        Etfid = Etfid_1;
00256        r_etf = r_etf_1;
00257        Z_etf = Z_etf_1;
00258        Path_etf = Pathl_1;
00259      }
00260      // Outer Layer
00261      else {
00262        // using hardware provide number 1357.5+1+2.5+4.73 / mingming 136.4
00263        double Z_etf_2 = 136.573;
00264        double Pathl_2 = Z_etf_2/sin(atan(Tanl));
00265        double phi0_2 = -(Z_etf_2/Tanl)/rho;
00266        double phi_2  = -(Z_etf_2-Dz)/Tanl/rho;
00267        double phi1_2 = (Z_etf_2*Kappa*0.003)/Tanl;
00268        double phi2_2 = (Z_etf_2-Dz)*Kappa*0.003/Tanl;
00269        
00270        double x2_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_2));
00271        double y2_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_2));
00272        double r_etf_2 = sqrt( x2_etf*x2_etf + y2_etf*y2_etf );
00273        
00274        double x_etf_2 = helix1.x(phi_2).x();
00275        double y_etf_2 = helix1.x(phi_2).y();
00276        double z_etf_2 = helix1.x(phi_2).z(); 
00277        
00278        // the sysmetric axis of east endcap has a 3.75 degree shift
00279        double fi_etf_2 = atan2( y2_etf, x2_etf ) + 1.25*piby1/180.0 ;
00280        if( fi_etf_2<0 ) { fi_etf_2 = pi2 + fi_etf_2; }
00281        
00282        int Etfid_2 = (int)(fi_etf_2/piby18);
00283        if( Etfid_2>35 ) { Etfid_2 = Etfid_2 - 36; }
00284        
00285        if( Etfid_2%2 == 1 ) {
00286          int tmp1 = (int)((fi_etf_2+0.5*piby18)/piby18);
00287          int tmp2 = (int)((fi_etf_2-0.5*piby18)/piby18);
00288          if( tmp1 == Etfid_2 ) { Etfid_2 = tmp2; }
00289          else { Etfid_2 = tmp1; }
00290        }
00291        
00292        Etfid = Etfid_2;
00293        r_etf = r_etf_2;
00294        Z_etf = Z_etf_2;
00295        Path_etf = Pathl_2;
00296      }
00297 
00298      return (0);
00299 
00300    }
00301    else if (Z_tof<=-115){
00302      // Scintillator West Endcap TOF
00303      Z_tof = -133;
00304      Pathl = Z_tof/sin(atan(Tanl));
00305      double phi0 = -(Z_tof/Tanl)/rho;
00306      double phi  = -(Z_tof-Dz)/Tanl/rho;
00307      double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00308      double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00309      
00310      double x_endtof = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00311      double y_endtof = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00312      r_endtof = sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00313      
00314      Helix helix1(pivot1,a);   
00315      
00316      double x1_endtof=helix1.x(phi).x();
00317      double y1_endtof=helix1.x(phi).y();
00318      double z1_endtof=helix1.x(phi).z(); 
00319      
00320      double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00321      if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00322      
00323      Tofid =(int)(fi_endtof/piby24);
00324      if(Tofid>47) Tofid=Tofid-48;
00325 
00326      // MRPC West Endcap TOF
00327      double Z_etf_1 = -133.673;
00328      double Pathl_1 = Z_etf_1/sin(atan(Tanl));
00329      double phi0_1 = -(Z_etf_1/Tanl)/rho;
00330      double phi_1  = -(Z_etf_1-Dz)/Tanl/rho;
00331      double phi1_1 = (Z_etf_1*Kappa*0.003)/Tanl;
00332      double phi2_1 = (Z_etf_1-Dz)*Kappa*0.003/Tanl;
00333      
00334      double x1_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_1));
00335      double y1_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_1));
00336      double r_etf_1 = sqrt( x1_etf*x1_etf + y1_etf*y1_etf );
00337      
00338      double x_etf_1 = helix1.x(phi_1).x();
00339      double y_etf_1 = helix1.x(phi_1).y();
00340      double z_etf_1 = helix1.x(phi_1).z(); 
00341      
00342      // the sysmetric axis of west endcap has a 16.25 degree shift
00343      double fi_etf_1 = atan2( y1_etf, x1_etf ) - 11.25*piby1/180.0;
00344      if( fi_etf_1<0 ) { fi_etf_1 = pi2 + fi_etf_1; }
00345      
00346      int Etfid_1 = (int)(fi_etf_1/piby18);
00347      if( Etfid_1>35 ) { Etfid_1 = Etfid_1 - 36; }
00348      
00349      // Inner Layer
00350      if( Etfid_1%2 == 1 ) {
00351        Etfid = Etfid_1;
00352        r_etf = r_etf_1;
00353        Z_etf = Z_etf_1;
00354        Path_etf = Pathl_1;
00355      }
00356      // Outer Layer
00357      else {
00358        double Z_etf_2 = -136.573;
00359        double Pathl_2 = Z_etf_2/sin(atan(Tanl));
00360        double phi0_2 = -(Z_etf_2/Tanl)/rho;
00361        double phi_2  = -(Z_etf_2-Dz)/Tanl/rho;
00362        double phi1_2 = (Z_etf_2*Kappa*0.003)/Tanl;
00363        double phi2_2 = (Z_etf_2-Dz)*Kappa*0.003/Tanl;
00364        
00365        double x2_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_2));
00366        double y2_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_2));
00367        double r_etf_2 = sqrt( x2_etf*x2_etf + y2_etf*y2_etf );
00368        
00369        double x_etf_2 = helix1.x(phi_2).x();
00370        double y_etf_2 = helix1.x(phi_2).y();
00371        double z_etf_2 = helix1.x(phi_2).z(); 
00372        
00373        // the sysmetric axis of west endcap has a 16.25 degree shift
00374        double fi_etf_2 = atan2( y2_etf, x2_etf ) - 11.25*piby1/180.0;
00375        if( fi_etf_2<0 ) { fi_etf_2 = pi2 + fi_etf_2; }
00376        
00377        int Etfid_2 = (int)(fi_etf_2/piby18);
00378        if( Etfid_2>35 ) { Etfid_2 = Etfid_2 - 36; }
00379        
00380        if( Etfid_2%2 == 1 ) {
00381          int tmp1 = (int)((fi_etf_2+0.5*piby18)/piby18);
00382          int tmp2 = (int)((fi_etf_2-0.5*piby18)/piby18);
00383          if( tmp1 == Etfid_2 ) { Etfid_2 = tmp2; }
00384          else { Etfid_2 = tmp1; }
00385        }
00386        
00387        Etfid = Etfid_2;
00388        r_etf = r_etf_2;
00389        Z_etf = Z_etf_2;
00390        Path_etf = Pathl_2;
00391      }
00392 
00393      return (2);
00394 
00395    }
00396 
00397    }
00398    else {
00399      if(Tanl>0){
00400        // Scintillator East Endcap TOF
00401        Z_tof = 133;
00402        Pathl = Z_tof/sin(atan(Tanl));
00403        double phi0 = -(Z_tof/Tanl)/rho;
00404        double phi  = -(Z_tof-Dz)/Tanl/rho;
00405        double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00406        double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00407        
00408        double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00409        double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00410        r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00411        
00412        double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00413        if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00414        Tofid =(int)(fi_endtof/piby24);
00415        if(Tofid>47)Tofid=Tofid-48;
00416      
00417        // MRPC East Endcap TOF
00418        double Z_etf_1 = 133.673;
00419        double Pathl_1 = Z_etf_1/sin(atan(Tanl));
00420        double phi0_1 = -(Z_etf_1/Tanl)/rho;
00421        double phi_1  = -(Z_etf_1-Dz)/Tanl/rho;
00422        double phi1_1 = (Z_etf_1*Kappa*0.003)/Tanl;
00423        double phi2_1 = (Z_etf_1-Dz)*Kappa*0.003/Tanl;
00424      
00425        double x1_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_1));
00426        double y1_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_1));
00427        double r_etf_1 = sqrt( x1_etf*x1_etf + y1_etf*y1_etf );
00428 
00429        double x_etf_1 = helix1.x(phi_1).x();
00430        double y_etf_1 = helix1.x(phi_1).y();
00431        double z_etf_1 = helix1.x(phi_1).z(); 
00432        
00433        // the sysmetric axis of east endcap has a 3.75 degree shift
00434        double fi_etf_1 = atan2( y1_etf, x1_etf ) + 1.25*piby1/180.0;
00435        if( fi_etf_1<0 ) { fi_etf_1 = pi2 + fi_etf_1; }
00436        
00437        int Etfid_1 = (int)(fi_etf_1/piby18);
00438        if( Etfid_1>35 ) { Etfid_1 = Etfid_1 - 36; }
00439        
00440        // Inner Layer
00441        if( Etfid_1%2 == 1 ) {
00442          Etfid = Etfid_1;
00443          r_etf = r_etf_1;
00444          Z_etf = Z_etf_1;
00445          Path_etf = Pathl_1;
00446        }
00447        // Outer Layer
00448        else {
00449          double Z_etf_2 = 136.573;
00450          double Pathl_2 = Z_etf_2/sin(atan(Tanl));
00451          double phi0_2 = -(Z_etf_2/Tanl)/rho;
00452          double phi_2  = -(Z_etf_2-Dz)/Tanl/rho;
00453          double phi1_2 = (Z_etf_2*Kappa*0.003)/Tanl;
00454          double phi2_2 = (Z_etf_2-Dz)*Kappa*0.003/Tanl;
00455          
00456          double x2_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_2));
00457          double y2_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_2));
00458          double r_etf_2 = sqrt( x2_etf*x2_etf + y2_etf*y2_etf );
00459          
00460          double x_etf_2 = helix1.x(phi_2).x();
00461          double y_etf_2 = helix1.x(phi_2).y();
00462          double z_etf_2 = helix1.x(phi_2).z(); 
00463          
00464          // the sysmetric axis of east endcap has a 3.75 degree shift
00465          double fi_etf_2 = atan2( y2_etf, x2_etf ) + 1.25*piby1/180.0;
00466          if( fi_etf_2<0 ) { fi_etf_2 = pi2 + fi_etf_2; }
00467          
00468          int Etfid_2 = (int)(fi_etf_2/piby18);
00469          if( Etfid_2>35 ) { Etfid_2 = Etfid_2 - 36; }
00470          
00471          if( Etfid_2%2 == 1 ) {
00472            int tmp1 = (int)((fi_etf_2+0.5*piby18)/piby18);
00473            int tmp2 = (int)((fi_etf_2-0.5*piby18)/piby18);
00474            if( tmp1 == Etfid_2 ) { Etfid_2 = tmp2; }
00475            else { Etfid_2 = tmp1; }
00476          }
00477          Etfid = Etfid_2;
00478          r_etf = r_etf_2;
00479          Z_etf = Z_etf_2;
00480          Path_etf = Pathl_2;
00481        }
00482 
00483        return (0);
00484      }
00485      else{
00486        // Scintillator West Endcap TOF
00487        Z_tof = -133;
00488        Pathl = Z_tof/sin(atan(Tanl));
00489        double phi0 = -(Z_tof/Tanl)/rho;
00490        double phi  = -(Z_tof-Dz)/Tanl/rho;
00491        double phi1 = (Z_tof*Kappa*0.003)/Tanl;
00492        double phi2 = (Z_tof-Dz)*Kappa*0.003/Tanl;
00493        
00494        double x_endtof=Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi));
00495        double y_endtof=Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi));
00496        r_endtof=sqrt(x_endtof * x_endtof + y_endtof * y_endtof);
00497        
00498        double fi_endtof = atan2(y_endtof,x_endtof );    // atna2 from -pi to pi
00499        if (fi_endtof<0) fi_endtof=pi2+fi_endtof;
00500        Tofid =(int)(fi_endtof/piby24);
00501        if(Tofid>47)Tofid=Tofid-48;
00502      
00503        // MRPC West Endcap TOF
00504        double Z_etf_1 = -133.673;
00505        double Pathl_1 = Z_etf_1/sin(atan(Tanl));
00506        double phi0_1 = -(Z_etf_1/Tanl)/rho;
00507        double phi_1  = -(Z_etf_1-Dz)/Tanl/rho;
00508        double phi1_1 = (Z_etf_1*Kappa*0.003)/Tanl;
00509        double phi2_1 = (Z_etf_1-Dz)*Kappa*0.003/Tanl;
00510        
00511        double x1_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_1));
00512        double y1_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_1));
00513        double r_etf_1 = sqrt( x1_etf*x1_etf + y1_etf*y1_etf );
00514        
00515        double x_etf_1 = helix1.x(phi_1).x();
00516        double y_etf_1 = helix1.x(phi_1).y();
00517        double z_etf_1 = helix1.x(phi_1).z(); 
00518        
00519        // the sysmetric axis of west endcap has a 16.25 degree shift
00520        double fi_etf_1 = atan2( y1_etf, x1_etf ) - 11.25*piby1/180.0;
00521        if( fi_etf_1<0 ) { fi_etf_1 = pi2 + fi_etf_1; }
00522        
00523        int Etfid_1 = (int)(fi_etf_1/piby18);
00524        if( Etfid_1>35 ) { Etfid_1 = Etfid_1 - 36; }
00525        
00526        if( Etfid_1%2 == 1 ) {
00527          Etfid = Etfid_1;
00528          r_etf = r_etf_1;
00529          Z_etf = Z_etf_1;
00530          Path_etf = Pathl_1;
00531        }
00532        else {
00533          double Z_etf_2 = -136.573;
00534          double Pathl_2 = Z_etf_2/sin(atan(Tanl));
00535          double phi0_2 = -(Z_etf_2/Tanl)/rho;
00536          double phi_2  = -(Z_etf_2-Dz)/Tanl/rho;
00537          double phi1_2 = (Z_etf_2*Kappa*0.003)/Tanl;
00538          double phi2_2 = (Z_etf_2-Dz)*Kappa*0.003/Tanl;
00539          
00540          double x2_etf = Dr*cos(Phi0)+(1/(Kappa*0.003))*(cos(Phi0)-cos(Phi0+phi_2));
00541          double y2_etf = Dr*sin(Phi0)+(1/(Kappa*0.003))*(sin(Phi0)-sin(Phi0+phi_2));
00542          int r_etf_2 = sqrt( x2_etf*x2_etf + y2_etf*y2_etf );
00543          
00544          double x_etf_2 = helix1.x(phi_2).x();
00545          double y_etf_2 = helix1.x(phi_2).y();
00546          double z_etf_2 = helix1.x(phi_2).z(); 
00547          
00548          // the sysmetric axis of west endcap has a 16.25 degree shift
00549          double fi_etf_2 = atan2( y2_etf, x2_etf ) - 11.25*piby1/180.0;
00550          if( fi_etf_2<0 ) { fi_etf_2 = pi2 + fi_etf_2; }
00551          
00552          int Etfid_2 = (int)(fi_etf_2/piby18);
00553          if( Etfid_2>35 ) { Etfid_2 = Etfid_2 - 36; }
00554          
00555          if( Etfid_2%2 == 1 ) {
00556            int tmp1 = (int)((fi_etf_2+0.5*piby18)/piby18);
00557            int tmp2 = (int)((fi_etf_2-0.5*piby18)/piby18);
00558            if( tmp1 == Etfid_2 ) { Etfid_2 = tmp2; }
00559            else { Etfid_2 = tmp1; }
00560          }
00561          
00562          Etfid = Etfid_2;
00563          r_etf = r_etf_2;
00564          Z_etf = Z_etf_2;
00565          Path_etf = Pathl_2;
00566        }
00567 
00568        return (2);
00569      }
00570    }
00571 
00572    if (abs(Pathl) > _pathl_cut || 
00573        Z_tof < _ztof_cutm || Z_tof > _ztof_cutx) {
00574      // Bad path length or Z_tof
00575      if (_debug) {
00576        printf("\n TofFz_helix> Trk=%3d  params(dr,phi,kappa,dz,tanl)="
00577               "(%5.1f,%6.3f,%6.4f,%6.1f,%6.3f) R_tof %5.1f\n",
00578               Id_cdfztrk,Dr,Phi0,Kappa,Dz,Tanl,R_tof);
00579        
00580        printf(" TofFz_helix> rho=%8.1f, (xc,yc)=(%8.1f,%8.1f)"
00581               " (nx,ny)=(%5.2f,%5.2f)\n",rho,xc,yc,nx,ny);
00582       
00583        printf(" TofFz_helix> tof (x,y)=(%5.1f,%5.1f) and (%5.1f,%5.1f)\n",
00584               xx[0],yy[0],xx[1],yy[1]);
00585      
00586        printf(" TofFz_helix> tofid=%3d, fitof=%6.3f, w=%5.3f"
00587               " (x,y,z)=(%5.1f,%5.1f,%5.1f)  pathl=%5.1f cm  path=%5.1f cm\n",
00588               Tofid,Fi_tof,W_tof,tofx,tofy,Z_tof,Pathl,Path_tof);
00589      }
00590      return (-7);
00591    }
00592           
00593 }

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

Definition at line 56 of file Toffz_helix.h.

References _ztof_cutm, and _ztof_cutx.

Referenced by EsTimeAlg::execute().

00056                                                    {
00057       _ztof_cutm = ztof_min;
00058       _ztof_cutx = ztof_max;
00059     }


Member Data Documentation

int TofFz_helix::_debug [private]

Definition at line 63 of file Toffz_helix.h.

Referenced by debugOpt(), TofFz_Get(), and TofFz_helix().

double TofFz_helix::_pathl_cut [private]

Definition at line 64 of file Toffz_helix.h.

Referenced by pathlCut(), TofFz_Get(), and TofFz_helix().

double TofFz_helix::_ztof_cutm [private]

Definition at line 65 of file Toffz_helix.h.

Referenced by TofFz_helix(), and ztofCut().

double TofFz_helix::_ztof_cutx [private]

Definition at line 65 of file Toffz_helix.h.

Referenced by TofFz_Get(), TofFz_helix(), and ztofCut().

double TofFz_helix::Dr

Definition at line 39 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Dz

Definition at line 39 of file Toffz_helix.h.

Referenced by TofFz_Get().

int TofFz_helix::Etfid

Definition at line 28 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::Fi_tof

Definition at line 30 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Kappa

Definition at line 39 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

int TofFz_helix::NTrk

Definition at line 40 of file Toffz_helix.h.

double TofFz_helix::Path_etf

Definition at line 34 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::Path_tof

Definition at line 33 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Pathl

Definition at line 32 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::Phi0

Definition at line 39 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Phi1

Definition at line 41 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::pi2 [private]

Definition at line 62 of file Toffz_helix.h.

Referenced by TofFz_Get(), and TofFz_helix().

double TofFz_helix::piby1 [private]

Definition at line 62 of file Toffz_helix.h.

Referenced by TofFz_Get(), and TofFz_helix().

double TofFz_helix::piby18 [private]

Definition at line 62 of file Toffz_helix.h.

Referenced by TofFz_Get(), and TofFz_helix().

double TofFz_helix::piby24 [private]

Definition at line 62 of file Toffz_helix.h.

Referenced by TofFz_Get(), and TofFz_helix().

double TofFz_helix::piby44 [private]

Definition at line 62 of file Toffz_helix.h.

Referenced by TofFz_Get(), and TofFz_helix().

double TofFz_helix::r_endtof

Definition at line 42 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::r_etf

Definition at line 43 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::R_tof

Definition at line 29 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Tanl

Definition at line 39 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

int TofFz_helix::Tofid

Definition at line 24 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::W_tof

Definition at line 31 of file Toffz_helix.h.

Referenced by TofFz_Get().

double TofFz_helix::Z_etf

Definition at line 36 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().

double TofFz_helix::Z_tof

Definition at line 35 of file Toffz_helix.h.

Referenced by EsTimeAlg::execute(), and TofFz_Get().


Generated on Tue Nov 29 23:36:05 2016 for BOSS_7.0.2 by  doxygen 1.4.7