expantion of recoParam (Markus) and fix bug in HLT mode
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Sep 2008 13:46:43 +0000 (13:46 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Sep 2008 13:46:43 +0000 (13:46 +0000)
TRD/AliTRDReconstructor.cxx
TRD/AliTRDReconstructor.h
TRD/AliTRDrecoParam.cxx
TRD/AliTRDrecoParam.h
TRD/AliTRDtrackerV1.cxx
TRD/AliTRDtrackerV1.h
TRD/Calib/RecoParam/Run0_999999999_v0_s0.root

index 67692e5..4caa6d8 100644 (file)
@@ -1,17 +1,17 @@
 /**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- *                                                                        *
- * Author: The ALICE Off-line Project.                                    *
- * Contributors are mentioned in the code where appropriate.              *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
 
 /* $Id$ */
 
@@ -50,10 +50,6 @@ AliTRDReconstructor::AliTRDReconstructor()
   :AliReconstructor()
   ,fSteerParam(0x00000007)
 {
-  //
-  // Default constructor
-  //
-
   memset(fStreamLevel, 0, 5*sizeof(UChar_t));
   // Xe tail cancellation parameters
   fTCParams[0] = 1.156; // r1
@@ -65,7 +61,6 @@ AliTRDReconstructor::AliTRDReconstructor()
   fTCParams[5] = 0.62;  // r2
   fTCParams[6] = 0.0087;// c1
   fTCParams[7] = 0.07;  // c2
-
 }
 
 //_____________________________________________________________________________
@@ -73,35 +68,24 @@ AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r)
   :AliReconstructor(r)
   ,fSteerParam(r.fSteerParam)
 {
-  //
-  // Copy constructor
-  //
-
-  memcpy(fStreamLevel,r.fStreamLevel, 5*sizeof(UChar_t));
-  memcpy(fTCParams   ,r.fTCParams   , 8*sizeof(Double_t));
-
+  memcpy(fStreamLevel, r.fStreamLevel, 5*sizeof(UChar_t));
+  memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t));
 }
 
 //_____________________________________________________________________________
 AliTRDReconstructor::~AliTRDReconstructor()
 {
-  //
-  // Destructor
-  //
-
   if(fgClusters) {
     fgClusters->Delete(); delete fgClusters;
   }
-
 }
 
+
 //_____________________________________________________________________________
