/[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.37 by pam-fi, Wed Jun 6 09:36:07 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)cout << " Float_t  TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl;
401        return lnl;
402        
403    }
404    /**
405     * Returns the logarythm of the likeliwood-function of  track y-projection
406     */
407    Float_t TrkTrack::GetLnLY(){
408        float lnl=0;
409        for(int ip=0; ip<6; ip++)
410            if( YGood(ip) && taily[ip]!=0 )
411                lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) );
412        if(GetNY()>2)lnl=lnl/(GetNY()-2);
413        else lnl=0;
414        if(lnl==0)cout << " Float_t  TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl;
415        return lnl;
416        
417    }
418  //--------------------------------------  //--------------------------------------
419  //  //
420  //  //
# Line 611  void TrkTrack::SetFromMiniStruct(cMini2t Line 661  void TrkTrack::SetFromMiniStruct(cMini2t
661   *   *
662   * @see TrkParams::SetPFA(int)   * @see TrkParams::SetPFA(int)
663   */   */
664  void TrkTrack::EvaluateClusterPositions(){  Bool_t TrkTrack::EvaluateClusterPositions(){
665            
666  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;  //     cout << "void TrkTrack::GetClusterPositions() "<<endl;
667    
668      TrkParams::Load( );      TrkParams::Load( );
669      if( !TrkParams::IsLoaded() )return;      if( !TrkParams::IsLoaded() )return false;
670            
671      for(int ip=0; ip<6; ip++){      for(int ip=0; ip<6; ip++){
672  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;  //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;;
# Line 635  void TrkTrack::EvaluateClusterPositions( Line 685  void TrkTrack::EvaluateClusterPositions(
685          float bfy = 10*TrkParams::GetBY(v);//Tesla          float bfy = 10*TrkParams::GetBY(v);//Tesla
686          int ipp=ip+1;          int ipp=ip+1;
687          xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy);          xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy);
688            if(icx<0 || icy<0)return false;
689      }      }
690        return true;
691  }  }
692  /**  /**
693   * \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 725  void TrkTrack::Fit(double pfixed, int& f
725    
726      extern cMini2track track_;      extern cMini2track track_;
727      fail = 0;      fail = 0;
728    
729      FillMiniStruct(track_);      FillMiniStruct(track_);
730                
731      if(froml1!=0)EvaluateClusterPositions();      if(froml1!=0){
732            if( !EvaluateClusterPositions() ){
733                cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl;
734                FillMiniStruct(track_) ;
735                fail = 1;
736                return;
737            }
738        }else{
739            FillMiniStruct(track_);
740        }
741            
742      // if fit variables have been reset, evaluate the initial guess      // if fit variables have been reset, evaluate the initial guess
743      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 816  void TrkTrack::SetStepMin(int istepmin){
816      extern cMini2track track_;      extern cMini2track track_;
817      track_.istepmin = istepmin;      track_.istepmin = istepmin;
818  }  }
819    /**
820     * Returns 1 if the track is inside the magnet cavity
821     * Set the minimum number of steps for tracking precision
822     */
823    Bool_t TrkTrack::IsInsideCavity(){
824        float xmagntop, ymagntop, xmagnbottom, ymagnbottom;
825        xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.);
826        ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.);
827        xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.);
828        ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.);
829        if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH &&
830            ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH &&
831            xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH &&
832            ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true);
833        else return(false);
834    }
835  /**  /**
836   * 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.
837   * If no cluster is associated, ID=-1.   * If no cluster is associated, ID=-1.
# Line 972  void TrkLevel2::Dump(){ Line 1048  void TrkLevel2::Dump(){
1048          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();          for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump();
1049      }      }
1050  }  }
1051    /**
1052     * \brief Dump processing status
1053     */
1054    void TrkLevel2::StatusDump(int view){
1055        cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl;    
1056    };
1057    /**
1058     * \brief Check event status
1059     *
1060     * Check the event status, according to a flag-mask given as input.
1061     * Return true if the view passes the check.
1062     *
1063     * @param view View number (0-11)
1064     * @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet,
1065     *  no crc error, no software alarm)
1066     *
1067     * @see TrkLevel2 class definition to know how the status flag is defined
1068     *
1069     */
1070    Bool_t TrkLevel2::StatusCheck(int view, int flagmask){
1071    
1072        if( view<0 || view >= 12)return false;
1073        return !(good[view]&flagmask);
1074    
1075    };
1076    
1077    
1078  //--------------------------------------  //--------------------------------------
1079  //  //
1080  //  //

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

  ViewVC Help
Powered by ViewVC 1.1.23