]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDseedV1.cxx
Make use of new method AliRawReader::GetNumberOfEvents() - goinf to the last event...
[u/mrichter/AliRoot.git] / TRD / AliTRDseedV1.cxx
index bb31e5be92b5167eaca22a30cb4e815014dc3be4..fea29b74fde1212f9ce9a16650c35e2495e9dfbe 100644 (file)
@@ -33,9 +33,9 @@
 #include "AliLog.h"
 #include "AliMathBase.h"
 
-#include "AliTRDseedV1.h"
 #include "AliTRDcluster.h"
-#include "AliTRDtrack.h"
+#include "AliTRDseedV1.h"
+#include "AliTRDtrackV1.h"
 #include "AliTRDcalibDB.h"
 #include "AliTRDchamberTimeBin.h"
 #include "AliTRDtrackingChamber.h"
@@ -50,6 +50,7 @@ ClassImp(AliTRDseedV1)
 //____________________________________________________________________
 AliTRDseedV1::AliTRDseedV1(Int_t plane) 
   :AliTRDseed()
+  ,fReconstructor(0x0)
   ,fPlane(plane)
   ,fMom(0.)
   ,fSnp(0.)
@@ -66,6 +67,7 @@ AliTRDseedV1::AliTRDseedV1(Int_t plane)
 //____________________________________________________________________
 AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref)
   :AliTRDseed((AliTRDseed&)ref)
+  ,fReconstructor(ref.fReconstructor)
   ,fPlane(ref.fPlane)
   ,fMom(ref.fMom)
   ,fSnp(ref.fSnp)
@@ -124,12 +126,13 @@ void AliTRDseedV1::Copy(TObject &ref) const
 
        //AliInfo("");
        AliTRDseedV1 &target = (AliTRDseedV1 &)ref; 
-       
+
        target.fPlane         = fPlane;
        target.fMom           = fMom;
        target.fSnp           = fSnp;
        target.fTgl           = fTgl;
        target.fdX            = fdX;
+       target.fReconstructor = fReconstructor;
        
        for(int islice=0; islice < knSlices; islice++) target.fdEdx[islice] = fdEdx[islice];
        for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) target.fProb[ispec] = fProb[ispec];
@@ -139,7 +142,7 @@ void AliTRDseedV1::Copy(TObject &ref) const
 
 
 //____________________________________________________________
-void AliTRDseedV1::Init(AliTRDtrack *track)
+Bool_t AliTRDseedV1::Init(AliTRDtrackV1 *track)
 {
 // Initialize this tracklet using the track information
 //
@@ -156,13 +159,14 @@ void AliTRDseedV1::Init(AliTRDtrack *track)
 //
 
        Double_t y, z; 
-       track->GetProlongation(fX0, y, z);
+       if(!track->GetProlongation(fX0, y, z)) return kFALSE;
        fYref[0] = y;
        fYref[1] = track->GetSnp()/(1. - track->GetSnp()*track->GetSnp());
        fZref[0] = z;
        fZref[1] = track->GetTgl();
 
        //printf("Tracklet ref x[%7.3f] y[%7.3f] z[%7.3f], snp[%f] tgl[%f]\n", fX0, fYref[0], fZref[0], track->GetSnp(), track->GetTgl());
+       return kTRUE;
 }
 
 
@@ -220,14 +224,19 @@ void AliTRDseedV1::CookdEdx(Int_t nslices)
                nclusters[slice]++;
        } // End of loop over clusters
 
-       // calculate mean charge per slice
-       for(int is=0; is<nslices; is++) if(nclusters[is]) fdEdx[is] /= nclusters[is];
+       if(fReconstructor->GetPIDMethod() == AliTRDReconstructor::kLQPID){
+       // calculate mean charge per slice (only LQ PID)
+               for(int is=0; is<nslices; is++){ 
+           if(nclusters[is]) fdEdx[is] /= nclusters[is];
+         }
+       }
 }
 
+
 //____________________________________________________________________
 Float_t AliTRDseedV1::GetdQdl(Int_t ic) const
 {
-       return fClusters[ic] ? TMath::Abs(fClusters[ic]->GetQ()) /fdX / TMath::Sqrt(1. + fYfit[1]*fYfit[1] + fZfit[1]*fZfit[1]) : 0.;
+       return fClusters[ic] ? TMath::Abs(fClusters[ic]->GetQ()) /fdX / TMath::Sqrt(1. + fYfit[1]*fYfit[1] + fZref[1]*fZref[1]) : 0.;
 }
 
 //____________________________________________________________________
@@ -250,19 +259,25 @@ Double_t* AliTRDseedV1::GetProbability()
     return 0x0;
   }
 
+  if (!fReconstructor) {
+    AliError("Reconstructor not set.");
+    return 0x0;
+  }
+
   // Retrieve the CDB container class with the parametric detector response