-void AliTRDReconstructor::Init()
-{
+void AliTRDReconstructor::Init(){
   //
   // Init Options
   //
-
   SetOption(GetOption());
 
   AliInfo("TRD reconstruction will use the following settings:");
@@ -110,22 +94,21 @@ void AliTRDReconstructor::Init()
   printf("\tDrift Gas Argon        [ar] : %s\n", fSteerParam&kDriftGas?"yes":"no");
   printf("\tStand Alone Tracking   [sa] : %s\n", fSteerParam&kSeeding?"yes":"no");
   printf("\tHLT         Tracking  [hlt] : %s\n", fSteerParam&kHLT?"yes":"no");
+  printf("\tCosmic Reconstruction [cos] : %s\n", fSteerParam&kCosmic?"yes":"no");
   printf("\tNN PID                 [nn] : %s\n", fSteerParam&kSteerPID?"yes":"no");
-  printf("\tStreaming Levels            : Clusterizer[%d] Tracker[%d] PID[%d]\n"
-        ,fStreamLevel[kClusterizer]
-        ,fStreamLevel[kTracker]
-        ,fStreamLevel[kPID]);
-
+  printf("\tStreaming Levels            : Clusterizer[%d] Tracker[%d] PID[%d]\n", fStreamLevel[kClusterizer], fStreamLevel[kTracker], fStreamLevel[kPID]);
 }
 
 //_____________________________________________________________________________
 void AliTRDReconstructor::ConvertDigits(AliRawReader *rawReader
-                                     , TTree *digitsTree) const
+              , TTree *digitsTree) const
 {
   //
   // Convert raw data digits into digit objects in a root tree
   //
 
+  AliInfo("Convert raw data digits into digit objects [RawReader -> Digit TTree]");
+
   AliTRDrawData rawData;
   rawReader->Reset();
   rawReader->Select("TRD");
@@ -144,6 +127,9 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
   // Reconstruct clusters
   //
 
+  //AliInfo("Reconstruct TRD clusters from RAW data [RawReader -> Cluster TTree]");
+
+
   rawReader->Reset();
   rawReader->Select("TRD");
 
@@ -159,7 +145,6 @@ void AliTRDReconstructor::Reconstruct(AliRawReader *rawReader
   // take over ownership of clusters
   fgClusters = clusterer.RecPoints();
   clusterer.SetClustersOwner(kFALSE);
-
 }
 
 //_____________________________________________________________________________
@@ -170,6 +155,8 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
   // Reconstruct clusters
   //
 
+  //AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
+
   AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
   clusterer.SetReconstructor(this);
   clusterer.OpenOutput(clusterTree);
@@ -181,7 +168,6 @@ void AliTRDReconstructor::Reconstruct(TTree *digitsTree
   // take over ownership of clusters
   fgClusters = clusterer.RecPoints();
   clusterer.SetClustersOwner(kFALSE);
-
 }
 
 //_____________________________________________________________________________
@@ -200,8 +186,8 @@ AliTracker *AliTRDReconstructor::CreateTracker() const
 
 //_____________________________________________________________________________
 void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
-                               , TTree* /*clusterTree*/
-                               , AliESDEvent* /*esd*/) const
+        , TTree* /*clusterTree*/
+        , AliESDEvent* /*esd*/) const
 {
   //
   // Fill ESD
@@ -209,22 +195,22 @@ void AliTRDReconstructor::FillESD(TTree* /*digitsTree*/
 
 }
 
+
 //_____________________________________________________________________________
 void AliTRDReconstructor::SetOption(Option_t *opt)
 {
-  //
-  // Read option string into the steer param.
-  //
-  // Default steer param values
-  //
-  // write clusters [cw] = true
-  // track seeding (stand alone tracking) [sa] = true
-  // PID method in reconstruction (NN) [nn] = true
-  // write online tracklets [tw] = false
-  // drift gas [ar] = false
-  // HLT tracking [hlt] = false
-  //
-
+// Read option string into the steer param.
+//
+// Default steer param values
+//
+// write clusters [cw] = true
+// track seeding (stand alone tracking) [sa] = true
+// PID method in reconstruction (NN) [nn] = true
+// write online tracklets [tw] = false
+// drift gas [ar] = false
+// HLT tracking [hlt] = false
+// Cosmic Reconstruction [cos] = false
+//
   fSteerParam = 0x00000007;
 
   TString s(opt);
@@ -249,44 +235,42 @@ void AliTRDReconstructor::SetOption(Option_t *opt)
     } else if(sopt.Contains("hlt")){
       if(!sopt.Contains("!")) fSteerParam |= kHLT;
       continue;        
+    } else if(sopt.Contains("cos")){
+      if(!sopt.Contains("!")) fSteerParam |= kCosmic;
     } else if(sopt.Contains("sl")){
-       TObjArray *stl = sopt.Tokenize("_");
-       if(stl->GetEntriesFast() < 3) continue;
-                       TString taskstr(((TObjString*)(*stl)[1])->String());
-                       TString levelstring(((TObjString*)(*stl)[2])->String());
-       // Set the stream Level
-       Int_t level = levelstring.Atoi();
-       AliTRDReconstructorTask task = kTracker;
-       if(taskstr.CompareTo("cl") == 0) task = kClusterizer;   
-       else if(taskstr.CompareTo("tr") == 0) task = kTracker;
-       else if(taskstr.CompareTo("pi") == 0) task = kPID;
-       SetStreamLevel(level, task);
-       continue;
-               }
+      TObjArray *stl = sopt.Tokenize("_");
+      if(stl->GetEntriesFast() < 3) continue;
+      TString taskstr(((TObjString*)(*stl)[1])->String());
+      TString levelstring(((TObjString*)(*stl)[2])->String());
+      // Set the stream Level
+      Int_t level = levelstring.Atoi();
+      AliTRDReconstructorTask task = kTracker;
+      if(taskstr.CompareTo("cl") == 0) task = kClusterizer;    
+      else if(taskstr.CompareTo("tr") == 0) task = kTracker;
+      else if(taskstr.CompareTo("pi") == 0) task = kPID;
+      SetStreamLevel(level, task);
+      continue;
+    }
   }
