]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveDet/AliEveTRDData.cxx
consistent naming
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTRDData.cxx
index 9495a149ac88c11cf90d4683faf2c474223f1899..8ef370669f62beeba6b8c873ab509189af23b69d 100644 (file)
@@ -23,6 +23,7 @@
 #include "AliLog.h"
 #include "AliPID.h"
 #include "AliTrackPointArray.h"
+#include "AliRieman.h"
 
 #include "AliTRDhit.h"
 #include "AliTRDcluster.h"
@@ -31,7 +32,6 @@
 #include "AliTRDtrackerV1.h"
 #include "AliTRDpadPlane.h"
 #include "AliTRDdigitsManager.h"
-#include "AliTRDdataArrayDigits.h"
 #include "AliTRDarrayADC.h"
 #include "AliTRDSignalIndex.h"
 #include "AliTRDgeometry.h"
@@ -96,7 +96,7 @@ void AliEveTRDDigits::ComputeRepresentation()
     for (Int_t ic = 0; ic < ncols; ic++) {
       dy = pp->GetColSize(ic);
       for (Int_t it = 0; it < ntbs; it++) {
-        q = fData.GetDataUnchecked(ir, ic, it);
+        q = fData.GetData(ir, ic, it);
         if (q < threshold) continue;
 
         Double_t x[6] = {0., 0., Double_t(q), 0., 0., 0.}; 
@@ -114,7 +114,7 @@ void AliEveTRDDigits::ComputeRepresentation()
       }  // end time loop
     }  // end col loop
   }  // end row loop
-  fData.Compress(1);
+  fData.Compress();
   
   // rotate to global coordinates
   //RefitPlex();
@@ -149,12 +149,12 @@ void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits)
       }
       adc = data->GetData(row, col, time);
       if(adc <= 1) continue;
-      fData.SetDataUnchecked(row, col, time, adc);
+      fData.SetData(row, col, time, adc);
       //fIndex->AddIndexTBin(row,col,time);
       //printf("\tr[%d] c[%d] t[%d] ADC[%d]\n", row, col, time, adc);
     } 
   }
-  fData.Compress(1);
+  fData.Compress();
 }
 
 
@@ -343,46 +343,60 @@ AliEveTRDTracklet::AliEveTRDTracklet(AliTRDseedV1 *trklt):TEveLine()
   SetName("tracklet");
   
   SetUserData(trklt);
-  Int_t det = -1, sec;
+  Float_t dx;
+  Float_t x0   = trklt->GetX0();
+  Float_t y0   = trklt->GetYref(0);
+  Float_t z0   = trklt->GetZref(0);
+  Float_t dydx = trklt->GetYref(1);
+  Float_t dzdx = trklt->GetZref(1);
+  Float_t tilt = trklt->GetTilt();
   Float_t g[3];
   AliTRDcluster *c = 0x0;
-  for(Int_t ic=0; ic<AliTRDseed::knTimebins; ic++){
+  for(Int_t ic=0; ic<AliTRDseedV1::kNclusters; ic++){
     if(!(c = trklt->GetClusters(ic))) continue;
     if(!fClusters) AddElement(fClusters = new AliEveTRDClusters());
-    det = c->GetDetector();
+    dx = x0 - c->GetX();
+    //Float_t yt = y0 - dx*dydx;
+    Float_t zt = z0 - dx*dzdx;
+    // backup yc - for testing purposes
+    Float_t yc = c->GetY(); 
+    c->SetY(yc-tilt*(c->GetZ()-zt));
     c->GetGlobalXYZ(g); 
     Int_t id = fClusters->SetNextPoint(g[0], g[1], g[2]);    
     //Int_t id = fClusters->SetNextPoint(c->GetX(), c->GetY(), c->GetZ());    
+    c->SetY(yc);
     fClusters->SetPointId(id, new AliTRDcluster(*c));
   } 
-  if(fClusters) fClusters->SetTitle(Form("N[%d]", trklt->GetN2()));
-
+  if(fClusters){
+    fClusters->SetTitle(Form("N[%d]", trklt->GetN2()));
+    fClusters->SetMarkerColor(kMagenta);
+  }
 
-  SetTitle(Form("Det[%d] Plane[%d] P[%7.3f]", det, trklt->GetPlane(), trklt->GetMomentum()));
+  SetTitle(Form("Det[%d] Plane[%d] P[%7.3f]", trklt->GetDetector(), trklt->GetPlane(), trklt->GetMomentum()));
   SetLineColor(kRed);
   //SetOwnIds(kTRUE);
   
-  sec = det/30;
+  // init tracklet line
+  Int_t sec = AliTRDgeometry::GetSector(trklt->GetDetector());
   Double_t alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); 
