]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCseed.cxx
Updated flags for low flux case (A. Dainese)
[u/mrichter/AliRoot.git] / TPC / AliTPCseed.cxx
index ea4d8e042853383a661e605ea4b25cf4367a60e5..324a27f4b4a1b0ce8156f70c7ed9e6efb876e978 100644 (file)
@@ -591,8 +591,8 @@ Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_
   for (Int_t of =0; of<4; of++){    
     for (Int_t i=of+i1;i<i2;i+=4)
       {
-       Int_t index = fIndex[i];
-       if (index<0||index&0x8000) continue;
+       Int_t clindex = fIndex[i];
+       if (clindex<0||clindex&0x8000) continue;
 
        //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
        AliTPCTrackerPoint * point = GetTrackPoint(i);
@@ -1208,3 +1208,185 @@ Float_t  AliTPCseed::CookShape(Int_t type){
   Float_t mean = (meanc>0)? means/meanc:0;
   return mean;
 }
+
+
+
+Int_t  AliTPCseed::RefitTrack(AliTPCseed *seed, AliExternalTrackParam * parin, AliExternalTrackParam * parout){
+  //
+  // Refit the track
+  // return value - number of used clusters
+  // 
+  //
+  const Int_t kMinNcl =10;
+  AliTPCseed *track=new AliTPCseed(*seed);
+  Int_t sector=-1;
+  // reset covariance
+  //
+  Double_t covar[15];
+  for (Int_t i=0;i<15;i++) covar[i]=0;
+  covar[0]=10.*10.;
+  covar[2]=10.*10.;
+  covar[5]=10.*10./(64.*64.);
+  covar[9]=10.*10./(64.*64.);
+  covar[14]=1*1;
+  //
+
+  Float_t xmin=1000, xmax=-10000;
+  Int_t imin=158, imax=0;
+  for (Int_t i=0;i<160;i++) {
+    AliTPCclusterMI *c=track->GetClusterPointer(i);
+    if (!c) continue;
+    if (sector<0) sector = c->GetDetector();
+    if (c->GetX()<xmin) xmin=c->GetX();
+    if (c->GetX()>xmax) xmax=c->GetX();
+    if (i<imin) imin=i;
+    if (i>imax) imax=i;
+  }
+  if(imax-imin<kMinNcl) {
+    delete track;
+    return 0 ;
+  }
+  // Not succes to rotate
+  if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+    delete track;
+    return 0;
+  }
+  //
+  //
+  // fit from inner to outer row
+  //
+  AliExternalTrackParam paramIn;
+  AliExternalTrackParam paramOut;
+  Bool_t isOK=kTRUE;
+  Int_t ncl=0;
+  //
+  //
+  //
+  for (Int_t i=imin; i<=imax; i++){
+    AliTPCclusterMI *c=track->GetClusterPointer(i);
+    if (!c) continue;
+    //    if (RejectCluster(c,track)) continue;
+    sector = (c->GetDetector()%18);
+    if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+      //continue;
+    }
+    Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+    Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+    if (!track->PropagateTo(r[0])) {
+      isOK=kFALSE;
+    }
+    if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+  }
+  if (!isOK) { delete track; return 0;}
+  track->AddCovariance(covar);
+  //
+  //
+  //
+  for (Int_t i=imax; i>=imin; i--){
+    AliTPCclusterMI *c=track->GetClusterPointer(i);
+    if (!c) continue;
+    //if (RejectCluster(c,track)) continue;
+    sector = (c->GetDetector()%18);
+    if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+      //continue;
+    }
+    Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+    Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+    if (!track->PropagateTo(r[0])) {
+      isOK=kFALSE;
+    }
+    if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+  }
+  //if (!isOK) { delete track; return 0;}
+  paramIn = *track;
+  track->AddCovariance(covar);
+  //
+  //
+  for (Int_t i=imin; i<=imax; i++){
+    AliTPCclusterMI *c=track->GetClusterPointer(i);
+    if (!c) continue;
+    sector = (c->GetDetector()%18);
+    if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+      //continue;
+    }
+    ncl++;
+    //if (RejectCluster(c,track)) continue;
+    Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+    Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+    if (!track->PropagateTo(r[0])) {
+      isOK=kFALSE;
+    }
+    if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+  }
+  //if (!isOK) { delete track; return 0;}
+  paramOut=*track;
+  //
+  //
+  //
+  if (parin) (*parin)=paramIn;
+  if (parout) (*parout)=paramOut;
+  return ncl;
+}
+
+
+
+Bool_t AliTPCseed::RefitTrack(AliTPCseed* /*seed*/, Bool_t /*out*/){
+  //
+  //
+  //
+  return kFALSE;
+}
+
+
+
+
+
+
+void  AliTPCseed::GetError(AliTPCclusterMI* cluster, AliExternalTrackParam * param, 
+                                 Double_t& erry, Double_t &errz)
+{
+  //
+  // Get cluster error at given position
+  //
+  AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
+  Double_t tany,tanz;  
+  Double_t snp1=param->GetSnp();
+  tany=snp1/TMath::Sqrt(1.-snp1*snp1);
+  //
+  Double_t tgl1=param->GetTgl();
+  tanz=tgl1/TMath::Sqrt(1.-snp1*snp1);
+  //
+  Int_t padSize = 0;                          // short pads
+  if (cluster->GetDetector() >= 36) {
+    padSize = 1;                              // medium pads 
+    if (cluster->GetRow() > 63) padSize = 2; // long pads
+  }
+
+  erry  = clusterParam->GetError0Par( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany) );
+  errz  = clusterParam->GetError0Par( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) );
+}
+
+
+void  AliTPCseed::GetShape(AliTPCclusterMI* cluster, AliExternalTrackParam * param, 
+                                 Double_t& rmsy, Double_t &rmsz)
+{
+  //
+  // Get cluster error at given position
+  //
+  AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
+  Double_t tany,tanz;  
+  Double_t snp1=param->GetSnp();
+  tany=snp1/TMath::Sqrt(1.-snp1*snp1);
+  //
+  Double_t tgl1=param->GetTgl();
+  tanz=tgl1/TMath::Sqrt(1.-snp1*snp1);
+  //
+  Int_t padSize = 0;                          // short pads
+  if (cluster->GetDetector() >= 36) {
+    padSize = 1;                              // medium pads 
+    if (cluster->GetRow() > 63) padSize = 2; // long pads
+  }
+
+  rmsy  = clusterParam->GetRMSQ( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany), TMath::Abs(cluster->GetMax()) );
+  rmsz  = clusterParam->GetRMSQ( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ,TMath::Abs(cluster->GetMax()));
+}