-
 }
 
 //_____________________________________________________________________________
-void AliTRDReconstructor::SetStreamLevel(Int_t level, AliTRDReconstructorTask task)
-{
+void AliTRDReconstructor::SetStreamLevel(Int_t level, AliTRDReconstructorTask task){
   //
   // Set the Stream Level for one of the tasks Clusterizer, Tracker or PID
   //
-
   TString taskname;
-  switch(task) {
-    case kClusterizer: 
-      taskname = "Clusterizer";
-      break;
-    case kTracker: 
-      taskname = "Tracker";
-      break;
-    case kPID: 
-      taskname = "PID";
-      break;
+  switch(task){
+  case kClusterizer: 
+    taskname = "Clusterizer";
+    break;
+  case kTracker: 
+    taskname = "Tracker";
+    break;
+  case kPID: 
+    taskname = "PID";
+    break;
   }
-
+  //AliInfo(Form("Setting Stream Level for Task %s to %d", taskname.Data(),level));
   fStreamLevel[(Int_t)task] = level;
-
 }
index 6b3027c..a25cbf6 100644 (file)
@@ -27,6 +27,7 @@ public:
     ,kWriteTracklets = BIT(3)
     ,kDriftGas       = BIT(4)
     ,kHLT            = BIT(5)
+    ,kCosmic         = BIT(6)
   };
   enum AliTRDReconstructorTask {
     kClusterizer = 0
@@ -70,6 +71,7 @@ public:
   Bool_t              IsWritingTracklets() const { return fSteerParam&kWriteTracklets;}
   Bool_t              IsHLT() const              { return fSteerParam&kHLT;}
   Bool_t              IsSeeding() const          { return fSteerParam&kSeeding;}
+  Bool_t              IsCosmic() const           { return fSteerParam&kCosmic;}
 
   virtual void        Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
   virtual void        Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
index 8379da3..5084ecd 100644 (file)
@@ -33,8 +33,8 @@ ClassImp(AliTRDrecoParam)
 //______________________________________________________________
 AliTRDrecoParam::AliTRDrecoParam()
   :AliDetectorRecoParam()
-  ,fkMaxTheta(1.0)
-  ,fkMaxPhi(2.0)
+  ,fkMaxTheta(1.0)     
+  ,fkMaxPhi(2.0) 
   ,fkRoad0y(6.0)
   ,fkRoad0z(8.5) 
   ,fkRoad1y(2.0)
@@ -45,6 +45,11 @@ AliTRDrecoParam::AliTRDrecoParam()
   ,fkFindable(.333)
   ,fkChi2Z(30./*14.*//*12.5*/)
   ,fkChi2Y(.25)
+  ,fkChi2YCut(7.73)
+  ,fkChi2ZCut(0.069)
+  ,fkPhiCut(10.6)
+  ,fkMeanNclusters(72)
+  ,fkSigmaNclusters(5.2632)
   ,fkTrackLikelihood(-15.)
   ,fMinMaxCutSigma(4.)
   ,fMinLeftRightCutSigma(8.)
@@ -85,6 +90,10 @@ AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
   ,fkFindable(ref.fkFindable)
   ,fkChi2Z(ref.fkChi2Z)
   ,fkChi2Y(ref.fkChi2Y)
+  ,fkChi2YCut(ref.fkChi2YCut)
+  ,fkPhiCut(ref.fkPhiCut)
+  ,fkMeanNclusters(ref.fkMeanNclusters)
+  ,fkSigmaNclusters(ref.fkSigmaNclusters)
   ,fkTrackLikelihood(ref.fkTrackLikelihood)
   ,fMinMaxCutSigma(ref.fMinMaxCutSigma)
   ,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
@@ -139,7 +148,13 @@ AliTRDrecoParam *AliTRDrecoParam::GetCosmicTestParam()
 
   AliTRDrawStreamBase::SetRawStreamVersion("TB");
   AliTRDrecoParam *par = new AliTRDrecoParam();
-  par->SetVertexConstrained();
+  par->SetVertexConstrained(kFALSE);
+  par->SetChi2YCut(1.136);
+  par->SetChi2ZCut(0.069);
+  par->SetMaxTheta(2.1445);
+  par->SetMaxPhi(2.7475);
+  par->SetMeanNclusters(48.1197);
+  par->SetSigmaNclusters(8.59347);
   return par;
 
 }
index aa0ea48..080c80a 100644 (file)
@@ -24,6 +24,11 @@ public:
 
   Double_t GetChi2Y() const                 { return fkChi2Y;    }
   Double_t GetChi2Z() const                 { return fkChi2Z;    }
+  Double_t GetChi2YCut() const              { return fkChi2YCut; }
+  Double_t GetChi2ZCut() const              { return fkChi2ZCut; }
+  Double_t GetPhiCut() const                { return fkPhiCut;   }
+  Double_t GetMeanNclusters() const         { return fkMeanNclusters; }
+  Double_t GetSigmaNclusters() const        { return fkSigmaNclusters; }
   Double_t GetFindableClusters() const      { return fkFindable; }
   Double_t GetMaxTheta() const              { return fkMaxTheta; }
   Double_t GetMaxPhi() const                { return fkMaxPhi;   }
@@ -55,10 +60,16 @@ public:
   Bool_t   IsVertexConstrained() const      { return TestBit(kVertexConstrained); }
   Bool_t   HasImproveTracklets() const       { return TestBit(kImproveTracklet); }
 
-
+  void     SetMaxTheta(Double_t maxTheta) {fkMaxTheta = maxTheta;}
+  void     SetMaxPhi(Double_t maxPhi) {fkMaxPhi = maxPhi;}
   void     SetFindableClusters(Double_t r) {fkFindable = r;}
   void     SetChi2Y(Double_t chi2) {fkChi2Y = chi2;}
   void     SetChi2Z(Double_t chi2) {fkChi2Z = chi2;}
+  void     SetChi2YCut(Double_t chi2YCut) {fkChi2YCut = chi2YCut;}
+  void     SetChi2ZCut(Double_t chi2ZCut) {fkChi2ZCut = chi2ZCut;}
+  void     SetPhiCut(Double_t phiCut) {fkPhiCut = phiCut;}
+  void     SetMeanNclusters(Double_t meanNclusters) {fkMeanNclusters = meanNclusters;}
+  void     SetSigmaNclusters(Double_t sigmaNclusters) {fkSigmaNclusters = sigmaNclusters;} 
   void     SetClusterSharing(Bool_t share = kTRUE)            { SetBit(kClusterSharing, share);}
   void     SetImproveTracklets(Bool_t improve = kTRUE)         { SetBit(kImproveTracklet, improve);}
   void     SetVertexConstrained(Bool_t vc = kTRUE)            { SetBit(kVertexConstrained, vc); }
@@ -98,6 +109,11 @@ private:
   Double_t  fkFindable;              // Ratio of clusters from a track in one chamber which are at minimum supposed to be found.
   Double_t  fkChi2Z;                 // Max chi2 on the z direction for seeding clusters fit
   Double_t  fkChi2Y;                 // Max chi2 on the y direction for seeding clusters Rieman fit
+  Double_t  fkChi2YCut;              // Cut on the Chi2 in y-direction in the likelihood filter
+  Double_t  fkChi2ZCut;              // Cut on the Chi2 in z-direction in the likelihood filter
+  Double_t  fkPhiCut;                // Cut on the deviation of the phi angles between tracklet and track fit (lik. filter)
+  Double_t  fkMeanNclusters;         // Mean of the distribution of the number of clusters per tracklet
+  Double_t  fkSigmaNclusters;        // Sigma of the distribution of the number of clusters per tracklet
   Double_t  fkTrackLikelihood;       // Track likelihood for tracklets Rieman fit
   
   Double_t  fSysCovMatrix[5];        // Systematic uncertainty from calibration and alignment for each tracklet
index 52eea61..edd3769 100644 (file)
@@ -2385,14 +2385,13 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 *ss
               <<"RiemanFitter.="               << rim
               <<"\n";
         }