-  Double_t x0 = trklt->GetX0(), 
-    y0f = trklt->GetYfit(0), 
-    ysf = trklt->GetYfit(1),
-    z0r = trklt->GetZref(0), 
-    zsr = trklt->GetZref(1);
-  Double_t xg =  x0 * TMath::Cos(alpha) - y0f * TMath::Sin(alpha); 
-  Double_t yg = x0 * TMath::Sin(alpha) + y0f * TMath::Cos(alpha);
-  SetPoint(0, xg, yg, z0r);
-  //SetPoint(0, x0, y0f, z0r);
-
-
-  //SetPointId(0, new AliTRDseedV1(*trackletObj));
-  Double_t x1 = x0-3.5, 
-    y1f = y0f - ysf*3.5,
-    z1r = z0r - zsr*3.5; 
-  xg =  x1 * TMath::Cos(alpha) - y1f * TMath::Sin(alpha); 
-  yg = x1 * TMath::Sin(alpha) + y1f * TMath::Cos(alpha);
-  SetPoint(1, xg, yg, z1r);
-  //SetPoint(1, x1, y1f, z1r);
+
+  //trklt->Fit(kTRUE);
+  y0   = trklt->GetYfit(0);
+  dydx = trklt->GetYfit(1);
+  Double_t xg =  x0 * TMath::Cos(alpha) - y0 * TMath::Sin(alpha); 
+  Double_t yg = x0 * TMath::Sin(alpha) + y0 * TMath::Cos(alpha);
+  SetPoint(0, xg, yg, z0); 
+  //SetPoint(0, x0, y0, z0);
+
+
+  dx = .5*AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght();
+  x0 -= dx; 
+  y0 -= dydx*dx,
+  z0 -= dzdx*dx; 
+  xg = x0 * TMath::Cos(alpha) - y0 * TMath::Sin(alpha); 
+  yg = x0 * TMath::Sin(alpha) + y0 * TMath::Cos(alpha);
+  SetPoint(1, xg, yg, z0);
+  //SetPoint(1, x0, y0, z0);
 }
 
 //______________________________________________________________________________
@@ -404,6 +418,7 @@ AliEveTRDTrack::AliEveTRDTrack(AliTRDtrackV1 *trk)
   ,fESDStatus(0)
   ,fAlpha(0.)
   ,fPoints(0x0)
+  ,fRim(0x0)
 {
   // Constructor.
   SetUserData(trk);
@@ -411,13 +426,26 @@ AliEveTRDTrack::AliEveTRDTrack(AliTRDtrackV1 *trk)
 
   AliTRDtrackerV1::SetNTimeBins(24);
 
+
+  fRim = new AliRieman(trk->GetNumberOfClusters());
   AliTRDseedV1 *tracklet = 0x0;
   for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){
     if(!(tracklet = trk->GetTracklet(il))) continue;
     if(!tracklet->IsOK()) continue;
     AddElement(new AliEveTRDTracklet(tracklet));
-  }
 