-  const AliTRDCalPID *pd = calibration->GetPIDObject(AliTRDReconstructor::RecoParam()->GetPIDMethod());
+  const AliTRDCalPID *pd = calibration->GetPIDObject(fReconstructor->GetPIDMethod());
   if (!pd) {
     AliError("No access to AliTRDCalPID object");
     return 0x0;
   }
-       
+       //AliInfo(Form("Method[%d] : %s", fReconstructor->GetRecoParam() ->GetPIDMethod(), pd->IsA()->GetName()));
+
        // calculate tracklet length TO DO
   Float_t length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
   /// TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane]) / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
   
   //calculate dE/dx
-  CookdEdx(AliTRDReconstructor::RecoParam()->GetNdEdxSlices());
+  CookdEdx(fReconstructor->GetNdEdxSlices());
   
   // Sets the a priori probabilities
   for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
@@ -305,6 +320,12 @@ void AliTRDseedV1::GetCovAt(Double_t /*x*/, Double_t *cov) const
        cov[0] = sy2;
        cov[1] = fTilt*(sy2-sz2);
        cov[2] = sz2;
+
+  // insert systematic uncertainties calibration and misalignment
+  Double_t sys[15];
+  fReconstructor->GetRecoParam()->GetSysCovMatrix(sys);
+  cov[0] += (sys[0]*sys[0]);
+  cov[2] += (sys[1]*sys[1]);
 }
 
 
@@ -342,13 +363,13 @@ Bool_t    AliTRDseedV1::AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t
        // debug level 7
        //
        
-       if(!AliTRDReconstructor::RecoParam()){
+       if(!fReconstructor->GetRecoParam() ){
                AliError("Seed can not be used without a valid RecoParam.");
                return kFALSE;
        }
 
        AliTRDchamberTimeBin *layer = 0x0;
-       if(AliTRDReconstructor::StreamLevel()>=7 && c){
+       if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7 && c){
                TClonesArray clusters("AliTRDcluster", 24);
                clusters.SetOwner(kTRUE);
                AliTRDcluster *cc = 0x0;
@@ -376,7 +397,7 @@ Bool_t      AliTRDseedV1::AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t
        }
 
        Float_t  tquality;
-       Double_t kroady = AliTRDReconstructor::RecoParam()->GetRoad1y();
+       Double_t kroady = fReconstructor->GetRecoParam() ->GetRoad1y();
        Double_t kroadz = fPadLength * .5 + 1.;
        
        // initialize configuration parameters
@@ -416,7 +437,7 @@ Bool_t      AliTRDseedV1::AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t
                        fZ[iTime]        = cl->GetZ();
                        ncl++;
                }
-       if(AliTRDReconstructor::StreamLevel()>=7) AliInfo(Form("iter = %d ncl [%d] = %d", iter, fPlane, ncl));
+       if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7) AliInfo(Form("iter = %d ncl [%d] = %d", iter, fPlane, ncl));
                
                if(ncl>1){      
                        // calculate length of the time bin (calibration aware)
@@ -457,7 +478,7 @@ Bool_t      AliTRDseedV1::AttachClustersIter(AliTRDtrackingChamber *chamber, Float_t
                        
                        AliTRDseed::Update();
                }
-       if(AliTRDReconstructor::StreamLevel()>=7) AliInfo(Form("iter = %d nclFit [%d] = %d", iter, fPlane, fN2));
+       if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7) AliInfo(Form("iter = %d nclFit [%d] = %d", iter, fPlane, fN2));
                
                if(IsOK()){
                        tquality = GetQuality(kZcorr);
@@ -493,7 +514,7 @@ Bool_t      AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *chamber
   // 6. fit tracklet
   //   
 
-       if(!AliTRDReconstructor::RecoParam()){
+       if(!fReconstructor->GetRecoParam() ){
                AliError("Seed can not be used without a valid RecoParam.");
                return kFALSE;
        }
@@ -501,7 +522,7 @@ Bool_t      AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *chamber
        const Int_t kClusterCandidates = 2 * knTimebins;
        
        //define roads
-       Double_t kroady = AliTRDReconstructor::RecoParam()->GetRoad1y();
+       Double_t kroady = fReconstructor->GetRecoParam() ->GetRoad1y();
        Double_t kroadz = fPadLength * 1.5 + 1.;
        // correction to y for the tilting angle
        Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
@@ -593,7 +614,7 @@ Bool_t      AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *chamber
        }
        
        // number of minimum numbers of clusters expected for the tracklet
-       Int_t kClmin = Int_t(AliTRDReconstructor::RecoParam()->GetFindableClusters()*AliTRDtrackerV1::GetNTimeBins());
+       Int_t kClmin = Int_t(fReconstructor->GetRecoParam() ->GetFindableClusters()*AliTRDtrackerV1::GetNTimeBins());
   if (fN2 < kClmin){
                AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
     fN2 = 0;