-      
         if(chi2[0] > fReconstructor->GetRecoParam() ->GetChi2Z()/*7./(3. - sLayer)*//*iter*/){
-          //AliInfo(Form("Failed chi2 filter on chi2Z [%f].", chi2[0]));
+//          //AliInfo(Form("Failed chi2 filter on chi2Z [%f].", chi2[0]));
           AliTRDtrackerDebug::SetCandidateNumber(AliTRDtrackerDebug::GetCandidateNumber() + 1);
           continue;
         }
         if(chi2[1] > fReconstructor->GetRecoParam() ->GetChi2Y()/*1./(3. - sLayer)*//*iter*/){
-          //AliInfo(Form("Failed chi2 filter on chi2Y [%f].", chi2[1]));
+//          //AliInfo(Form("Failed chi2 filter on chi2Y [%f].", chi2[1]));
           AliTRDtrackerDebug::SetCandidateNumber(AliTRDtrackerDebug::GetCandidateNumber() + 1);
           continue;
         }
@@ -2436,12 +2435,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 *ss
 
         // fit tracklets and cook likelihood
         FitTiltedRieman(&cseed[0], kTRUE);// Update Seeds and calculate Likelihood
-        chi2[0] = GetChi2Y(&cseed[0]);
-        chi2[1] = GetChi2Z(&cseed[0]);
-        //Chi2 definitions in testing stage
-        //chi2[0] = GetChi2YTest(&cseed[0]);
-        //chi2[1] = GetChi2ZTest(&cseed[0]);
-        Double_t like = CookLikelihood(&cseed[0], planes, chi2); // to be checked
+        Double_t like = CookLikelihood(&cseed[0], planes); // to be checked
       
         if (TMath::Log(1.E-9 + like) < fReconstructor->GetRecoParam() ->GetTrackLikelihood()){
           //AliInfo(Form("Failed likelihood %f[%e].", TMath::Log(1.E-9 + like), like));
@@ -2504,7 +2498,7 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 *ss
         // do the final track fitting (Once with vertex constraint and once without vertex constraint)
         Double_t chi2Vals[3];
         chi2Vals[0] = FitTiltedRieman(&cseed[0], kFALSE);
-        if(fReconstructor->GetRecoParam() ->IsVertexConstrained())
+        if(fReconstructor->GetRecoParam()->IsVertexConstrained())
           chi2Vals[1] = FitTiltedRiemanConstraint(&cseed[0], GetZ()); // Do Vertex Constrained fit if desired
         else
           chi2Vals[1] = 1.;
@@ -2545,12 +2539,17 @@ Int_t AliTRDtrackerV1::MakeSeeds(AliTRDtrackingChamber **stack, AliTRDseedV1 *ss
           Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
           TLinearFitter *fitterTC = GetTiltedRiemanFitterConstraint();
           TLinearFitter *fitterT = GetTiltedRiemanFitter();
+          Int_t ncls = 0; 
+          for(Int_t iseed = 0; iseed < kNPlanes; iseed++){
+               ncls += cseed[iseed].IsOK() ? cseed[iseed].GetN2() : 0;
+          }
           cstreamer << "MakeSeeds2"
               << "EventNumber="                << eventNumber
               << "CandidateNumber="    << candidateNumber
               << "Chi2TR="                     << chi2Vals[0]
               << "Chi2TC="                     << chi2Vals[1]
               << "Nlayers="                    << mlayers
+              << "NClusters="   << ncls
               << "NUsedS="                     << nUsedCl
               << "NUsed="                              << nusedf
               << "Like="                               << like
@@ -2612,7 +2611,15 @@ AliTRDtrackV1* AliTRDtrackerV1::MakeTrack(AliTRDseedV1 *seeds, Double_t *params)
 
   AliTRDtrackV1 track(seeds, &params[1], c, params[0], params[6]*alpha+shift);
   track.PropagateTo(params[0]-5.0);
-  if(fReconstructor->IsHLT()) return SetTrack(&track);
+  if(fReconstructor->IsHLT()){ 
+    AliTRDseedV1 *ptrTracklet = 0x0;
+    for(Int_t ip=0; ip<kNPlanes; ip++){
+      track.UnsetTracklet(ip);
+      ptrTracklet = SetTracklet(&seeds[ip]);
+      track.SetTracklet(ptrTracklet, fTracklets->GetEntriesFast()-1);
+    }
+    return SetTrack(&track);
+  }
 
   track.ResetCovariance(1);
   Int_t nc = TMath::Abs(FollowBackProlongation(track));
@@ -2792,8 +2799,7 @@ Double_t AliTRDtrackerV1::CalculateTrackLikelihood(AliTRDseedV1 *tracklets, Doub
 }
 
 //____________________________________________________________________
-Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]
-          , Double_t *chi2)
+Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4])
 {
   //
   // Calculate the probability of this track candidate.
@@ -2820,9 +2826,11 @@ Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]
   //
 
   // ratio of the total number of clusters/track which are expected to be found by the tracker.