+    AliTRDcluster *c = 0x0;
+    tracklet->ResetClusterIter(kFALSE);
+    while((c = tracklet->PrevCluster())){
+      Float_t xc = c->GetX();
+      Float_t yc = c->GetY();
+      Float_t zc = c->GetZ();
+      Float_t zt = tracklet->GetZref(0) - (tracklet->GetX0()-xc)*tracklet->GetZref(1); 
+      yc -= tracklet->GetTilt()*(zc-zt);
+      fRim->AddPoint(xc, yc, zc, 1, 10);
+    }
+  }
+  fRim->Update();
   SetStatus(fTrackState);
 }
 
@@ -428,6 +456,13 @@ AliEveTRDTrack::~AliEveTRDTrack()
   //delete dynamic_cast<AliTRDtrackV1*>(GetUserData());
 }
 
+//______________________________________________________________________________
+void AliEveTRDTrack::Print(Option_t *o) const
+{
+  AliTRDtrackV1 *track = (AliTRDtrackV1*)GetUserData();
+  if(!track) return;
+  track->Print(o);
+}
 
 //______________________________________________________________________________
 void AliEveTRDTrack::SetStatus(UChar_t s)
@@ -442,15 +477,23 @@ void AliEveTRDTrack::SetStatus(UChar_t s)
   if(!fPoints){ 
     fPoints = new AliTrackPoint[nc];
 
-    AliTRDcluster *c = trk->GetCluster(0);
-    Double_t x = c->GetX();
-    Int_t sec = c->GetDetector()/30;
-    fAlpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); 
+    // define the radial span of the track in the TRD
+    Double_t xmin = -1., xmax = -1.;
+    Int_t det = 0;
+    AliTRDseedV1 *trklt = 0x0;
+    for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){
+      if(!(trklt = trk->GetTracklet(ily))) continue;
+      if(xmin<0.) xmin = trklt->GetX0() - AliTRDgeometry::CamHght() - AliTRDgeometry::CdrHght();
+      if(xmax<0.) xmax = trklt->GetX0();
+      det = trklt->GetDetector();
+    }
+    Int_t sec = det/AliTRDgeometry::kNdets;
+    fAlpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); //trk->GetAlpha()
 
-    Double_t dx = (trk->GetCluster(trk->GetNumberOfClusters()-1)->GetX()-x)/nc;
+    Double_t dx =(xmax - xmin)/nc;
     for(Int_t ip=0; ip<nc; ip++){
-      fPoints[ip].SetXYZ(x, 0., 0.);
-      x+=dx;
+      fPoints[ip].SetXYZ(xmin, 0., 0.);
+      xmin+=dx;
     }
     BUILD = kTRUE;
   }
@@ -466,7 +509,12 @@ void AliEveTRDTrack::SetStatus(UChar_t s)
         if(trk->GetNumberOfTracklets() >=4) AliTRDtrackerV1::FitKalman(trk, 0x0, kFALSE, nc, fPoints);
       } else { 
         //printf("Rieman track\n");
-        if(trk->GetNumberOfTracklets() >=4) AliTRDtrackerV1::FitRiemanTilt(trk, 0x0, kTRUE, nc, fPoints);
+        // if(trk->GetNumberOfTracklets() >=4) AliTRDtrackerV1::FitRiemanTilt(trk, 0x0, kTRUE, nc, fPoints);
+        Float_t x = 0.;
+        for(Int_t ip = nc; ip--;){
+          x = fPoints[ip].GetX();
+          fPoints[ip].SetXYZ(x, fRim->GetYat(x), fRim->GetZat(x));
+        }
       }
     }
   
@@ -490,7 +538,7 @@ void AliEveTRDTrack::SetStatus(UChar_t s)
         SetLineColor(kMagenta);
       }
     } else {
-      if(TESTBIT(s, kPID) == AliTRDReconstructor::kLQPID){
+      if(TESTBIT(s, kPID) == AliTRDpidUtil::kLQ){
         //printf("PID color kLQPID\n");
         //trk->GetReconstructor()->SetOption("!nn");
       } else {