LCOV - code coverage report
Current view: top level - TPC/TPCcalib - AliTPCcalibCalib.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 270 0.4 %
Date: 2016-06-14 17:26:59 Functions: 1 14 7.1 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : 
      17             : ///////////////////////////////////////////////////////////////////////////////
      18             : //                                                                           //
      19             : //   Component for redoing the reconstruction from the clusters and tracks
      20             : //      
      21             : //   The new calibration data used 
      22             : //
      23             : //   In reality it overwrites the content of the ESD 
      24             : //    
      25             : 
      26             : /*
      27             : 
      28             :   gSystem->Load("libANALYSIS");
      29             :   gSystem->Load("libTPCcalib");
      30             :   //
      31             :   gSystem->AddIncludePath("-I$ALICE_ROOT/TPC/macros");
      32             :   gROOT->LoadMacro("$ALICE_ROOT/TPC/macros/AliXRDPROOFtoolkit.cxx+")
      33             :   AliXRDPROOFtoolkit tool; 
      34             :   TChain * chainCl = tool.MakeChain("calib.txt","Clusters",0,1);
      35             :   chainCl->Lookup();
      36             :   TChain * chainTr = tool.MakeChain("calib.txt","Tracks",0,1);
      37             :   chainTr->Lookup();
      38             : 
      39             : 
      40             : 
      41             : */
      42             : 
      43             : 
      44             : 
      45             : //  marian.ivanov@cern.ch
      46             : // 
      47             : #include "AliTPCcalibCalib.h"
      48             : #include "TSystem.h"
      49             : #include "TFile.h"
      50             : #include "TTreeStream.h"
      51             : #include "AliLog.h"
      52             : #include "TTimeStamp.h"
      53             : #include "AliESDEvent.h"
      54             : #include "AliESDfriend.h"
      55             : #include "AliESDtrack.h"
      56             : #include "AliTracker.h"
      57             : #include "AliTPCClusterParam.h"
      58             : #include "AliTPCParam.h"
      59             : 
      60             : #include "AliTPCcalibDB.h"
      61             : #include "AliTPCTransform.h"
      62             : #include "AliTPCRecoParam.h"
      63             : #include "AliTPCreco.h"
      64             : #include "AliTPCclusterMI.h"
      65             : #include "AliTPCseed.h"
      66             : #include <TGeoManager.h>
      67             : #include <TGeoPhysicalNode.h>
      68             : #include "TDatabasePDG.h"
      69           6 : ClassImp(AliTPCcalibCalib)
      70             : 
      71             : AliTPCcalibCalib::AliTPCcalibCalib():
      72           0 : AliTPCcalibBase(),
      73           0 :   fApplyExBCorrection(1),      // apply ExB correction
      74           0 :   fApplyTOFCorrection(1),      // apply TOF correction
      75           0 :   fApplyPositionCorrection(1), // apply position correction
      76           0 :   fApplySectorAlignment(1),    // apply sector alignment
      77           0 :   fApplyRPhiCorrection(1),     // apply R-Phi correction
      78           0 :   fApplyRCorrection(1)         // apply Radial correction
      79             : 
      80           0 : {
      81             :   //
      82             :   // Constructor
      83             :   //
      84           0 : }
      85             : 
      86             : 
      87             : AliTPCcalibCalib::AliTPCcalibCalib(const Text_t *name, const Text_t *title) 
      88           0 :   :AliTPCcalibBase(),
      89           0 :   fApplyExBCorrection(1),      // apply ExB correction
      90           0 :   fApplyTOFCorrection(1),      // apply TOF correction
      91           0 :   fApplyPositionCorrection(1), // apply position correction
      92           0 :   fApplySectorAlignment(1),    // apply sector alignment
      93           0 :   fApplyRPhiCorrection(1),     // apply R-Phi correction
      94           0 :   fApplyRCorrection(1)         // apply Radial correction
      95           0 : {  
      96           0 :   SetName(name);
      97           0 :   SetTitle(title);
      98           0 : }
      99             : 
     100             : 
     101             : AliTPCcalibCalib::AliTPCcalibCalib(const AliTPCcalibCalib&calib):
     102           0 :   AliTPCcalibBase(calib),
     103           0 :   fApplyExBCorrection(calib.GetApplyExBCorrection()),
     104           0 :   fApplyTOFCorrection(calib.GetApplyTOFCorrection()),
     105           0 :   fApplyPositionCorrection(calib.GetApplyPositionCorrection()),
     106           0 :   fApplySectorAlignment(calib.GetApplySectorAlignment()),
     107           0 :   fApplyRPhiCorrection(calib.GetApplyRPhiCorrection()),
     108           0 :   fApplyRCorrection(calib.GetApplyRCorrection())
     109             : 
     110           0 : {
     111             :   //
     112             :   // copy constructor
     113             :   //
     114           0 : }
     115             : 
     116             : AliTPCcalibCalib &AliTPCcalibCalib::operator=(const AliTPCcalibCalib&calib){
     117             :   //
     118             :   //
     119             :   //
     120           0 :   ((AliTPCcalibBase *)this)->operator=(calib);
     121           0 :   return *this;
     122             : }
     123             : 
     124             : 
     125           0 : AliTPCcalibCalib::~AliTPCcalibCalib() {
     126             :   //
     127             :   // destructor
     128             :   //
     129           0 : }
     130             : 
     131             : 
     132             : void     AliTPCcalibCalib::Process(AliESDEvent *event){
     133             :   //
     134             :   // 
     135             :   //
     136           0 :   if (!event) {
     137             :     return;
     138             :   }  
     139           0 :   AliESDfriend *ESDfriend=static_cast<AliESDfriend*>(event->FindListObject("AliESDfriend"));
     140           0 :   if (!ESDfriend) {
     141           0 :    return;
     142             :   }
     143           0 :   if (ESDfriend->TestSkipBit()) return;
     144           0 :   if (GetDebugLevel()>20) printf("Hallo world: Im here\n");
     145           0 :   Int_t ntracks=ESDfriend->GetNumberOfTracks();   
     146             :   //AliTPCcalibDB::Instance()->SetExBField(fMagF);
     147             : 
     148             :   //
     149             :   //
     150             :   //
     151             : 
     152           0 :   for (Int_t i=0;i<ntracks;++i) {
     153           0 :     AliESDtrack *track = event->GetTrack(i);     
     154           0 :     AliESDfriendTrack *friendTrack = (AliESDfriendTrack*)track->GetFriendTrack();
     155           0 :     if (!friendTrack) continue;
     156             :     //track->SetFriendTrack(friendTrack);
     157           0 :     fCurrentFriendTrack=friendTrack;
     158           0 :     const AliExternalTrackParam * trackIn  = track->GetInnerParam();
     159           0 :     const AliExternalTrackParam * trackOut = track->GetOuterParam();
     160           0 :     AliExternalTrackParam * tpcOut   = (AliExternalTrackParam *)friendTrack->GetTPCOut();
     161           0 :     if (!trackIn) continue;
     162           0 :     if (!trackOut) continue;
     163           0 :     if (!tpcOut) continue;   
     164             :     TObject *calibObject;
     165             :     AliTPCseed *seed = 0;
     166           0 :     for (Int_t l=0;(calibObject=friendTrack->GetCalibObject(l));++l) {
     167           0 :       if ((seed=dynamic_cast<AliTPCseed*>(calibObject))) break;
     168             :     }
     169           0 :     if (!seed) continue;
     170           0 :     RefitTrack(track, seed, event->GetMagneticField());
     171           0 :     (*tpcOut)=*(track->GetOuterParam());  
     172           0 :   }
     173             :   return;
     174           0 : }
     175             : 
     176             : Bool_t  AliTPCcalibCalib::RefitTrack(AliESDtrack * track, AliTPCseed *seed, Float_t magesd){
     177             :   //
     178             :   // Refit track
     179             :   // if magesd==0 forget the curvature
     180             : 
     181             :   //
     182             :   // 0 - Setup transform object
     183             :   //
     184             :   const Double_t kxIFC = 83.;   // position of IFC
     185             :   const Double_t kxOFC = 250.;  // position of OFC
     186             :   const Double_t kaFC = 1.;    // amplitude 
     187             :   const Double_t ktFC = 5.0;    // slope of error 
     188             :   //cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     189             :   //cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     190             : 
     191             :   static Int_t streamCounter=0;
     192           0 :   streamCounter++;
     193           0 :   AliESDfriendTrack *friendTrack = fCurrentFriendTrack;
     194             : 
     195           0 :   AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
     196           0 :   AliTPCParam     *param     = AliTPCcalibDB::Instance()->GetParameters();
     197           0 :   transform->SetCurrentRun(fRun);
     198           0 :   transform->SetCurrentTimeStamp((UInt_t)fTime);
     199           0 :   if(!fApplyExBCorrection) { // disable ExB correction in transform
     200           0 :     if(transform->GetCurrentRecoParam())
     201           0 :       transform->GetCurrentRecoParamNonConst()->SetUseExBCorrection(0);
     202             :   }
     203           0 :   if(!fApplyTOFCorrection) { // disable TOF correction in transform
     204           0 :     if(transform->GetCurrentRecoParam())
     205           0 :       transform->GetCurrentRecoParamNonConst()->SetUseTOFCorrection(kFALSE);
     206             :   }
     207             : 
     208             :   //
     209             :   // First apply calibration
     210             :   //
     211             :   //  AliTPCPointCorrection * corr =  AliTPCPointCorrection::Instance();
     212           0 :   TVectorD vec(5, seed->GetParameter());
     213           0 :   for (Int_t irow=0;irow<kMaxRow;irow++) {
     214           0 :     AliTPCclusterMI *cluster=seed->GetClusterPointer(irow);
     215           0 :     if (!cluster) continue; 
     216           0 :     AliTPCclusterMI cl0(*cluster);
     217           0 :     Double_t x[3]={static_cast<Double_t>(cluster->GetRow()),cluster->GetPad(),cluster->GetTimeBin()};
     218           0 :     Int_t i[1]={cluster->GetDetector()};
     219           0 :     const AliTPCTrackerPoints::Point* point = seed->GetTrackPoint(irow);
     220           0 :     Double_t ty=0,tz=0;
     221             :      
     222           0 :     if (point){
     223           0 :       ty = TMath::Abs(point->GetAngleY());
     224           0 :       tz = TMath::Abs(point->GetAngleZ()*TMath::Sqrt(1+ty*ty));      
     225           0 :     }
     226           0 :     transform->Transform(x,i,0,1);
     227             :     //
     228             :     // get position correction
     229             :     //
     230             :     Int_t ipad=0;
     231           0 :     if (cluster->GetDetector()>35) ipad=1;
     232           0 :     Float_t dy =0;//AliTPCClusterParam::SPosCorrection(0,ipad,cluster->GetPad(),cluster->GetTimeBin(),cluster->GetZ(),cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax());
     233           0 :     Float_t dz =0;//AliTPCClusterParam::SPosCorrection(1,ipad,cluster->GetPad(),cluster->GetTimeBin(),cluster->GetZ(),cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax());
     234             :     //
     235           0 :     cluster->SetX(x[0]);
     236           0 :     cluster->SetY(x[1]);
     237           0 :     cluster->SetZ(x[2]);
     238             :     
     239             :     //
     240             :     // Apply alignemnt
     241             :     //
     242           0 :     if (transform->GetCurrentRecoParam()->GetUseSectorAlignment()){
     243           0 :       if (!param->IsGeoRead()) param->ReadGeoMatrices();
     244           0 :       TGeoHMatrix  *mat = param->GetClusterMatrix(cluster->GetDetector());
     245             :       //TGeoHMatrix  mat;
     246           0 :       Double_t pos[3]= {cluster->GetX(),cluster->GetY(),cluster->GetZ()};
     247           0 :       Double_t posC[3]={cluster->GetX(),cluster->GetY(),cluster->GetZ()};
     248           0 :       if (mat) mat->LocalToMaster(pos,posC);
     249             :       else{
     250             :         // chack Loading of Geo matrices from GeoManager - TEMPORARY FIX
     251             :       }
     252           0 :       cluster->SetX(posC[0]);
     253           0 :       cluster->SetY(posC[1]);
     254           0 :       cluster->SetZ(posC[2]);
     255           0 :     }
     256             : 
     257             : 
     258             : 
     259           0 :     if (fStreamLevel>2 && gRandom->Rndm()<0.1 ){
     260             :       // dump debug info if required
     261           0 :       TTreeSRedirector *cstream = GetDebugStreamer();
     262           0 :       if (cstream){
     263           0 :         (*cstream)<<"Clusters"<<
     264           0 :           "run="<<fRun<<              //  run number
     265           0 :           "event="<<fEvent<<          //  event number
     266           0 :           "time="<<fTime<<            //  time stamp of event
     267           0 :           "trigger="<<fTrigger<<      //  trigger
     268           0 :           "triggerClass="<<&fTriggerClass<<      //  trigger    
     269           0 :           "mag="<<fMagF<<             //  magnetic field
     270           0 :           "cl0.="<<&cl0<<
     271           0 :           "cl.="<<cluster<<
     272           0 :           "cy="<<dy<<
     273           0 :           "cz="<<dz<<
     274           0 :           "ty="<<ty<<
     275           0 :           "tz="<<tz<<
     276           0 :           "vec.="<<&vec<<  //track parameters
     277             :           "\n";
     278             :       }
     279           0 :     }
     280           0 :   }
     281             :   //
     282             :   //
     283             :   //
     284           0 :   Int_t ncl = seed->GetNumberOfClusters();
     285             :   const Double_t kResetCov=4.;
     286             :   const Double_t kSigma=5.;
     287           0 :   Double_t covar[15];
     288           0 :   for (Int_t i=0;i<15;i++) covar[i]=0;
     289           0 :   covar[0]=kSigma*kSigma;
     290           0 :   covar[2]=kSigma*kSigma;
     291           0 :   covar[5]=kSigma*kSigma/Float_t(ncl*ncl);
     292           0 :   covar[9]=kSigma*kSigma/Float_t(ncl*ncl);
     293           0 :   covar[14]=0.2*0.2;
     294           0 :   if (TMath::Abs(magesd)<0.05) {
     295           0 :      covar[14]=0.025*0.025;
     296           0 :   }
     297             :   // 
     298             :   // And now do refit
     299             :   //
     300           0 :   AliExternalTrackParam * trackInOld  = (AliExternalTrackParam*)track->GetInnerParam();
     301           0 :   AliExternalTrackParam * trackOuter = (AliExternalTrackParam*)track->GetOuterParam();
     302           0 :   AliExternalTrackParam * trackOutOld   = (AliExternalTrackParam *)friendTrack->GetTPCOut();
     303           0 :   Double_t mass =    TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
     304             : 
     305             :     
     306             : 
     307           0 :   AliExternalTrackParam trackIn  = *trackOutOld;
     308           0 :   trackIn.ResetCovariance(kResetCov);
     309           0 :   trackIn.AddCovariance(covar);
     310           0 :   if (TMath::Abs(magesd)<0.05) {
     311           0 :     ((Double_t&)(trackIn.GetParameter()[4]))=0.000000001;
     312           0 :     ((Double_t&)(trackIn.GetCovariance()[14]))=covar[14];  // fix the line
     313           0 :   }  
     314             : 
     315           0 :   Double_t xyz[3];
     316           0 :   Int_t nclIn=0,nclOut=0;
     317             :   //
     318             :   // Refit in
     319             :   //
     320           0 :   for (Int_t irow=kMaxRow; irow--;){
     321           0 :     AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
     322           0 :     if (!cl) continue;
     323           0 :     if (cl->GetX()<80) continue;
     324           0 :     Int_t sector = cl->GetDetector();
     325           0 :     Float_t dalpha = TMath::DegToRad()*(sector%18*20.+10.)-trackIn.GetAlpha();
     326           0 :     if (TMath::Abs(dalpha)>0.01){
     327           0 :       if (!trackIn.Rotate(TMath::DegToRad()*(sector%18*20.+10.))) break;
     328             :     }
     329           0 :     Double_t r[3]={cl->GetX(),cl->GetY(),cl->GetZ()};
     330           0 :     Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
     331           0 :     AliTPCseed::GetError(cl, &trackIn,cov[0],cov[2]);
     332           0 :     cov[0]*=cov[0];
     333           0 :     cov[2]*=cov[2];
     334           0 :     cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     335           0 :     cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     336           0 :     trackIn.GetXYZ(xyz);
     337             :     //    Double_t bz = AliTracker::GetBz(xyz);
     338             : 
     339             :     //    if (!trackIn.PropagateTo(r[0],bz)) continue;
     340           0 :     if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,1.,kFALSE)) continue;
     341             : 
     342           0 :     if (RejectCluster(cl,&trackIn)) continue;
     343           0 :     nclIn++;
     344           0 :     trackIn.Update(&r[1],cov);    
     345           0 :   }
     346             :   //
     347           0 :   AliExternalTrackParam trackOut = trackIn;
     348           0 :   trackOut.ResetCovariance(kResetCov);
     349           0 :   trackOut.AddCovariance(covar);
     350           0 :   if (TMath::Abs(magesd)<0.05) {
     351           0 :     ((Double_t&)(trackOut.GetParameter()[4]))=0.000000001;
     352           0 :     ((Double_t&)(trackOut.GetCovariance()[14]))=covar[14];  // fix the line
     353           0 :   }
     354             : 
     355             :   //
     356             :   // Refit out
     357             :   //
     358             :   //Bool_t lastEdge=kFALSE;
     359           0 :   for (Int_t irow=0; irow<kMaxRow; irow++){
     360           0 :     AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
     361           0 :     if (!cl) continue;
     362           0 :     if (cl->GetX()<80) continue;
     363           0 :     Int_t sector = cl->GetDetector();
     364           0 :     Float_t dalpha = TMath::DegToRad()*(sector%18*20.+10.)-trackOut.GetAlpha();
     365             : 
     366           0 :     if (TMath::Abs(dalpha)>0.01){
     367           0 :       if (!trackOut.Rotate(TMath::DegToRad()*(sector%18*20.+10.))) break;
     368             :     }
     369           0 :     Double_t r[3]={cl->GetX(),cl->GetY(),cl->GetZ()};
     370             : 
     371           0 :     Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation    
     372           0 :     AliTPCseed::GetError(cl, &trackOut,cov[0],cov[2]);
     373           0 :     cov[0]*=cov[0];
     374           0 :     cov[2]*=cov[2];
     375           0 :     cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     376           0 :     cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     377           0 :     trackOut.GetXYZ(xyz);
     378             :     //Double_t bz = AliTracker::GetBz(xyz);
     379             :     //    if (!trackOut.PropagateTo(r[0],bz)) continue;
     380           0 :     if (!AliTracker::PropagateTrackToBxByBz(&trackOut, r[0],mass,1.,kFALSE)) continue;
     381             : 
     382           0 :     if (RejectCluster(cl,&trackOut)) continue;
     383           0 :     nclOut++;
     384           0 :     trackOut.Update(&r[1],cov);     
     385             :     //if (cl->GetType()<0) lastEdge=kTRUE;
     386             :     //if (cl->GetType()>=0) lastEdge=kFALSE;    
     387           0 :   }
     388             :   //
     389             :   //
     390             :   //
     391           0 :   nclIn=0;
     392           0 :   trackIn  = trackOut;
     393           0 :   trackIn.ResetCovariance(kResetCov);
     394           0 :   if (TMath::Abs(magesd)<0.05) {
     395           0 :     ((Double_t&)(trackIn.GetParameter()[4]))=0.000000001;
     396           0 :     ((Double_t&)(trackIn.GetCovariance()[14]))=covar[14];  // fix the line
     397           0 :   }
     398             :   //
     399             :   // Refit in one more time
     400             :   //
     401           0 :   for (Int_t irow=kMaxRow;irow--;){
     402           0 :     AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
     403           0 :     if (!cl) continue;
     404           0 :     if (cl->GetX()<80) continue;
     405           0 :     Int_t sector = cl->GetDetector();
     406           0 :     Float_t dalpha = TMath::DegToRad()*(sector%18*20.+10.)-trackIn.GetAlpha();
     407           0 :     if (TMath::Abs(dalpha)>0.01){
     408           0 :       if (!trackIn.Rotate(TMath::DegToRad()*(sector%18*20.+10.))) break;
     409             :     }
     410           0 :     Double_t r[3]={cl->GetX(),cl->GetY(),cl->GetZ()};
     411           0 :     Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
     412           0 :     AliTPCseed::GetError(cl, &trackIn,cov[0],cov[2]);
     413           0 :     cov[0]*=cov[0];
     414           0 :     cov[2]*=cov[2];
     415           0 :     cov[0]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     416           0 :     cov[2]+= kaFC*(TMath::Exp(-TMath::Abs(cl->GetX()-kxIFC)/ktFC)+TMath::Exp(-TMath::Abs(cl->GetX()-kxOFC)/ktFC));
     417             : 
     418           0 :     trackIn.GetXYZ(xyz);
     419             :     //Double_t bz = AliTracker::GetBz(xyz);
     420             : 
     421             :     //    if (!trackIn.PropagateTo(r[0],bz)) continue;
     422           0 :     if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,1,kFALSE)) continue;
     423             : 
     424           0 :     if (RejectCluster(cl,&trackIn)) continue;
     425           0 :     nclIn++;
     426           0 :     trackIn.Update(&r[1],cov);    
     427           0 :   }
     428             : 
     429             : 
     430           0 :   trackIn.Rotate(trackInOld->GetAlpha());
     431           0 :   trackOut.Rotate(trackOutOld->GetAlpha());
     432             :   //
     433           0 :   trackInOld->GetXYZ(xyz);
     434           0 :   Double_t bz = AliTracker::GetBz(xyz);
     435           0 :   trackIn.PropagateTo(trackInOld->GetX(),bz);
     436             :   //
     437           0 :   trackOutOld->GetXYZ(xyz);
     438           0 :   bz = AliTracker::GetBz(xyz);  
     439           0 :   trackOut.PropagateTo(trackOutOld->GetX(),bz);
     440             :   
     441             : 
     442           0 :   if (fStreamLevel>0 && streamCounter<100*fStreamLevel){
     443           0 :     TTreeSRedirector *cstream = GetDebugStreamer();
     444           0 :     if (cstream){
     445           0 :       (*cstream)<<"Tracks"<<
     446           0 :         "run="<<fRun<<              //  run number
     447           0 :         "event="<<fEvent<<          //  event number
     448           0 :         "time="<<fTime<<            //  time stamp of event
     449           0 :         "trigger="<<fTrigger<<      //  trigger
     450           0 :         "triggerClass="<<&fTriggerClass<<      //  trigger
     451           0 :         "mag="<<fMagF<<             //  magnetic field
     452           0 :         "nclIn="<<nclIn<<
     453           0 :         "nclOut="<<nclOut<<
     454           0 :         "ncl="<<ncl<<
     455           0 :         "seed.="<<seed<<
     456           0 :         "track.="<<track<<
     457           0 :         "TrIn0.="<<trackInOld<<
     458           0 :         "TrOut0.="<<trackOutOld<<
     459           0 :         "TrIn1.="<<&trackIn<<
     460           0 :         "TrOut1.="<<&trackOut<<
     461             :         "\n";
     462             :     }
     463           0 :   }
     464             :   //
     465             :   // And now rewrite ESDtrack and TPC seed
     466             :   //
     467             :  
     468           0 :   (*trackInOld)  = trackIn;
     469           0 :   (*trackOutOld) = trackOut;
     470           0 :   (*trackOuter) = trackOut;
     471             :   AliExternalTrackParam *t = &trackIn;
     472             :   //track->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
     473           0 :   seed->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
     474           0 :   seed->SetNumberOfClusters((nclIn+nclOut)/2);
     475             :   return kTRUE;
     476           0 : }
     477             : 
     478             : 
     479             : 
     480             : Bool_t AliTPCcalibCalib::RejectCluster(AliTPCclusterMI* cl, AliExternalTrackParam * param){
     481             :   //
     482             :   // check the acceptance of cluster
     483             :   // Cut on edge effects
     484             :   //
     485           0 :   if (!param) return kTRUE;
     486             :   Float_t kEdgeCut=2.5;
     487             :   Float_t kSigmaCut=6;
     488             : 
     489             :   Bool_t isReject = kFALSE;
     490           0 :   Float_t edgeY = cl->GetX()*TMath::Tan(TMath::Pi()/18);
     491           0 :   Float_t dist  = edgeY - TMath::Abs(cl->GetY());
     492           0 :   dist  = TMath::Abs(edgeY - TMath::Abs(param->GetY()));
     493           0 :   if (dist<kEdgeCut) isReject=kTRUE;
     494             : 
     495           0 :   Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation    
     496           0 :   AliTPCseed::GetError(cl, param,cov[0],cov[2]);
     497           0 :   if (param->GetSigmaY2()<0 || param->GetSigmaZ2()<0){
     498           0 :     AliError("Wrong parameters");
     499           0 :     return kFALSE;
     500             :   }
     501           0 :   Double_t py = (cl->GetY()-param->GetY())/TMath::Sqrt(cov[0]*cov[0]+param->GetSigmaY2());
     502           0 :   Double_t pz = (cl->GetZ()-param->GetZ())/TMath::Sqrt(cov[2]*cov[2]+param->GetSigmaZ2());
     503             :   //
     504           0 :   if ((py*py+pz*pz)>kSigmaCut*kSigmaCut) isReject=kTRUE;
     505             :   
     506           0 :   return isReject;
     507           0 : }
     508             : 
     509             : 
     510             : 

Generated by: LCOV version 1.11