-  Float_t fgFindable = fReconstructor->GetRecoParam() ->GetFindableClusters();
-
+  const AliTRDrecoParam *fRecoPars = fReconstructor->GetRecoParam();
   
+       Double_t chi2y = GetChi2Y(&cseed[0]);
+  Double_t chi2z = GetChi2Z(&cseed[0]);
+
   Int_t nclusters = 0;
   Double_t sumda = 0.;
   for(UChar_t ilayer = 0; ilayer < 4; ilayer++){
@@ -2830,19 +2838,24 @@ Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]
     nclusters += cseed[jlayer].GetN2();
     sumda += TMath::Abs(cseed[jlayer].GetYfitR(1) - cseed[jlayer].GetYref(1));
   }
-  Double_t likea     = TMath::Exp(-sumda*10.6);
+  Double_t likea     = TMath::Exp(-sumda * fRecoPars->GetPhiCut());
   Double_t likechi2y  = 0.0000000001;
-  if (chi2[0] < 0.5) likechi2y += TMath::Exp(-TMath::Sqrt(chi2[0]) * 7.73);
-  Double_t likechi2z = TMath::Exp(-chi2[1] * 0.088) / TMath::Exp(-chi2[1] * 0.019);
-  Int_t enc = Int_t(fgFindable*4.*fgNTimeBins);        // Expected Number Of Clusters, normally 72
-  Double_t likeN     = TMath::Exp(-(enc - nclusters) * 0.19);
-  
+  if (fReconstructor->IsCosmic() || chi2y < 0.5) likechi2y += TMath::Exp(-TMath::Sqrt(chi2y) * fRecoPars->GetChi2YCut());
+  Double_t likechi2z = TMath::Exp(-chi2z * fRecoPars->GetChi2ZCut());
+  Double_t likeN     = TMath::Exp(-(fRecoPars->GetMeanNclusters() - nclusters) / fRecoPars->GetSigmaNclusters());
   Double_t like      = likea * likechi2y * likechi2z * likeN;
 
   //   AliInfo(Form("sumda(%f) chi2[0](%f) chi2[1](%f) likea(%f) likechi2y(%f) likechi2z(%f) nclusters(%d) likeN(%f)", sumda, chi2[0], chi2[1], likea, likechi2y, likechi2z, nclusters, likeN));
   if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
     Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
     Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
