/[PAMELA software]/DarthVader/TrackerLevel2/src/TrkLevel2.cpp
ViewVC logotype

Diff of /DarthVader/TrackerLevel2/src/TrkLevel2.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by pam-fi, Thu May 24 13:29:09 2007 UTC revision 1.38 by pam-fi, Fri Aug 17 13:25:14 2007 UTC
# Line 365  Int_t TrkTrack::GetLeverArmY(){ Line 365  Int_t TrkTrack::GetLeverArmY(){
365      }      }
366      return (last_plane-first_plane+1);      return (last_plane-first_plane+1);
367  }  }
368    /**
369     * Returns the reduced chi-square of track x-projection
370     */
371    Float_t  TrkTrack::GetChi2X(){
372        float chiq=0;
373        for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.);
374        if(GetNX()>3)chiq=chiq/(GetNX()-3);
375        else chiq=0;
376        if(chiq==0)cout << " Float_t  TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl;
377        return chiq;
378    }
379    /**
380     * Returns the reduced chi-square of track y-projection
381     */
382    Float_t  TrkTrack::GetChi2Y(){
383        float chiq=0;
384        for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.);
385        if(GetNY()>2)chiq=chiq/(GetNY()-2);
386        else chiq=0;
387        if(chiq==0)cout << " Float_t  TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl;
388        return chiq;
389    }
390    /**
391     * Returns the logarythm of the likeliwood-function of  track x-projection
392     */
393    Float_t TrkTrack::GetLnLX(){
394        float lnl=0;
395        for(int ip=0; ip<6; ip++)
396            if( XGood(ip) && tailx[ip]!=0 )
397                lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) );
398        if(GetNX()>3)lnl=lnl/(GetNX()-3);
399        else lnl=0;
400        if(lnl==0){
401            cout << " Float_t  TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl;
402            Dump();
403        }
404        return lnl;
405        
406    }
407    /**
408     * Returns the logarythm of the likeliwood-function of  track y-projection
409     */
410    Float_t TrkTrack::GetLnLY(){
411        float lnl=0;
412        for(int ip=0; ip<6; ip++)
413            if( YGood(ip) && taily[ip]!=0 )
414                lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) );
415        if(GetNY()>2)lnl=lnl/(GetNY()-2);
416        else lnl=0;
417        if(lnl==0){
418            cout << " Float_t  TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl;
419            Dump();
420        }
421        return lnl;
422        
423    }
424  //--------------------------------------  //--------------------------------------
425  //  //
426  //  //
# Line 611  void TrkTrack::SetFromMiniStruct(cMini2t Line 667  void TrkTrack::SetFromMiniStruct(cMini2t
667   *   *
668   * @see TrkParams::SetPFA(int)   * @see TrkParams::SetPFA(int)
669   */   */
670  void TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
671            
672  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;
673    
674      TrkParams::Load( );      TrkParams::Load( );
675      if( !TrkParams::IsLoaded() )return;      if( !TrkParams::IsLoaded() )return false;
676            
677      for(int ip=0; ip<6; ip++){      for(int ip=0; ip<6; ip++){
678  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;
# Line 635  void TrkTrack::EvaluateClusterPositions( Line 691  void TrkTrack::EvaluateClusterPositions(
691          float bfy = 10*TrkParams::GetBY(v);//Tesla          float bfy = 10*TrkParams::GetBY(v);//Tesla
692          int ipp=ip+1;          int ipp=ip+1;
693          xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy);          xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy);
694            if(icx<0 || icy<0)return false;
695      }      }
696        return true;
697  }  }
698  /**  /**
699   * \brief Tracking method. It calls F77 mini routine.   * \brief Tracking method. It calls F77 mini routine.
# Line 673  void TrkTrack::Fit(double pfixed, int& f Line 731  void TrkTrack::Fit(double pfixed, int& f
731    
732      extern cMini2track track_;      extern cMini2track track_;
733      fail = 0;      fail = 0;
734    
735      FillMiniStruct(track_);      FillMiniStruct(track_);
736                
737      if(froml1!=0)EvaluateClusterPositions();      if(froml1!=0){
738            if( !EvaluateClusterPositions() ){
739                cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl;
740                FillMiniStruct(track_) ;
741                fail = 1;
742                return;
743            }
744        }else{
745            FillMiniStruct(track_);
746        }
747            
748      // if fit variables have been reset, evaluate the initial guess      // if fit variables have been reset, evaluate the initial guess
749      if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_();      if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_();
# Line 754  void TrkTrack::SetStepMin(int istepmin){ Line 822  void TrkTrack::SetStepMin(int istepmin){
822      extern cMini2track track_;      extern cMini2track track_;
823      track_.istepmin = istepmin;      track_.istepmin = istepmin;
824  }  }
825    /**
826     * Returns 1 if the track is inside the magnet cavity
827     * Set the minimum number of steps for tracking precision
828     */
829    Bool_t TrkTrack::IsInsideCavity(){
830        float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
831        xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);
832        ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);
833        xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);
834        ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);
835        if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
836            ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
837            xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
838            ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
839        else return(false);
840    }
841  /**  /**
842   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.   * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track.
843   * If no cluster is associated, ID=-1.   * If no cluster is associated, ID=-1.
# Line 972  void TrkLevel2::Dump(){ Line 1054  void TrkLevel2::Dump(){
1054          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1055      }      }
1056  }  }
1057    /**
1058     * \brief Dump processing status
1059     */
1060    void TrkLevel2::StatusDump(int view){
1061        cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl;    
1062    };
1063    /**
1064     * \brief Check event status
1065     *
1066     * Check the event status, according to a flag-mask given as input.
1067     * Return true if the view passes the check.
1068     *
1069     * @param view View number (0-11)
1070     * @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet,
1071     *  no crc error, no software alarm)
1072     *
1073     * @see TrkLevel2 class definition to know how the status flag is defined
1074     *
1075     */
1076    Bool_t TrkLevel2::StatusCheck(int view, int flagmask){
1077    
1078        if( view<0 || view >= 12)return false;
1079        return !(good[view]&flagmask);
1080    
1081    };
1082    
1083    
1084  //--------------------------------------  //--------------------------------------
1085  //  //
1086  //  //

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.23