/[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.56 by pam-fi, Thu Feb 27 11:24:43 2014 UTC revision 1.58 by mocchiut, Wed Aug 27 14:44:37 2014 UTC
# Line 391  Int_t TrkTrack::GetLeverArmXY(){ Line 391  Int_t TrkTrack::GetLeverArmXY(){
391      return (last_plane-first_plane+1);      return (last_plane-first_plane+1);
392  }  }
393  /**  /**
394     * Returns the number of hit planes
395     */
396    Int_t TrkTrack::GetNhit()  {
397      int np=0;
398      for(Int_t ip=0; ip<6; ip++) np += (XGood(ip)||YGood(ip)) ;
399      return np;
400    };
401    /**
402   * Returns the reduced chi-square of track x-projection   * Returns the reduced chi-square of track x-projection
403   */   */
404  Float_t  TrkTrack::GetChi2X(){  Float_t  TrkTrack::GetChi2X(){
# Line 398  Float_t  TrkTrack::GetChi2X(){ Line 406  Float_t  TrkTrack::GetChi2X(){
406      for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.);      for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.);
407      if(GetNX()>3)chiq=chiq/(GetNX()-3);      if(GetNX()>3)chiq=chiq/(GetNX()-3);
408      else chiq=0;      else chiq=0;
409      if(chiq==0)cout << " Float_t  TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl;      //    if(chiq==0)cout << " Float_t  TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl;
410      return chiq;      return chiq;
411  }  }
412  /**  /**
# Line 409  Float_t  TrkTrack::GetChi2Y(){ Line 417  Float_t  TrkTrack::GetChi2Y(){
417      for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.);      for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.);
418      if(GetNY()>2)chiq=chiq/(GetNY()-2);      if(GetNY()>2)chiq=chiq/(GetNY()-2);
419      else chiq=0;      else chiq=0;
420      if(chiq==0)cout << " Float_t  TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl;      //    if(chiq==0)cout << " Float_t  TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl;
421      return chiq;      return chiq;
422  }  }
423  /**  /**
# Line 664  void TrkTrack::FillMiniStruct(cMini2trac Line 672  void TrkTrack::FillMiniStruct(cMini2trac
672    
673  //      cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl;  //      cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl;
674  //      cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl;  //      cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl;
675          track.xgood[i]=XGood(i);        track.xgood[i] = (double) XGood(i);
676          track.ygood[i]=YGood(i);          track.ygood[i] = (double) YGood(i);
677                    
678          track.xm[i]=xm[i];          track.xm[i]= (double) xm[i];
679          track.ym[i]=ym[i];          track.ym[i]= (double) ym[i];
680          track.zm[i]=zm[i];          track.zm[i]= (double) zm[i];
681                    
682  //      --- temporaneo ----------------------------  //      --- temporaneo ----------------------------
683  //      float segment = 100.;  //      float segment = 100.;
# Line 714  void TrkTrack::FillMiniStruct(cMini2trac Line 722  void TrkTrack::FillMiniStruct(cMini2trac
722              }              }
723                            
724              if(       XGood(i) && !YGood(i) ){              if(       XGood(i) && !YGood(i) ){
725                  track.xm_a[i] = xm[i] - omega * segment;                  track.xm_a[i] =  (double) xm[i] - omega * segment;
726                  track.ym_a[i] = ym[i] + segment;                  track.ym_a[i] =  (double) ym[i] + segment;
727  //          track.zm_a[i] = zm[i] + beta * segment;//not used yet  //          track.zm_a[i] = zm[i] + beta * segment;//not used yet
728                  track.xm_b[i] = xm[i] + omega * segment;                  track.xm_b[i] =  (double) xm[i] + omega * segment;
729                  track.ym_b[i] = ym[i] - segment;                  track.ym_b[i] =  (double) ym[i] - segment;
730  //          track.zm_b[i] = zm[i] - beta * segment;//not used yet  //          track.zm_b[i] = zm[i] - beta * segment;//not used yet
731              }else if( !XGood(i) && YGood(i) ){              }else if( !XGood(i) && YGood(i) ){
732                  track.xm_a[i] = xm[i] + segment;                  track.xm_a[i] =  (double) xm[i] + segment;
733                  track.ym_a[i] = ym[i] + omega * segment;                  track.ym_a[i] =  (double) ym[i] + omega * segment;
734  //          track.zm_a[i] = zm[i] - gamma * segment;//not used yet  //          track.zm_a[i] = zm[i] - gamma * segment;//not used yet
735                  track.xm_b[i] = xm[i] - segment;                  track.xm_b[i] =  (double) xm[i] - segment;
736                  track.ym_b[i] = ym[i] - omega * segment;                  track.ym_b[i] =  (double) ym[i] - omega * segment;
737  //          track.zm_b[i] = zm[i] + gamma * segment;//not used yet  //          track.zm_b[i] = zm[i] + gamma * segment;//not used yet
738              }              }
739          }          }
740                    
741          track.resx[i]=resx[i];          track.resx[i]= (double) resx[i];
742          track.resy[i]=resy[i];          track.resy[i]= (double) resy[i];
743          track.tailx[i]=tailx[i];          track.tailx[i]= (double) tailx[i];
744          track.taily[i]=taily[i];          track.taily[i]= (double) taily[i];
745      }      }
746    
747      for(int i=0; i<5; i++) track.al[i]=al[i];      for(int i=0; i<5; i++) track.al[i]= (double) al[i];
748      track.zini = 23.5;      track.zini = 23.5;
749  // ZINI = 23.5 !!! it should be the same parameter in all codes  // ZINI = 23.5 !!! it should be the same parameter in all codes
750            
# Line 747  void TrkTrack::FillMiniStruct(cMini2trac Line 755  void TrkTrack::FillMiniStruct(cMini2trac
755  void TrkTrack::SetFromMiniStruct(cMini2track *track){  void TrkTrack::SetFromMiniStruct(cMini2track *track){
756    
757      for(int i=0; i<5; i++) {      for(int i=0; i<5; i++) {
758          al[i]=track->al[i];        al[i]= (float) (track->al[i]);
759          for(int j=0; j<5; j++) coval[i][j]=track->cov[i][j];          for(int j=0; j<5; j++) coval[i][j]= (float) (track->cov[i][j]);
760      }      }
761      chi2  = track->chi2;      chi2  =  (float) (track->chi2);
762      nstep = track->nstep;      nstep =  (float) (track->nstep);
763      for(int i=0; i<6; i++){      for(int i=0; i<6; i++){
764          xv[i]  = track->xv[i];          xv[i]  =  (float) (track->xv[i]);
765          yv[i]  = track->yv[i];          yv[i]  =  (float) (track->yv[i]);
766          zv[i]  = track->zv[i];          zv[i]  =  (float) (track->zv[i]);
767          xm[i]  = track->xm[i];          xm[i]  = (float)  (track->xm[i]);
768          ym[i]  = track->ym[i];          ym[i]  =  (float) (track->ym[i]);
769          zm[i]  = track->zm[i];          zm[i]  =  (float) (track->zm[i]);
770          axv[i] = track->axv[i];          axv[i] =  (float) (track->axv[i]);
771          ayv[i] = track->ayv[i];          ayv[i] =  (float) (track->ayv[i]);      
772          resx[i] = track->resx[i]; //Elena 10th          resx[i] = (float)  (track->resx[i]); //Elena 10th
773          resy[i] = track->resy[i];          resy[i] =  (float) (track->resy[i]);
774      }      }
775            
776  }  }
# Line 2186  Float_t TrkLevel2::GetZTrk(Int_t plane_i Line 2194  Float_t TrkLevel2::GetZTrk(Int_t plane_i
2194   * (By default is created with z-coordinates inside the tracking volume)   * (By default is created with z-coordinates inside the tracking volume)
2195    */    */
2196  Trajectory::Trajectory(){  Trajectory::Trajectory(){
2197      npoint = 10;      npoint = 6;
2198      x = new float[npoint];      x = new float[npoint];
2199      y = new float[npoint];      y = new float[npoint];
2200      z = new float[npoint];      z = new float[npoint];
# Line 2253  Trajectory::Trajectory(int n, float* zin Line 2261  Trajectory::Trajectory(int n, float* zin
2261      thy = new float[npoint];      thy = new float[npoint];
2262      tl = new float[npoint];      tl = new float[npoint];
2263      int i=0;      int i=0;
2264      do{      do{      
2265          x[i] = 0;          x[i] = 0.;
2266          y[i] = 0;          y[i] = 0.;
2267          z[i] = zin[i];          z[i] = zin[i];
2268          thx[i] = 0;          thx[i] = 0.;
2269          thy[i] = 0;          thy[i] = 0.;
2270          tl[i] = 0;          tl[i] = 0.;
2271          i++;                      i++;            
2272      }while(zin[i-1] > zin[i] && i < npoint);      }while(zin[i-1] > zin[i] && i < npoint);
2273      npoint=i;      npoint=i;
2274      if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points"<<endl;      if(npoint != n)cout << "NB! Trajectory created with "<<npoint<<" points instean of "<<n<<endl;
2275        //    Dump();
2276  }  }
2277  void Trajectory::Delete(){  void Trajectory::Delete(){
2278            

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.58

  ViewVC Help
Powered by ViewVC 1.1.23