+    Int_t nTracklets = 0; Float_t mean_ncls = 0;
+    for(Int_t iseed=0; iseed < kNPlanes; iseed++){
+       if(!cseed[iseed].IsOK()) continue;
+       nTracklets++;
+       mean_ncls += cseed[iseed].GetN2();
+    }
+    if(nTracklets) mean_ncls /= nTracklets;
     // The Debug Stream contains the seed 
     TTreeSRedirector &cstreamer = *fgDebugStreamer;
     cstreamer << "CookLikelihood"
@@ -2855,14 +2868,15 @@ Double_t AliTRDtrackerV1::CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]
         << "tracklet4.="                       << &cseed[4]
         << "tracklet5.="                       << &cseed[5]
         << "sumda="                                            << sumda
-        << "chi0="                                             << chi2[0]
-        << "chi1="                                             << chi2[1]
+        << "chi2y="                                            << chi2y
+        << "chi2z="                                            << chi2z
         << "likea="                                            << likea
         << "likechi2y="                                << likechi2y
         << "likechi2z="                                << likechi2z
         << "nclusters="                                << nclusters
         << "likeN="                                            << likeN
         << "like="                                             << like
+        << "meanncls="        << mean_ncls
         << "\n";
   }
 
@@ -3247,7 +3261,7 @@ Float_t AliTRDtrackerV1::GetChi2Y(AliTRDseedV1 *tracklets) const
   Float_t chi2 = 0;
   for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
     if(!tracklets[ipl].IsOK()) continue;
