Add full support for SPD tracklets.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Oct 2009 15:36:19 +0000 (15:36 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Oct 2009 15:36:19 +0000 (15:36 +0000)
This is now enabled by default in visscan_init.C.

Track-counter now holds separate statistics for tracks and tracklets.
Per event output files are mostly ok.

Tracklet histogram display should be added.

EVE/EveBase/AliEveTrack.cxx
EVE/EveBase/AliEveTrack.h
EVE/EveBase/AliEveTrackCounter.cxx
EVE/EveBase/AliEveTrackCounter.h
EVE/EveBase/AliEveTrackCounterEditor.cxx
EVE/EveBase/AliEveTrackCounterEditor.h
EVE/EveBase/AliEveTracklet.cxx [new file with mode: 0644]
EVE/EveBase/AliEveTracklet.h [new file with mode: 0644]
EVE/EveBase/EveBaseLinkDef.h
EVE/alice-macros/esd_spd_tracklets.C
EVE/macros/visscan_init.C

index 3c711b6..449677c 100644 (file)
@@ -224,3 +224,21 @@ void AliEveTrack::PrintKineStack()
   TEveUtil::LoadMacro("print_kine_from_label.C");
   gROOT->ProcessLine(Form("print_kine_from_label(%d);", label));
 }
+
+//______________________________________________________________________________
+void AliEveTrack::SecSelected(TEveTrack* track)
+{
+  // Emits "SecSelected(TEveTrack*)" signal.
+  // Called from TEveTrackGL on secondary-selection.
+
+  Emit("SecSelected(TEveTrack*)", (Long_t)track);
+  SecSelectedTrack((AliEveTrack*) track);
+}
+
+//______________________________________________________________________________
+void AliEveTrack::SecSelectedTrack(AliEveTrack* track)
+{
+  // Emits "SecSelectedTrack(AliEveTrack*)" signal.
+
+  Emit("SecSelectedTrack(AliEveTrack*)", (Long_t)track);
+}
index abe9647..3109196 100644 (file)
@@ -40,6 +40,9 @@ public:
                          Bool_t colorPdg    =kTRUE, Bool_t recurse    =kTRUE); // *MENU*
   void PrintKineStack();          // *MENU*
 
+  virtual void SecSelected(TEveTrack*);        // *SIGNAL*
+  virtual void SecSelectedTrack(AliEveTrack*); // *SIGNAL*
+
 protected:
 
 private:
index 6c25035..f7aea37 100644 (file)
@@ -11,7 +11,9 @@
 
 #include "TEveManager.h"
 #include "AliEveTrack.h"
-#include "TEveGedEditor.h"
+#include "AliEveTracklet.h"
+
+#include <TEveGedEditor.h>
 
 //==============================================================================
 // AliEveTrackCounter
@@ -35,32 +37,36 @@ AliEveTrackCounter* AliEveTrackCounter::fgInstance = 0;
 
 //______________________________________________________________________________
 AliEveTrackCounter::AliEveTrackCounter(const Text_t* name, const Text_t* title) :
-   TEveElement(),
-   TNamed(name, title),
-
-   fBadLineStyle (6),
-   fClickAction  (kCA_ToggleTrack),
-   fEventId      (-1),
-   fAllTracks    (0),
-   fGoodTracks   (0),
-   fTrackLists   ()
+  TEveElement(),
+  TNamed(name, title),
+
+  fBadLineStyle (6),
+  fClickAction  (kCA_ToggleTrack),
+  fEventId      (-1),
+  fAllTracks    (0), fGoodTracks   (0),
+  fAllTracklets (0), fGoodTracklets(0),
+  fTrackLists   (),  fTrackletLists()
 {
-   // Constructor.
-   // Connects to global signal "AliEveTrack", "SecSelected(AliEveTrack*)".
+  // Constructor.
+  // Connects to global signal "AliEveTrack", "SecSelected(AliEveTrack*)".
+
+  if (fgInstance == 0) fgInstance = this;
 
-   if (fgInstance == 0) fgInstance = this;
-   TQObject::Connect("AliEveTrack", "SecSelected(AliEveTrack*)",
-                     "AliEveTrackCounter", this, "DoTrackAction(AliEveTrack*)");
+  TQObject::Connect("AliEveTrack", "SecSelectedTrack(AliEveTrack*)",
+                    "AliEveTrackCounter", this, "DoTrackAction(AliEveTrack*)");
+  TQObject::Connect("AliEveTracklet", "SecSelectedTracklet(AliEveTracklet*)",
+                    "AliEveTrackCounter", this, "DoTrackletAction(AliEveTracklet*)");
 }
 
 //______________________________________________________________________________
 AliEveTrackCounter::~AliEveTrackCounter()
 {
-   // Destructor.
-   // Disconnect from the global track signals.
+  // Destructor.
+  // Disconnect from the global track signals.
 
-   TQObject::Disconnect("AliEveTrack", "DoTrackAction(AliEveTrack*)");
-   if (fgInstance == this) fgInstance = 0;
+  TQObject::Disconnect("AliEveTrack", "DoTrackAction(AliEveTrack*)");
+  TQObject::Disconnect("AliEveTracklet", "DoTrackletAction(AliEveTracklet*)");
+  if (fgInstance == this) fgInstance = 0;
 }
 
 /******************************************************************************/
@@ -68,49 +74,86 @@ AliEveTrackCounter::~AliEveTrackCounter()
 //______________________________________________________________________________
 void AliEveTrackCounter::Reset()
 {
-   // Reset internal track-counters and track-list.
-
-   fAllTracks  = 0;
-   fGoodTracks = 0;
-   TIter next(&fTrackLists);
-   TEveTrackList* tlist;
-   while ((tlist = dynamic_cast<TEveTrackList*>(next())))
+  // Reset internal track-counters and track-list.
+
+  fAllTracks     = fGoodTracks    = 0;
+  fAllTracklets  = fGoodTracklets = 0;
+  {
+    TIter next(&fTrackLists);
+    TEveTrackList* tlist;
+    while ((tlist = dynamic_cast<TEveTrackList*>(next())))
       tlist->DecDenyDestroy();
-   fTrackLists.Clear("nodelete");
+    fTrackLists.Clear("nodelete");
+  }
+  {
+    TIter next(&fTrackletLists);
+    TEveTrackList* tlist;
+    while ((tlist = dynamic_cast<TEveTrackList*>(next())))
+      tlist->DecDenyDestroy();
+    fTrackletLists.Clear("nodelete");
+  }
 }
 
 //______________________________________________________________________________
 void AliEveTrackCounter::RegisterTracks(TEveTrackList* tlist, Bool_t goodTracks)
 {
-   // Register tracks from tlist and tlist itself.
-   // If goodTracks is true, they are considered as primary/good
-   // tracks.
-
-   tlist->IncDenyDestroy();
-   fTrackLists.Add(tlist);
+  // Register tracks from tlist and tlist itself.
+  // If goodTracks is true, they are considered as primary/good
+  // tracks.
+
+  tlist->IncDenyDestroy();
+  fTrackLists.Add(tlist);
+
+  List_i i = tlist->BeginChildren();
+  while (i != tlist->EndChildren())
+  {
+    AliEveTrack* t = dynamic_cast<AliEveTrack*>(*i);
+    if (t != 0)
+    {
+      if (goodTracks)
+      {
+        ++fGoodTracks;
+      } else {
+        t->SetLineStyle(fBadLineStyle);
+      }
+      ++fAllTracks;
+    }
+    ++i;
+  }
+}
 
-   List_i i = tlist->BeginChildren();
-   while (i != tlist->EndChildren())
-   {
-      AliEveTrack* t = dynamic_cast<AliEveTrack*>(*i);
-      if (t != 0)
+//______________________________________________________________________________
+void AliEveTrackCounter::RegisterTracklets(TEveTrackList* tlist, Bool_t goodTracks)
+{
+  // Register tracklets from tlist and tlist itself.
+  // If goodTracks is true, they are considered as primary/good
+  // tracks.
+
+  tlist->IncDenyDestroy();
+  fTrackletLists.Add(tlist);
+
+  List_i i = tlist->BeginChildren();
+  while (i != tlist->EndChildren())
+  {
+    AliEveTracklet* t = dynamic_cast<AliEveTracklet*>(*i);
+    if (t != 0)
+    {
+      if (goodTracks)
       {
-         if (goodTracks)
-         {
-            ++fGoodTracks;
-         } else {
-            t->SetLineStyle(fBadLineStyle);
-         }
-         ++fAllTracks;
+        ++fGoodTracklets;
+      } else {
+        t->SetLineStyle(fBadLineStyle);
       }
-      ++i;
-   }
+      ++fAllTracklets;
+    }
+    ++i;
+  }
 }
 
 //______________________________________________________________________________
 void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
 {
-   // Slot called when track is ctrl-clicked.
+   // Slot called when track is secondary selected.
    //
    // No check is done if track actually belongs to one of the
    // registered track-lists.
@@ -148,7 +191,7 @@ void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
          track->ElementChanged();
          gEve->Redraw3D();
 
-         printf("AliEveTrackCounter::CountTrack All=%d, Good=%d, Bad=%d\n",
+         printf("AliEveTrackCounter::DoTrackAction All=%d, Good=%d, Bad=%d\n",
                 fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
 
          if (gEve->GetEditor()->GetModel() == GetObject(eh))
@@ -160,40 +203,119 @@ void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
    } // end switch fClickAction
 }
 
-/******************************************************************************/
-
 //______________________________________________________________________________
-void AliEveTrackCounter::OutputEventTracks(FILE* out)
+void AliEveTrackCounter::DoTrackletAction(AliEveTracklet* track)
 {
-   // Print good-track summary into a plain-text file by iteration
-   // through all registered track-lists.
-   // State of each track is determined by its line-style, it is
-   // considered a good track if it's line style is solid.
+   // Slot called when tracklet is secondary selected.
+   //
+   // No check is done if track actually belongs to one of the
+   // registered track-lists.
+   //
+   // Probably it would be safer to copy good/bad tracks into special
+   // sub-containers.
+   // In this case one should also override RemoveElementLocal.
 
-   if (out == 0)
+   static const TEveException eh("AliEveTrackCounter::DoTrackletAction ");
+
+   switch (fClickAction)
    {
-      out = stdout;
-      fprintf(out, "AliEveTrackCounter::FinalizeEvent()\n");
-   }
 
-   fprintf(out, "Event = %d  Ntracks = %d\n", fEventId, fGoodTracks);
+      case kCA_PrintTrackInfo:
+      {
+         printf("AliEveTracklet '%s'\n", track->GetObject(eh)->GetName());
+         const TEveVector &v = track->GetVertex();
+         const TEveVector &p = track->GetMomentum();;
+         printf("  Vx=%f, Vy=%f, Vz=%f; Pt=%f, Pz=%f, phi=%f)\n",
+                v.fX, v.fY, v.fZ, p.Perp(), p.fZ, TMath::RadToDeg()*p.Phi());
+         printf("  <other information should be printed ... full AliESDtrack>\n");
+         break;
+      }
 
-   TIter tlists(&fTrackLists);
-   TEveTrackList* tlist;
-   Int_t cnt = 0;
-   while ((tlist = (TEveTrackList*) tlists()) != 0)
-   {
-      List_i i = tlist->BeginChildren();
-      while (i != tlist->EndChildren())
+      case kCA_ToggleTrack:
       {
-         AliEveTrack* t = dynamic_cast<AliEveTrack*>(*i);
-         if (t != 0 && t->GetLineStyle() == 1)
+         if (track->GetLineStyle() == 1)
          {
-            ++cnt;
-            fprintf(out, " %2d: chg=%+2d  pt=%8.5f  eta=%+8.5f\n",
-                    cnt, t->GetCharge(), t->GetMomentum().Perp(), t->GetMomentum().Eta());
+            track->SetLineStyle(fBadLineStyle);
+            --fGoodTracklets;
+         } else {
+            track->SetLineStyle(1);
+            ++fGoodTracklets;
          }
-         ++i;
+         track->ElementChanged();
+         gEve->Redraw3D();
+
+         printf("AliEveTrackCounter::DoTrackletAction All=%d, Good=%d, Bad=%d\n",
+                fAllTracklets, fGoodTracklets, fAllTracklets-fGoodTracklets);
+
+         if (gEve->GetEditor()->GetModel() == GetObject(eh))
+            gEve->EditElement(this);
+
+         break;
+      }
+
+   } // end switch fClickAction
+}
+
+/******************************************************************************/
+
+//______________________________________________________________________________
+void AliEveTrackCounter::OutputEventTracks(FILE* out)
+{
+  // Print good-track summary into a plain-text file by iteration
+  // through all registered track-lists.
+  // State of each track is determined by its line-style, it is
+  // considered a good track if it's line style is solid.
+
+  if (out == 0)
+  {
+    out = stdout;
+    fprintf(out, "AliEveTrackCounter::OutputEventTracks()\n");
+  }
+
+  fprintf(out, "Event=%d\n", fEventId);
+  fprintf(out, "GoodTracks=%d  AllTracks=%d\n", fGoodTracks, fAllTracks);
+
+  {
+    TIter tlists(&fTrackLists);
+    TEveTrackList* tlist;
+    Int_t cnt = 0;
+    while ((tlist = (TEveTrackList*) tlists()) != 0)
+    {
+      List_i i = tlist->BeginChildren();
+      while (i != tlist->EndChildren())
+      {
+        AliEveTrack* t = dynamic_cast<AliEveTrack*>(*i);
+        if (t != 0 && t->GetLineStyle() == 1)
+        {
+          ++cnt;
+          fprintf(out, " %2d: chg=%+2d  pt=%8.5f  eta=%+8.5f  phi=%+8.5f\n",
+                  cnt, t->GetCharge(), t->GetMomentum().Perp(),
+                  t->GetMomentum().Eta(), t->GetMomentum().Phi());
+        }
+        ++i;
+      }
+    }
+  }
+
+  fprintf(out, "GoodTracklets=%d  AllTracklets=%d\n", fGoodTracklets, fAllTracklets);
+  {
+    TIter tlists(&fTrackletLists);
+    TEveTrackList* tlist;
+    Int_t cnt = 0;
+    while ((tlist = (TEveTrackList*) tlists()) != 0)
+    {
+      List_i i = tlist->BeginChildren();
+      while (i != tlist->EndChildren())
+      {
+        AliEveTracklet* t = dynamic_cast<AliEveTracklet*>(*i);
+        if (t != 0 && t->GetLineStyle() == 1)
+        {
+          ++cnt;
+          fprintf(out, " %2d: theta=%+8.5f  eta=%+8.5f  phi=%+8.5f\n",
+                  cnt, t->GetMomentum().Theta(), t->GetMomentum().Eta(), t->GetMomentum().Phi());
+        }
+        ++i;
       }
-   }
+    }
+  }
 }
index a54c735..2ce459e 100644 (file)
@@ -14,6 +14,7 @@
 #include "TList.h"
 
 class AliEveTrack;
+class AliEveTracklet;
 class TEveTrackList;
 
 //______________________________________________________________________________
@@ -36,8 +37,10 @@ public:
   void Reset();
 
   void RegisterTracks(TEveTrackList* tlist, Bool_t goodTracks);
+  void RegisterTracklets(TEveTrackList* tlist, Bool_t goodTracks);
 
   void DoTrackAction(AliEveTrack* track);
+  void DoTrackletAction(AliEveTracklet* track);
 
   Int_t GetClickAction() const  { return fClickAction; }
   void  SetClickAction(Int_t a) { fClickAction = a; }
@@ -54,8 +57,11 @@ protected:
 
   Int_t fAllTracks;     // Counter of all tracks.
   Int_t fGoodTracks;    // Counter of good tracks.
+  Int_t fAllTracklets;  // Counter of all tracklets.
+  Int_t fGoodTracklets; // Counter of good tracklets.
 
-  TList fTrackLists;    // List of TrackLists registered for management.
+  TList fTrackLists;    // List of track-lists registered for management.
+  TList fTrackletLists; // List of tracklet-lists registered for management.
 
 private:
   AliEveTrackCounter(const AliEveTrackCounter&);            // Not implemented
index 9953c9e..8550bce 100644 (file)
@@ -40,9 +40,10 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
                                                UInt_t options, Pixel_t back) :
    TGedFrame(p, width, height, options | kVerticalFrame, back),
    fM(0),
-   fClickAction (0),
-   fInfoLabel   (0),
-   fEventId     (0)
+   fClickAction(0),
+   fInfoLabelTracks   (0),
+   fInfoLabelTracklets(0),
+   fEventId(0)
 {
    // Constructor.
 
@@ -67,13 +68,23 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
       AddFrame(f);
    }
 
-   { // Status
+   { // fInfoLabelTracks
       TGHorizontalFrame* f = new TGHorizontalFrame(this);
-      TGLabel* lab = new TGLabel(f, "Status:");
+      TGLabel* lab = new TGLabel(f, "Tracks:");
       f->AddFrame(lab, new TGLayoutHints(kLHintsLeft, 1, 5, 1, 2));
 
-      fInfoLabel = new TGLabel(f);
-      f->AddFrame(fInfoLabel, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
+      fInfoLabelTracks = new TGLabel(f);
+      f->AddFrame(fInfoLabelTracks, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
+
+      AddFrame(f);
+   }
+   { // fInfoLabelTracklets
+      TGHorizontalFrame* f = new TGHorizontalFrame(this);
+      TGLabel* lab = new TGLabel(f, "Tracklets:");
+      f->AddFrame(lab, new TGLayoutHints(kLHintsLeft, 1, 5, 1, 2));
+
+      fInfoLabelTracklets = new TGLabel(f);
+      f->AddFrame(fInfoLabelTracklets, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
 
       AddFrame(f);
    }
@@ -170,7 +181,8 @@ void AliEveTrackCounterEditor::SetModel(TObject* obj)
    fM = dynamic_cast<AliEveTrackCounter*>(obj);
 
    fClickAction->Select(fM->fClickAction, kFALSE);
-   fInfoLabel->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracks, fM->fGoodTracks));
+   fInfoLabelTracks   ->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracks,    fM->fGoodTracks));
+   fInfoLabelTracklets->SetText(Form("All: %3d; Primaries: %3d", fM->fAllTracklets, fM->fGoodTracklets));
    fEventId->SetNumber(fM->GetEventId());
 }
 
@@ -244,6 +256,7 @@ void AliEveTrackCounterEditor::DoShowHistos()
   TH1F* hchg = new TH1F("chg", "Primary charge",       3, -1.5,  1.5);
   TH1F* hpt  = new TH1F("pt",  "pT distribution",     40,  0.0,  8.0);
   TH1F* heta = new TH1F("eta", "eta distribution",    40, -1.0,  1.0);
+  TH1F* hphi = new TH1F("phi", "phi distribution",    40, -3.1416, 3.1416);
 
   Int_t nn; // fscanf return value
 
@@ -252,20 +265,26 @@ void AliEveTrackCounterEditor::DoShowHistos()
     TString file(Form("ev-report-%03d.txt", i));
     if (gSystem->AccessPathName(file) == kFALSE)
     {
-      Int_t   ev, ntr;
+      Int_t   ev, ngoodtr, nalltr;
       FILE* f = fopen(file, "read");
-      nn = fscanf(f, "Event = %d  Ntracks = %d", &ev, &ntr);
+
+      nn = fscanf(f, "Event=%d\n", &ev);
+      if (nn != 1) { printf("SAFR0 %d\n", nn); fclose(f); return;  }
+
+      nn = fscanf(f, "GoodTracks=%d  AllTracks=%d\n", &ngoodtr, &nalltr);
       if (nn != 2) { printf("SAFR1 %d\n", nn); fclose(f); return;  }
-      hcnt->Fill(ntr);
-      for (Int_t t=0; t<ntr; ++t)
+
+      hcnt->Fill(ngoodtr);
+      for (Int_t t = 0; t < ngoodtr; ++t)
       {
         Int_t   id, chg;
-        Float_t pt, eta;
-        nn = fscanf(f, "%d: chg=%d pt=%f eta=%f", &id, &chg, &pt, &eta);
-        if (nn != 4) { printf("SAFR2 %d\n", nn); fclose(f); return;  }
+        Float_t pt, eta, phi;
+        nn = fscanf(f, "%d: chg=%d pt=%f eta=%f phi=%f\n", &id, &chg, &pt, &eta, &phi);
+        if (nn != 5) { printf("SAFR2 %d\n", nn); fclose(f); return;  }
         hchg->Fill(chg);
         hpt ->Fill(pt);
         heta->Fill(eta);
+        hphi->Fill(phi);
       }
       fclose(f);
     }
@@ -278,12 +297,13 @@ void AliEveTrackCounterEditor::DoShowHistos()
     c = gPad->GetCanvas();
     c->Clear();
   }
-  c->Divide(2, 2);
+  c->Divide(2, 3);
 
   c->cd(1); hcnt->Draw();
   c->cd(2); hchg->Draw();
   c->cd(3); hpt ->Draw();
   c->cd(4); heta->Draw();
+  c->cd(5); hphi->Draw();
 
   c->Modified();
   c->Update();
index 3cdfeeb..654b00c 100644 (file)
@@ -48,7 +48,8 @@ protected:
 
    // Declare widgets
    TGComboBox       *fClickAction;
-   TGLabel          *fInfoLabel;
+   TGLabel          *fInfoLabelTracks;
+   TGLabel          *fInfoLabelTracklets;
    TGNumberEntry    *fEventId;
 
 private:
diff --git a/EVE/EveBase/AliEveTracklet.cxx b/EVE/EveBase/AliEveTracklet.cxx
new file mode 100644 (file)
index 0000000..6d1a415
--- /dev/null
@@ -0,0 +1,100 @@
+// $Id$
+// Author: Matevz Tadel 2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#include "AliEveTracklet.h"
+
+#include <AliVVertex.h>
+#include <TEveTrackPropagator.h>
+
+//______________________________________________________________________________
+// AliEveTracklet is a representation of SPD tracklet.
+// It inherits from AliEveTrack to allow for common functionality
+// regarding track counting.
+//
+// TEveTrack::fV - stores primary vertex.
+// TEveTrack::fP - stores vector in direction of the tracklet with
+//                 transverse component equal to 1.
+
+ClassImp(AliEveTracklet)
+
+Float_t AliEveTracklet::fgDefaultRadius = 10;
+
+//______________________________________________________________________________
+Float_t AliEveTracklet::GetDefaultRadius()
+{
+  // Static - return defualt extrapolation radius.
+
+  return fgDefaultRadius;
+}
+
+//______________________________________________________________________________
+void AliEveTracklet::SetDefaultRadius(Float_t r)
+{
+  // Static - set defualt extrapolation radius.
+
+  fgDefaultRadius = r;
+}
+
+//==============================================================================
+
+//______________________________________________________________________________
+AliEveTracklet::AliEveTracklet(const AliVVertex* pv, Float_t theta, Float_t phi,
+                               TEveTrackPropagator* prop) :
+  AliEveTrack()
+{
+  // Constructor.
+
+  using namespace TMath;
+
+  fV.Set(pv->GetX(), pv->GetY(), pv->GetZ());
+  fP.Set(Cos(phi), Sin(phi), 1.0/Tan(theta));
+
+  if (prop) SetPropagator(prop);
+}
+
+//==============================================================================
+
+//______________________________________________________________________________
+void AliEveTracklet::MakeTrack(Bool_t recurse)
+{
+  // Make track -- just make a line to radius specified in propagator
+  // or use the default if it is not set.
+
+  Float_t r = fPropagator ? fPropagator->GetMaxR() : fgDefaultRadius;
+  Reset(2);
+  SetPoint(0, fV.fX, fV.fY, fV.fZ);
+  SetPoint(1, fV.fX + r*fP.fX, fV.fY + r*fP.fY, fV.fZ + r*fP.fZ);
+
+  if (recurse)
+  {
+    for (List_i i=fChildren.begin(); i!=fChildren.end(); ++i)
+    {
+      TEveTrack* t = dynamic_cast<TEveTrack*>(*i);
+      if (t) t->MakeTrack(recurse);
+    }
+  }
+}
+
+//______________________________________________________________________________
+void AliEveTracklet::SecSelected(TEveTrack* track)
+{
+  // Emits "SecSelected(TEveTrack*)" signal.
+  // Called from TEveTrackGL on secondary-selection.
+
+  Emit("SecSelected(TEveTrack*)", (Long_t)track);
+  SecSelectedTracklet((AliEveTracklet*) track);
+}
+
+//______________________________________________________________________________
+void AliEveTracklet::SecSelectedTracklet(AliEveTracklet* track)
+{
+  // Emits "SecSelectedTracklet(AliEveTracklet*)" signal.
+
+  Emit("SecSelectedTracklet(AliEveTracklet*)", (Long_t)track);
+}
diff --git a/EVE/EveBase/AliEveTracklet.h b/EVE/EveBase/AliEveTracklet.h
new file mode 100644 (file)
index 0000000..bf6dc9a
--- /dev/null
@@ -0,0 +1,48 @@
+// $Id$
+// Author: Matevz Tadel 2009
+
+/**************************************************************************
+ * Copyright(c) 1998-2009, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#ifndef AliEveTracklet_H
+#define AliEveTracklet_H
+
+#include "AliEveTrack.h"
+
+class AliVVertex;
+
+//______________________________________________________________________________
+// AliEveTracklet is a representation of SPD tracklet.
+// It inherits from AliEveTrack to allow for common functionality
+// regarding track counting.
+
+class AliEveTracklet : public AliEveTrack
+{
+public:
+  AliEveTracklet(const AliVVertex* pv, Float_t theta, Float_t phi, TEveTrackPropagator* prop=0);
+  virtual ~AliEveTracklet() {}
+
+  virtual void MakeTrack(Bool_t recurse=kTRUE);
+
+  virtual void SecSelected(TEveTrack*);              // *SIGNAL*
+  virtual void SecSelectedTracklet(AliEveTracklet*); // *SIGNAL*
+
+  // ----------------------------------------------------------------
+
+  static Float_t GetDefaultRadius();
+  static void    SetDefaultRadius(Float_t r);
+
+protected:
+  static Float_t fgDefaultRadius;
+
+private:
+  AliEveTracklet(const AliEveTracklet&);            // Not implemented
+  AliEveTracklet& operator=(const AliEveTracklet&); // Not implemented
+
+  ClassDef(AliEveTracklet, 0); // Short description.
+};
+
+#endif
index d0f5c21..773c616 100644 (file)
@@ -32,6 +32,7 @@
 
 // AliEveTrack
 #pragma link C++ class AliEveTrack+;
+#pragma link C++ class AliEveTracklet+;
 
 // AliEveTrackcounter
 #pragma link C++ class AliEveTrackCounter+;
index 461e02b..9166f7d 100644 (file)
@@ -19,8 +19,7 @@
 // Or have trackelt counter -- as not all histograms collected for tracks
 // are relevant for tracklets.
 
-TEveElementList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3)
-//x TEveTrackList* esd_spd_tracklets(Float_t rad=8)
+TEveTrackList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3)
 {
   // radius - cylindrical radius to which the tracklets should be extrapolated
 
@@ -28,46 +27,30 @@ TEveElementList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3)
   AliESDVertex    *pv  = esd->GetPrimaryVertexSPD();
   AliMultiplicity *mul = esd->GetMultiplicity();
 
-  Double_t pvx[3], pve[3];
-  pv->GetXYZ(pvx);
-  pv->GetSigmaXYZ(pve);
-
-  TEveCompound *cont = new TEveCompound("SPD Tracklets");
-  cont->OpenCompound();
-  //x TEveTrackList *cont = new TEveTrackList("SPD Tracklets");
+  TEveTrackList *cont = new TEveTrackList("SPD Tracklets");
   cont->SetTitle(Form("N=%d", mul->GetNumberOfTracklets()));
   cont->SetMainColor(7);
-  //x cont->SetLineWidth(line_width);
+  cont->SetLineWidth(line_width);
 
+  TEveTrackPropagator* prop = cont->GetPropagator();
+  prop->SetMaxR(radius);
   gEve->AddElement(cont);
 
-  for (Int_t i=0; i<mul->GetNumberOfTracklets(); ++i)
+  for (Int_t i = 0; i < mul->GetNumberOfTracklets(); ++i)
   {
-    using namespace TMath;
     Float_t theta = mul->GetTheta(i);
     Float_t phi   = mul->GetPhi(i);
-    Float_t dr[3];
-    dr[0] = radius*Cos(phi);
-    dr[1] = radius*Sin(phi);
-    dr[2] = radius/Tan(theta);
-
-    TEveLine* track = new TEveLine;
-    track->SetMainColor(7);
-    track->SetLineWidth(line_width);
-    //x AliEveTrack* track = new AliEveTrack;
-    //x track->SetPropagator(cont->GetPropagator());
-    //x track->SetAttLineAttMarker(cont);
-    track->SetElementName(Form("Tracklet %d", i));
-    track->SetElementTitle(Form("id=%d: theta=%.3f, phi=%.3f", i, theta, phi));
 
-    track->SetPoint(0, pvx[0], pvx[1], pvx[2]);
-    track->SetPoint(1,pvx[0]+dr[0], pvx[1]+dr[1], pvx[2]+dr[2]);
+    AliEveTracklet* t = new AliEveTracklet(pv, theta, phi, prop);
+    t->SetAttLineAttMarker(cont);
+    t->SetElementName(Form("Tracklet %d", i));
+    t->SetElementTitle(Form("id=%d: theta=%.3f, phi=%.3f", i, theta, phi));
 
-    //x track->SetLockPoints(kTRUE);
-
-    cont->AddElement(track);
+    cont->AddElement(t);
   }
 
+  cont->MakeTracks();
+
   gEve->Redraw3D();
 
   return cont;
index 2171cb2..183b584 100644 (file)
@@ -120,7 +120,7 @@ void visscan_init(const TString& cdburi = "",
   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_MI",          "", kFALSE));
   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Track", "esd_tracks.C", "esd_tracks_by_category", "", kTRUE));
 
-  exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kFALSE));
+  exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC Tracklet", "esd_spd_tracklets.C", "esd_spd_tracklets", "", kTRUE));
 
   exec->AddMacro(new AliEveMacro(AliEveMacro::kESD, "REC ZDC",      "esd_zdc.C", "esd_zdc", "", kFALSE));
 
@@ -236,6 +236,16 @@ void on_new_event()
     Warning("on_new_event", "g_esd_tracks_by_category_container not initialized.");
   }
 
+  TEveTrackList *tracklets = dynamic_cast<TEveTrackList*>(gEve->GetCurrentEvent()->FindChild("SPD Tracklets"));
+  if (tracklets)
+  {
+    g_trkcnt->RegisterTracklets(tracklets, kTRUE);
+  }
+  else
+  {
+    Warning("on_new_event", "'SPD Tracklets' not found.");
+  }
+
   Double_t x[3] = { 0, 0, 0 };
 
   if (AliEveEventManager::HasESD())