]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCcalibCalib.cxx
Add histograms with masked regions due to frame, setting of the regions added, some...
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibCalib.cxx
index 4383d6d8add41c42a1111ee62705256ca082e2d3..30358727a28934dedd4c6c178624863bc31c1acf 100644 (file)
@@ -153,7 +153,8 @@ void     AliTPCcalibCalib::Process(AliESDEvent *event){
     AliESDtrack *track = event->GetTrack(i);     
     AliESDfriendTrack *friendTrack = (AliESDfriendTrack*) ESDfriend->GetTrack(i);
     if (!friendTrack) continue;
-    track->SetFriendTrack(friendTrack);
+    //track->SetFriendTrack(friendTrack);
+    fCurrentFriendTrack=friendTrack;
     const AliExternalTrackParam * trackIn  = track->GetInnerParam();
     const AliExternalTrackParam * trackOut = track->GetOuterParam();
     AliExternalTrackParam * tpcOut   = (AliExternalTrackParam *)friendTrack->GetTPCOut();
@@ -180,7 +181,16 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   //
   // 0 - Setup transform object
   //
-  AliESDfriendTrack *friendTrack = (AliESDfriendTrack *)track->GetFriendTrack();
+  const Double_t kxIFC = 83.;   // position of IFC
+  const Double_t kxOFC = 250.;  // position of OFC
+  const Double_t kaFC = 1.;    // amplitude 
+  const Double_t ktFC = 5.0;    // slope of error 
+  //cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+  //cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+
+  static Int_t streamCounter=0;
+  streamCounter++;
+  AliESDfriendTrack *friendTrack = fCurrentFriendTrack;
 
   AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
   AliTPCParam     *param     = AliTPCcalibDB::Instance()->GetParameters();
@@ -214,43 +224,6 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     if (cluster->GetDetector()>35) ipad=1;
     Float_t dy =0;//AliTPCClusterParam::SPosCorrection(0,ipad,cluster->GetPad(),cluster->GetTimeBin(),cluster->GetZ(),cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax());
     Float_t dz =0;//AliTPCClusterParam::SPosCorrection(1,ipad,cluster->GetPad(),cluster->GetTimeBin(),cluster->GetZ(),cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax());
-    // if(fApplyPositionCorrection) {
-    //x[1]-=dy;
-    //x[2]-=dz;
-    // }
-    //
-    // Apply sector alignment
-    //
-    Double_t dxq = AliTPCPointCorrection::SGetCorrectionSector(0,cluster->GetDetector()%36,cluster->GetX(),
-                                                              cluster->GetY(),cluster->GetZ());
-    Double_t dyq = AliTPCPointCorrection::SGetCorrectionSector(1,cluster->GetDetector()%36,cluster->GetX(),
-                                                              cluster->GetY(),cluster->GetZ());
-    Double_t dzq = AliTPCPointCorrection::SGetCorrectionSector(2,cluster->GetDetector()%36,cluster->GetX(),
-                                                              cluster->GetY(),cluster->GetZ());
-    if (0&fApplySectorAlignment){
-      x[0]-=dxq;
-      x[1]-=dyq;
-      x[2]-=dzq;
-    }
-//     //
-//     // Apply r-phi correction  - To be done on track level- knowing the track angle !!!
-//     //
-//     Double_t corrclY =  
-//       corr->RPhiCOGCorrection(cluster->GetDetector(),cluster->GetRow(), cluster->GetPad(),
-//                               cluster->GetY(),cluster->GetY(), cluster->GetZ(), 0., cluster->GetMax(),2.5);
-//     // R correction
-//     Double_t corrR   = corr->CorrectionOutR0(kFALSE,kFALSE,cluster->GetX(),cluster->GetY(),cluster->GetZ(),cluster->GetDetector());
-
-//     if (0&fApplyRPhiCorrection){
-//       if (cluster->GetY()>0) x[1]+=corrclY;  // rphi correction
-//       if (cluster->GetY()<0) x[1]-=corrclY;  // rphi correction
-//     }
-//     if (0&fApplyRCorrection){      
-//       x[0]+=corrR;                           // radial correction
-//     }
-
-    //
-    //
     //
     cluster->SetX(x[0]);
     cluster->SetY(x[1]);
@@ -259,7 +232,7 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     //
     // Apply alignemnt
     //
-    if (1){
+    if (transform->GetCurrentRecoParam()->GetUseSectorAlignment()){
       if (!param->IsGeoRead()) param->ReadGeoMatrices();
       TGeoHMatrix  *mat = param->GetClusterMatrix(cluster->GetDetector());
       //TGeoHMatrix  mat;
@@ -276,7 +249,8 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
 
 
 
-    if (fStreamLevel>2){
+    if (fStreamLevel>2 && streamCounter<20*fStreamLevel ){
+      // dump debug info if required
       TTreeSRedirector *cstream = GetDebugStreamer();
       if (cstream){
        (*cstream)<<"Clusters"<<
@@ -290,11 +264,6 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
          "cl.="<<cluster<<
          "cy="<<dy<<
          "cz="<<dz<<
-         //      "cY="<<corrclY<<
-         //      "cR="<<corrR<<
-         "dxq="<<dxq<<
-         "dyq="<<dyq<<
-         "dzq="<<dzq<<
          "\n";
       }
     }
@@ -352,11 +321,13 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     AliTPCseed::GetError(cl, &trackIn,cov[0],cov[2]);
     cov[0]*=cov[0];
     cov[2]*=cov[2];
+    cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+    cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     trackIn.GetXYZ(xyz);
     //    Double_t bz = AliTracker::GetBz(xyz);
 
     //    if (!trackIn.PropagateTo(r[0],bz)) continue;
-    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,1.,kFALSE)) continue;
 
     if (RejectCluster(cl,&trackIn)) continue;
     nclIn++;
@@ -391,10 +362,12 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     AliTPCseed::GetError(cl, &trackOut,cov[0],cov[2]);
     cov[0]*=cov[0];
     cov[2]*=cov[2];
+    cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+    cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     trackOut.GetXYZ(xyz);
     //Double_t bz = AliTracker::GetBz(xyz);
     //    if (!trackOut.PropagateTo(r[0],bz)) continue;
-    if (!AliTracker::PropagateTrackToBxByBz(&trackOut, r[0],mass,0.1,kFALSE)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackOut, r[0],mass,1.,kFALSE)) continue;
 
     if (RejectCluster(cl,&trackOut)) continue;
     nclOut++;
@@ -429,11 +402,14 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
     AliTPCseed::GetError(cl, &trackIn,cov[0],cov[2]);
     cov[0]*=cov[0];
     cov[2]*=cov[2];
+    cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+    cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
+
     trackIn.GetXYZ(xyz);
     //Double_t bz = AliTracker::GetBz(xyz);
 
     //    if (!trackIn.PropagateTo(r[0],bz)) continue;
-    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
+    if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,1,kFALSE)) continue;
 
     if (RejectCluster(cl,&trackIn)) continue;
     nclIn++;