-    Double_t distLayer = tracklets[ipl].GetYfit(0) - tracklets[ipl].GetYref(0); 
+    Double_t distLayer = (tracklets[ipl].GetYfit(0) - tracklets[ipl].GetYref(0));// /tracklets[ipl].GetSigmaY(); 
     chi2 += distLayer * distLayer;
   }
   return chi2;
@@ -3268,12 +3282,14 @@ void AliTRDtrackerV1::ResetSeedTB()
 //_____________________________________________________________________________
 Float_t AliTRDtrackerV1::GetChi2Z(AliTRDseedV1 *tracklets) const 
 {
-  //   Chi2 definition on z-direction
+  //   Calculates normalized chi2 in z-direction
 
   Float_t chi2 = 0;
+  // chi2 = Sum ((z - zmu)/sigma)^2
+  // Sigma for the z direction is defined as half of the padlength
   for(Int_t ipl = 0; ipl < kNPlanes; ipl++){
     if(!tracklets[ipl].IsOK()) continue;
-    Double_t distLayer = tracklets[ipl].GetMeanz() - tracklets[ipl].GetZref(0); 
+    Double_t distLayer = (tracklets[ipl].GetMeanz() - tracklets[ipl].GetZref(0)); // /(tracklets[ipl].GetPadLength()/2); 
     chi2 += distLayer * distLayer;
   }
   return chi2;
index 691e5aa..48b30a9 100644 (file)
@@ -146,7 +146,7 @@ protected:
 private:
   AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
   AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
-  Double_t             CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2);
+  Double_t             CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4]);
   Double_t             CalculateTrackLikelihood(AliTRDseedV1 *tracklets, Double_t *chi2);
   Int_t                ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
   static Float_t       CalculateReferenceX(AliTRDseedV1 *tracklets);
index cf938b7..98b3024 100644 (file)
Binary files a/TRD/Calib/RecoParam/Run0_999999999_v0_s0.root and b/TRD/Calib/RecoParam/Run0_999999999_v0_s0.root differ