improve tracklet error messaging
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Oct 2009 12:31:24 +0000 (12:31 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Oct 2009 12:31:24 +0000 (12:31 +0000)
improve tracking tracker errors by new debug streams

TRD/AliTRDseedV1.cxx
TRD/AliTRDseedV1.h
TRD/AliTRDtrackerV1.cxx
TRD/qaRec/AliTRDpidRefMakerLQ.cxx

index 5678e21..d4e7a45 100644 (file)
@@ -77,6 +77,7 @@ AliTRDseedV1::AliTRDseedV1(Int_t det)
   ,fDiffL(0.)
   ,fDiffT(0.)
   ,fClusterIdx(0)
+  ,fErrorMsg(0)
   ,fN(0)
   ,fDet(det)
   ,fPt(0.)
@@ -123,6 +124,7 @@ AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref)
   ,fDiffL(0.)
   ,fDiffT(0.)
   ,fClusterIdx(0)
+  ,fErrorMsg(0)
   ,fN(0)
   ,fDet(-1)
   ,fPt(0.)
@@ -200,6 +202,7 @@ void AliTRDseedV1::Copy(TObject &ref) const
   target.fDiffL         = fDiffL;
   target.fDiffT         = fDiffT;
   target.fClusterIdx    = 0;
+  target.fErrorMsg      = fErrorMsg;
   target.fN             = fN;
   target.fDet           = fDet;
   target.fPt            = fPt;
@@ -263,6 +266,7 @@ void AliTRDseedV1::Reset()
   fExB=0.;fVD=0.;fT0=0.;fS2PRF=0.;
   fDiffL=0.;fDiffT=0.;
   fClusterIdx=0;
+  fErrorMsg = 0;
   fN=0;
   fDet=-1;
   fPt=0.;
@@ -981,6 +985,7 @@ Bool_t      AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t
   AliDebug(4, Form("Found %d clusters. Processing ...", ncls));
   if(ncls<kClmin){ 
     AliDebug(2, Form("CLUSTERS FOUND %d LESS THAN THRESHOLD %d.", ncls, kClmin));
+    SetErrorMsg(kAttachClFound);
     return kFALSE;
   }
 
@@ -1056,6 +1061,7 @@ Bool_t    AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t
   AliDebug(4, Form("  Ncl[rowMax = %d] = %d", row, nrow[0]));
   if(row<0){ 
     AliDebug(2, Form("WRONG ROW %d.", row));
+    SetErrorMsg(kAttachRow);
     return kFALSE;
   }
   // Select and store clusters 
@@ -1083,6 +1089,7 @@ Bool_t    AliTRDseedV1::AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t
   // number of minimum numbers of clusters expected for the tracklet
   if (n < kClmin){
     AliDebug(2, Form("NOT ENOUGH CLUSTERS TO FIT THE TRACKLET %d [%d].", n, kClmin));
+    SetErrorMsg(kAttachClAttach);
     return kFALSE;
   }
   SetN(n);
index e7f734f..df575c8 100644 (file)
@@ -67,6 +67,11 @@ public:
    ,kKink       = BIT(18) // kink prolongation tracklet
    ,kStandAlone = BIT(19) // tracklet build during stand alone track finding
   };
+  enum ETRDtrackletError {
+    kAttachClFound = 1  // not enough clusters found
+   ,kAttachRow          // found row < 0
+   ,kAttachClAttach     // not enough clusters attached
+  };
 
   AliTRDseedV1(Int_t det = -1);
   ~AliTRDseedV1();
@@ -102,6 +107,7 @@ public:
   void      GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov, 7*sizeof(Double_t));}
   static Double_t GetCovSqrt(const Double_t * const c, Double_t *d);
   static Double_t GetCovInv(const Double_t * const c, Double_t *d);
+  UChar_t   GetErrorMsg() const      { return fErrorMsg;}
   Float_t   GetdX() const            { return fdX;}
   const Float_t*  GetdEdx() const    { return &fdEdx[0];}
   Float_t   GetdQdl(Int_t ic, Float_t *dx=NULL) const;
@@ -159,6 +165,7 @@ public:
   void      SetC(Float_t c)          { fC = c;}
   void      SetChi2(Float_t chi2)    { fChi2 = chi2;}
   inline void SetCovRef(const Double_t *cov);
+  void      SetErrorMsg(Int_t err)   { fErrorMsg = err;}
   void      SetIndexes(Int_t i, Int_t idx) { fIndexes[i]  = idx; }
   void      SetLabels(Int_t *lbls)   { memcpy(fLabels, lbls, 3*sizeof(Int_t)); }
   void      SetKink(Bool_t k = kTRUE){ SetBit(kKink, k);}
@@ -199,6 +206,7 @@ private:
   Float_t          fDiffL;                  //! longitudinal diffusion coefficient
   Float_t          fDiffT;                  //! transversal diffusion coefficient
   Char_t           fClusterIdx;             //! clusters iterator
+  UChar_t          fErrorMsg;               // processing error
   UShort_t         fN;                      // number of clusters attached/used/shared
   Short_t          fDet;                    // TRD detector
   AliTRDcluster   *fClusters[kNclusters];   // Clusters
@@ -225,7 +233,7 @@ private:
   static TLinearFitter   *fgFitterY;        // Linear Fitter for tracklet fit in xy-plane
   static TLinearFitter   *fgFitterZ;        // Linear Fitter for tracklet fit in xz-plane
 
-  ClassDef(AliTRDseedV1, 7)                 // The offline TRD tracklet 
+  ClassDef(AliTRDseedV1, 8)                 // The offline TRD tracklet 
 };
 
 //____________________________________________________________
index d9897ad..02bc7d6 100644 (file)
@@ -678,6 +678,9 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t)
   Double_t driftLength = .5*AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick();
   AliTRDtrackingChamber *chamber = NULL;
   
+  Int_t debugLevel = fkReconstructor->IsDebugStreaming() ? fkReconstructor->GetRecoParam()->GetStreamLevel(AliTRDrecoParam::kTracker) : 0;
+  TTreeSRedirector *cstreamer = fkReconstructor->IsDebugStreaming() ? fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker) : 0x0;
+
   AliTRDseedV1 tracklet, *ptrTracklet = NULL;
   // in case of stand alone tracking we store all the pointers to the tracklets in a temporary array
   AliTRDseedV1 *tracklets[kNPlanes];
@@ -822,10 +825,26 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t)
       }
       if(!tracklet.AttachClusters(chamber, kTRUE)){   
         t.SetStatus(AliTRDtrackV1::kNoAttach, ily);
+        if(debugLevel>3){
+          AliTRDseedV1 trackletCp(*ptrTracklet);
+          UChar_t status(t.GetStatusTRD(ily));
+          (*cstreamer)   << "FollowBackProlongation2"
+          <<"status="    << status
+          <<"tracklet.=" << &trackletCp
+          << "\n";
+        }
         continue;
       }
       if(tracklet.GetN() < fgNTimeBins*fkReconstructor->GetRecoParam() ->GetFindableClusters()){
         t.SetStatus(AliTRDtrackV1::kNoClustersTracklet, ily);
+        if(debugLevel>3){
+          AliTRDseedV1 trackletCp(*ptrTracklet);
+          UChar_t status(t.GetStatusTRD(ily));
+          (*cstreamer)   << "FollowBackProlongation2"
+          <<"status="    << status
+          <<"tracklet.=" << &trackletCp
+          << "\n";
+        }
         continue;
       }
       ptrTracklet->UpdateUsed();
@@ -860,39 +879,36 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t)
     Double_t cov[3]; ptrTracklet->GetCovAt(x, cov);
     Double_t p[2] = { ptrTracklet->GetY(), ptrTracklet->GetZ()};
     Double_t chi2 = ((AliExternalTrackParam)t).GetPredictedChi2(p, cov);
-    if(fkReconstructor->GetRecoParam()->GetStreamLevel(AliTRDrecoParam::kTracker) > 2 && fkReconstructor->IsDebugStreaming()){
-      Double_t ytrack = ptrTracklet->GetYref(0);
-      Double_t ztrack = ptrTracklet->GetZref(0);
-      Double_t ytracklet = ptrTracklet->GetYfit(0);
-      Double_t ztracklet = ptrTracklet->GetZfit(0);
-      Double_t phitrack = ptrTracklet->GetYref(1);
-      Double_t phitracklet = ptrTracklet->GetYfit(1);
-      Double_t thetatrack = ptrTracklet->GetZref(1);
-      Double_t thetatracklet = ptrTracklet->GetZfit(1);
-   
-      TTreeSRedirector &mystreamer = *fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
-      mystreamer << "FollowBackProlongation1"
-        << "il="              << ily
-        << "x="               << x
-        << "ytrack="          << ytrack
-        << "ztrack="          << ztrack
-        << "ytracklet="       << ytracklet
-        << "ztracklet="       << ztracklet
-        << "phitrack="        << phitrack
-        << "thetatrack="      << thetatrack
-        << "phitracklet="     << phitracklet
-        << "thetatracklet="   << thetatracklet
-        << "chi2="            << chi2
-        << "\n";
-    }
     // update Kalman with the TRD measurement
     if(chi2>1e+10){ // TODO
       t.SetStatus(AliTRDtrackV1::kChi2, ily);
+      if(debugLevel > 2){
+        UChar_t status(t.GetStatusTRD());
+        AliTRDseedV1  trackletCp(*ptrTracklet);
+        AliTRDtrackV1 trackCp(t);
+        trackCp.SetOwner();
+        (*cstreamer) << "FollowBackProlongation1"
+            << "status="      << status
+            << "tracklet.="   << &trackletCp
+            << "track.="      << &trackCp
+            << "\n";
+      }
       continue; 
     }
     if(!t.Update(p, cov, chi2)) {
       n=-1; 
       t.SetStatus(AliTRDtrackV1::kUpdate);
+      if(debugLevel > 2){
+        UChar_t status(t.GetStatusTRD());
+        AliTRDseedV1  trackletCp(*ptrTracklet);
+        AliTRDtrackV1 trackCp(t);
+        trackCp.SetOwner();
+        (*cstreamer) << "FollowBackProlongation1"
+            << "status="      << status
+            << "tracklet.="   << &trackletCp
+            << "track.="      << &trackCp
+            << "\n";
+      }
       break;
     }
     // fill residuals ?!
@@ -927,12 +943,11 @@ Int_t AliTRDtrackerV1::FollowBackProlongation(AliTRDtrackV1 &t)
   //printf("clusters[%d] chi2[%f] x[%f] status[%d ", n, t.GetChi2(), t.GetX(), t.GetStatusTRD());
   //for(int i=0; i<6; i++) printf("%d ", t.GetStatusTRD(i)); printf("]\n");
 
-  if(fkReconstructor->GetRecoParam()->GetStreamLevel(AliTRDrecoParam::kTracker) > 1 && fkReconstructor->IsDebugStreaming()){
-    TTreeSRedirector &cstreamer = *fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+  if(debugLevel > 1){
     Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
     AliTRDtrackV1 track(t);
     track.SetOwner();
-    cstreamer << "FollowBackProlongation"
+    (*cstreamer) << "FollowBackProlongation0"
         << "EventNumber=" << eventNumber
         << "ncl="         << n
         << "track.="      << &track
index bc61d63..e961d5a 100644 (file)
@@ -187,7 +187,7 @@ Bool_t AliTRDpidRefMakerLQ::PostProcess()
   for(Int_t ip=AliTRDCalPID::kNMom; ip--; ){ 
     for(Int_t is=AliPID::kSPECIES; is--;) {
       Int_t n(0); // index of data
-      for(Int_t itrk; itrk<fData->GetEntries() & n<kMaxStat; itrk++){
+      for(Int_t itrk=0; itrk<fData->GetEntries() & n<kMaxStat; itrk++){
         if(!(fData->GetEntry(itrk))) continue;
         if(fPIDbin!=is) continue;
         for(Int_t ily=fPIDdataArray->fNtracklets; ily--;){