@@ -453,7 +429,7 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   trackOut.PropagateTo(trackOutOld->GetX(),bz);
   
 
-  if (fStreamLevel>0){
+  if (fStreamLevel>0 && streamCounter<100*fStreamLevel){
     TTreeSRedirector *cstream = GetDebugStreamer();
     if (cstream){
       (*cstream)<<"Tracks"<<
@@ -481,7 +457,7 @@ Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Floa
   (*trackOutOld) = trackOut;
   (*trackOuter) = trackOut;
   AliExternalTrackParam *t = &trackIn;
-  track->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
+  //track->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
   seed->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
   seed->SetNumberOfClusters((nclIn+nclOut)/2);
   return kTRUE;
@@ -494,13 +470,14 @@ Bool_t AliTPCcalibCalib::RejectCluster(AliTPCclusterMI* cl, AliExternalTrackPara
   // check the acceptance of cluster
   // Cut on edge effects
   //
+  if (!param) return kTRUE;
   Float_t kEdgeCut=2.5;
   Float_t kSigmaCut=6;
 
   Bool_t isReject = kFALSE;
   Float_t edgeY = cl->GetX()*TMath::Tan(TMath::Pi()/18);
   Float_t dist  = edgeY - TMath::Abs(cl->GetY());
-  if (param)  dist  = TMath::Abs(edgeY - TMath::Abs(param->GetY()));
+  dist  = TMath::Abs(edgeY - TMath::Abs(param->GetY()));
   if (dist<kEdgeCut) isReject=kTRUE;
 
   Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation