Almost final version of scanning tools.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 20:32:19 +0000 (20:32 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 20:32:19 +0000 (20:32 +0000)
* AliEveEventManager
  Emit new signal NewEventDataLoaded() after the event-data is
  connected but before the macros are executed.

* AliEveTrackCounter
  Connect to AliEveEventManager::NewEventDataLoaded() to do the reset.
  Introduce 'Bool_t fAcitve' -- now that track and tracklet label is
  misused to store scanning results it is better that track-counting
  is not enabled by default.

* AliEveTrackCounterEditor
  Add Activate / Deactivate buttons and handlers.
  Remove histogram plotting code -- now in show_scan_results.C

* visscan_init.C
  Remove code for registration of tracks/tracklets to
  track-counter. This is now done in esd_tracks / esd_spd_tracklets.

* make_scan_results.C
  Create the scan-result tree from individual objects stored during
  scanning.

* show_scan_results.C
  Create canvases and plot basic stuff from the scan-result tree.

* esd_spd_tracklets.C
  Put tracklets into two containers -- Good/Bad.
  Register the tracklets to track-counter if it is active.

* esd_tracks.C
  In esd_tracks_by_category() register the containers to track-counter
  if it is active.

EVE/EveBase/AliEveEventManager.cxx
EVE/EveBase/AliEveEventManager.h
EVE/EveBase/AliEveTrackCounter.cxx
EVE/EveBase/AliEveTrackCounter.h
EVE/EveBase/AliEveTrackCounterEditor.cxx
EVE/EveBase/AliEveTrackCounterEditor.h
EVE/alice-macros/esd_spd_tracklets.C
EVE/alice-macros/esd_tracks.C
EVE/macros/make_scan_results.C [new file with mode: 0644]
EVE/macros/show_scan_results.C
EVE/macros/visscan_init.C

index f27666d..d5e2e2a 100644 (file)
@@ -1294,6 +1294,8 @@ void AliEveEventManager::AfterNewEventLoaded()
 
   static const TEveException kEH("AliEveEventManager::AfterNewEventLoaded ");
 
+  NewEventDataLoaded();
+
   if (fExecutor)
     fExecutor->ExecMacros();
 
@@ -1323,6 +1325,13 @@ void AliEveEventManager::AfterNewEventLoaded()
   }
 }
 
+void AliEveEventManager::NewEventDataLoaded()
+{
+  // Emit NewEventDataLoaded signal.
+
+  Emit("NewEventDataLoaded()");
+}
+
 void AliEveEventManager::NewEventLoaded()
 {
   // Emit NewEventLoaded signal.
index 6b5e2f9..d7f9328 100644 (file)
@@ -116,6 +116,7 @@ public:
   Bool_t        IsUnderExternalControl() const { return fExternalCtrl; }
 
   virtual void  AfterNewEventLoaded();
+  void          NewEventDataLoaded();  // *SIGNAL*
   void          NewEventLoaded();      // *SIGNAL*
 
   AliEveMacroExecutor* GetExecutor() const { return fExecutor; }
index 94b59ed..d4a8e52 100644 (file)
@@ -42,6 +42,13 @@ ClassImp(AliEveTrackCounter)
 //______________________________________________________________________________
 AliEveTrackCounter* AliEveTrackCounter::fgInstance = 0;
 
+Bool_t AliEveTrackCounter::IsActive()
+{
+  // Check if instance exists and is active.
+
+  return fgInstance && fgInstance->fActive;
+}
+
 //______________________________________________________________________________
 AliEveTrackCounter::AliEveTrackCounter(const Text_t* name, const Text_t* title) :
   TEveElement(),
@@ -52,7 +59,8 @@ AliEveTrackCounter::AliEveTrackCounter(const Text_t* name, const Text_t* title)
   fEventId      (-1),
   fAllTracks    (0), fGoodTracks   (0),
   fAllTracklets (0), fGoodTracklets(0),
-  fTrackLists   (),  fTrackletLists()
+  fTrackLists   (),  fTrackletLists(),
+  fActive       (kFALSE)
 {
   // Constructor.
   // Connects to global signal "AliEveTrack", "SecSelected(AliEveTrack*)".
@@ -63,6 +71,8 @@ AliEveTrackCounter::AliEveTrackCounter(const Text_t* name, const Text_t* title)
                     "AliEveTrackCounter", this, "DoTrackAction(AliEveTrack*)");
   TQObject::Connect("AliEveTracklet", "SecSelectedTracklet(AliEveTracklet*)",
                     "AliEveTrackCounter", this, "DoTrackletAction(AliEveTracklet*)");
+
+  AliEveEventManager::GetMaster()->Connect("NewEventDataLoaded()", "AliEveTrackCounter", this, "Reset()");
 }
 
 //______________________________________________________________________________
@@ -71,6 +81,8 @@ AliEveTrackCounter::~AliEveTrackCounter()
   // Destructor.
   // Disconnect from the global track signals.
 
+  AliEveEventManager::GetMaster()->Disconnect("NewEventDataLoaded()", this);
+
   TQObject::Disconnect("AliEveTrack", "DoTrackAction(AliEveTrack*)");
   TQObject::Disconnect("AliEveTracklet", "DoTrackletAction(AliEveTracklet*)");
   if (fgInstance == this) fgInstance = 0;
@@ -99,6 +111,8 @@ void AliEveTrackCounter::Reset()
       tlist->DecDenyDestroy();
     fTrackletLists.Clear("nodelete");
   }
+
+  fEventId = AliEveEventManager::GetMaster()->GetEventId();
 }
 
 //______________________________________________________________________________
@@ -150,10 +164,12 @@ void AliEveTrackCounter::RegisterTracklets(TEveTrackList* tlist, Bool_t goodTrac
     AliEveTracklet* t = dynamic_cast<AliEveTracklet*>(*i);
     if (t != 0)
     {
-      if (goodTracks && mul->GetLabel(t->GetIndex(), 0) == 3)
+      if (goodTracks)
       {
+       mul->SetLabel(t->GetIndex(), 0, 3);
         ++fGoodTracklets;
       } else {
+       mul->SetLabel(t->GetIndex(), 0, 0);
         t->SetLineStyle(fBadLineStyle);
       }
       ++fAllTracklets;
@@ -176,6 +192,9 @@ void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
 
    static const TEveException eh("AliEveTrackCounter::DoTrackAction ");
 
+   if (!fActive)
+     return;
+
    switch (fClickAction)
    {
 
@@ -186,7 +205,6 @@ void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
          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;
       }
 
@@ -206,8 +224,8 @@ void AliEveTrackCounter::DoTrackAction(AliEveTrack* track)
          track->ElementChanged();
          gEve->Redraw3D();
 
-         printf("AliEveTrackCounter::DoTrackAction All=%d, Good=%d, Bad=%d\n",
-                fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
+         //printf("AliEveTrackCounter::DoTrackAction All=%d, Good=%d, Bad=%d\n",
+         //       fAllTracks, fGoodTracks, fAllTracks-fGoodTracks);
 
          if (gEve->GetEditor()->GetModel() == GetObject(eh))
             gEve->EditElement(this);
@@ -232,6 +250,9 @@ void AliEveTrackCounter::DoTrackletAction(AliEveTracklet* track)
 
    static const TEveException eh("AliEveTrackCounter::DoTrackletAction ");
 
+   if (!fActive)
+     return;
+
    switch (fClickAction)
    {
 
@@ -242,7 +263,6 @@ void AliEveTrackCounter::DoTrackletAction(AliEveTracklet* track)
          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;
       }
 
@@ -264,8 +284,8 @@ void AliEveTrackCounter::DoTrackletAction(AliEveTracklet* track)
          track->ElementChanged();
          gEve->Redraw3D();
 
-         printf("AliEveTrackCounter::DoTrackletAction All=%d, Good=%d, Bad=%d\n",
-                fAllTracklets, fGoodTracklets, fAllTracklets-fGoodTracklets);
+         // printf("AliEveTrackCounter::DoTrackletAction All=%d, Good=%d, Bad=%d\n",
+         //        fAllTracklets, fGoodTracklets, fAllTracklets-fGoodTracklets);
 
          if (gEve->GetEditor()->GetModel() == GetObject(eh))
             gEve->EditElement(this);
index bc8bf9a..0574343 100644 (file)
@@ -48,8 +48,13 @@ public:
   void OutputEventTracks();
   void PrintEventTracks();
 
+  Bool_t GetActive() const { return fActive; }
+  void   SetActive(Bool_t a) { fActive = a; }
+
   static AliEveTrackCounter* fgInstance;
 
+  static Bool_t IsActive();
+
 protected:
   Int_t fBadLineStyle;  // TEveLine-style used for secondary/bad tracks.
   Int_t fClickAction;   // Action to take when a track is ctrl-clicked.
@@ -64,6 +69,8 @@ protected:
   TList fTrackLists;    // List of track-lists registered for management.
   TList fTrackletLists; // List of tracklet-lists registered for management.
 
+  Bool_t fActive;
+
 private:
   AliEveTrackCounter(const AliEveTrackCounter&);            // Not implemented
   AliEveTrackCounter& operator=(const AliEveTrackCounter&); // Not implemented
index cf6d21d..7cc8365 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(AliEveTrackCounterEditor)
 AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t width, Int_t height,
                                                UInt_t options, Pixel_t back) :
    TGedFrame(p, width, height, options | kVerticalFrame, back),
-   fM(0),
+   fM(0), fAF(0), fDF(0),
    fClickAction(0),
    fInfoLabelTracks   (0),
    fInfoLabelTracklets(0),
@@ -53,8 +53,22 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
 
    Int_t labelW = 42;
 
+
+   // Active frame
+
+   fAF = new TGVerticalFrame(this);
+
+   { // Deactivate button
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
+
+      TGTextButton* b = new TGTextButton(f, "Deactivate");
+      f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 4));
+      b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoDeactivate()");
+
+      fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+   }
    { // ClickAction
-      TGHorizontalFrame* f = new TGHorizontalFrame(this);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
       TGLabel* lab = new TGLabel(f, "Click:");
       f->AddFrame(lab, new TGLayoutHints(kLHintsLeft|kLHintsBottom, 1, 10, 1, 2));
       fClickAction = new TGComboBox(f);
@@ -67,32 +81,30 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
                             "DoClickAction(Int_t)");
       f->AddFrame(fClickAction, new TGLayoutHints(kLHintsLeft, 1, 2, 1, 1));
 
-      AddFrame(f);
+      fAF->AddFrame(f);
    }
-
    { // fInfoLabelTracks
-      TGHorizontalFrame* f = new TGHorizontalFrame(this);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
       TGLabel* lab = new TGLabel(f, "Tracks:");
       f->AddFrame(lab, new TGLayoutHints(kLHintsLeft, 1, 5, 1, 2));
 
       fInfoLabelTracks = new TGLabel(f);
       f->AddFrame(fInfoLabelTracks, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 9, 1, 2));
 
-      AddFrame(f);
+      fAF->AddFrame(f);
    }
    { // fInfoLabelTracklets
-      TGHorizontalFrame* f = new TGHorizontalFrame(this);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF);
       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);
+      fAF->AddFrame(f);
    }
-
    {
-      TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
 
       TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
       TGLabel* l = new TGLabel(g, "Event:");
@@ -114,11 +126,10 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
       f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
       b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoNext()");
 
-      AddFrame(f);
+      fAF->AddFrame(f);
    }
-
    {
-      TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
 
       TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
       TGLabel* l = new TGLabel(g, "Report:");
@@ -135,10 +146,10 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
       f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
       b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoFileReport()");
 
-      AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 0));
+      fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 4, 0));
    }
    {
-      TGHorizontalFrame* f = new TGHorizontalFrame(this, 210, 20, kFixedWidth);
+      TGHorizontalFrame* f = new TGHorizontalFrame(fAF, 210, 20, kFixedWidth);
 
       TGHorizontalFrame* g = new TGHorizontalFrame(f, labelW, 0, kFixedWidth);
       TGLabel* l = new TGLabel(g, "Histos:");
@@ -151,11 +162,29 @@ AliEveTrackCounterEditor::AliEveTrackCounterEditor(const TGWindow *p, Int_t widt
       f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
       b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoShowHistos()");
 
-      AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+      fAF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
    }
 
-  AliEveEventManager::GetMaster()->Connect("NewEventLoaded()",
-                        "AliEveTrackCounterEditor", this, "UpdateModel()");
+   AddFrame(fAF, new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY));
+
+
+   // Disabled frame
+
+   fDF = new TGVerticalFrame(this);
+
+   { // Activate button
+      TGHorizontalFrame* f = new TGHorizontalFrame(fDF, 210, 20, kFixedWidth);
+
+      TGTextButton* b = new TGTextButton(f, "Activate");
+      f->AddFrame(b, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
+      b->Connect("Clicked()", "AliEveTrackCounterEditor", this, "DoActivate()");
+
+      fDF->AddFrame(f, new TGLayoutHints(kLHintsLeft, 0, 0, 0, 0));
+   }
+
+   AddFrame(fDF, new TGLayoutHints(kLHintsNormal|kLHintsExpandX|kLHintsExpandY));
+
+   AliEveEventManager::GetMaster()->Connect("NewEventLoaded()", "AliEveTrackCounterEditor", this, "UpdateModel()");
 }
 
 AliEveTrackCounterEditor::~AliEveTrackCounterEditor()
@@ -182,10 +211,40 @@ void AliEveTrackCounterEditor::SetModel(TObject* obj)
 
    fM = dynamic_cast<AliEveTrackCounter*>(obj);
 
-   fClickAction->Select(fM->fClickAction, kFALSE);
-   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());
+   if (fM->GetActive())
+   {
+      ShowFrame(fAF); HideFrame(fDF);
+      fClickAction->Select(fM->fClickAction, kFALSE);
+      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());
+   }
+   else
+   {
+     ShowFrame(fDF); HideFrame(fAF);
+   }
+
+   Layout();
+}
+
+/******************************************************************************/
+
+void AliEveTrackCounterEditor::DoActivate()
+{
+   // Activate track-counter
+
+   fM->SetActive(kTRUE);
+   AliEveEventManager::GetMaster()->GotoEvent(AliEveEventManager::GetMaster()->GetEventId());
+   fGedEditor->Layout();
+}
+
+void AliEveTrackCounterEditor::DoDeactivate()
+{
+   // Deactivate track-counter.
+
+   fM->SetActive(kFALSE);
+   AliEveEventManager::GetMaster()->GotoEvent(AliEveEventManager::GetMaster()->GetEventId());
 }
 
 /******************************************************************************/
@@ -210,6 +269,7 @@ void AliEveTrackCounterEditor::DoNext()
 void AliEveTrackCounterEditor::DoSetEvent()
 {
    // Slot for SetEvent.
+
    AliEveEventManager::GetMaster()->GotoEvent((Int_t) fEventId->GetNumber());
 }
 
@@ -236,51 +296,8 @@ void AliEveTrackCounterEditor::DoShowHistos()
 {
   // Slot for ShowHistos.
 
-  static const TEveException kEH("AliEveTrackCounterEditor::DoShowHistos ");
-
+  TEveUtil::Macro("make_scan_results.C");
   TEveUtil::Macro("show_scan_results.C");
-
-  TTree* t = (TTree*) gDirectory->Get("SR");
-
-  if (t == 0)
-    throw kEH + "Tree 'SR' with scan results not found.";
-
-  TCanvas *c = 0;
-
-  //----------------------------------------------------------------------------
-  // Tracks
-  //----------------------------------------------------------------------------
-
-  c = new TCanvas("Tracks", "Track Scanning Results", 800, 600);
-  c->Divide(2, 3);
-
-  c->cd(1);
-  t->Draw("Sum$(T.fLabel & 1)");
-
-  c->cd(2);
-  t->Draw("T.GetSign()", "T.fLabel & 1");
-
-  c->cd(3);
-  t->Draw("T.GetSign()", "T.fLabel & 1");
-
-  c->cd(4);
-  t->Draw("T.Eta()", "T.fLabel & 1");
-
-  c->cd(5);
-  t->Draw("T.Phi()", "T.fLabel & 1");
-
-  c->Modified();
-  c->Update();
-
-  //----------------------------------------------------------------------------
-  // Trackelts
-  //----------------------------------------------------------------------------
-
-  c = new TCanvas("Tracklets", "Tracklet Scanning Results", 800, 600);
-  (new TLatex(0.2, 0.4, "Not yet available"))->Draw();
-
-  c->Modified();
-  c->Update();
 }
 
 /******************************************************************************/
index 654b00c..feaf7b4 100644 (file)
@@ -33,6 +33,9 @@ public:
 
    virtual void SetModel(TObject* obj);
 
+   void DoActivate();
+   void DoDeactivate();
+
    void DoPrev();
    void DoNext();
    void DoSetEvent();
@@ -46,7 +49,9 @@ public:
 protected:
    AliEveTrackCounter *fM; // Model object.
 
-   // Declare widgets
+   TGCompositeFrame *fAF;  // Active frame.
+   TGCompositeFrame *fDF;  // Non-active frame.
+
    TGComboBox       *fClickAction;
    TGLabel          *fInfoLabelTracks;
    TGLabel          *fInfoLabelTracklets;
index dd203b3..7d0f6a8 100644 (file)
@@ -7,21 +7,9 @@
  * full copyright notice.                                                 *
  **************************************************************************/
 
-// Lines commented with //x should be reactivated when we
-// move to a newer ROOT (after 5.25.2).
-// Corresponding lines that are now replacing them should be removed.
-//
-// The problem was the TEveTrackProjected did not support projection
-// of tracks with locked points -- and we do that for tracklets.
-//
-// Maybe it would be even better to have AliEveTracklet : public TEveLine
-// and support both in AliEveTrackCounter.
-// Or have trackelt counter -- as not all histograms collected for tracks
-// are relevant for tracklets.
-
-TEveTrackList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3,
-                                Float_t dPhiWindow=0.080, Float_t dThetaWindow=0.025, 
-                                 Float_t dPhiShift05T=0.0045)
+TEveElementList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3,
+                                  Float_t dPhiWindow=0.080, Float_t dThetaWindow=0.025, 
+                                  Float_t dPhiShift05T=0.0045)
 {
   // radius - cylindrical radius to which the tracklets should be extrapolated
 
@@ -31,15 +19,25 @@ TEveTrackList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3,
 
   AliMagF *field = AliEveEventManager::AssertMagField();
 
-  TEveTrackList *cont = new TEveTrackList("SPD Tracklets");
-  cont->SetTitle(Form("N=%d", mul->GetNumberOfTracklets()));
-  cont->SetMainColor(7);
-  cont->SetLineWidth(line_width);
-
-  TEveTrackPropagator* prop = cont->GetPropagator();
-  prop->SetMaxR(radius);
+  TEveElementList* cont = new TEveElementList("SPD Tracklets");
   gEve->AddElement(cont);
 
+  TEveTrackList *tg = new TEveTrackList("Good");
+  tg->SetMainColor(7);
+  tg->SetLineWidth(line_width);
+  cont->AddElement(tg);
+
+  TEveTrackPropagator* pg = tg->GetPropagator();
+  pg->SetMaxR(radius);
+
+  TEveTrackList *tb = new TEveTrackList("Bad");
+  tb->SetMainColor(7);
+  tb->SetLineWidth(line_width);
+  cont->AddElement(tb);
+
+  TEveTrackPropagator* pb = tb->GetPropagator();
+  pb->SetMaxR(radius);
+
   const Float_t  Bz = TMath::Abs(field->SolenoidField());
 
   const Double_t dPhiShift     = dPhiShift05T / 5.0 * Bz;
@@ -51,26 +49,35 @@ TEveTrackList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=3,
     Float_t theta  = mul->GetTheta(i);
     Float_t phi    = mul->GetPhi(i);
     Float_t dTheta = mul->GetDeltaTheta(i);
-    Float_t dPhi   = mul->GetDeltaPhi(i);
+    Float_t dPhi   = mul->GetDeltaPhi(i) - dPhiShift;
+    Float_t d      = dPhi*dPhi/dPhiWindow2 + dTheta*dTheta/dThetaWindow2;
+
+    TEveTrackList* tl = (d < 1.0f) ? tg : tb;
 
-    AliEveTracklet* t = new AliEveTracklet(i, pv, theta, phi, prop);
-    t->SetAttLineAttMarker(cont);
+    AliEveTracklet *t = new AliEveTracklet(i, pv, theta, phi, tl->GetPropagator());
+    t->SetAttLineAttMarker(tl);
     t->SetElementName(Form("Tracklet %d", i));
     t->SetElementTitle(Form("Id = %d\nEta=%.3f, Theta=%.3f, dTheta=%.3f\nPhi=%.3f dPhi=%.3f",
                            i, mul->GetEta(i), theta, dTheta, phi, dPhi));
 
-    dPhi -= dPhiShift;
+    tl->AddElement(t);
+  }
 
-    Float_t d = dPhi*dPhi/dPhiWindow2 + dTheta*dTheta/dThetaWindow2;
-    if (d < 1.0f)
-      mul->SetLabel(i, 0, 3);
-    else
-      mul->SetLabel(i, 0, 0);
+  tg->MakeTracks();
+  tg->SetTitle(Form("N=%d", tg->NumChildren()));
 
-    cont->AddElement(t);
-  }
+  tb->MakeTracks();
+  tb->SetTitle(Form("N=%d", tb->NumChildren()));
 
-  cont->MakeTracks();
+  if (AliEveTrackCounter::IsActive())
+  {
+    AliEveTrackCounter::fgInstance->RegisterTracklets(tg, kTRUE);
+    AliEveTrackCounter::fgInstance->RegisterTracklets(tb, kFALSE);
+  }
+  else
+  {
+    tb->SetLineStyle(6);
+  }
 
   gEve->Redraw3D();
 
index 647c0ac..c3b01b6 100644 (file)
@@ -435,6 +435,17 @@ TEveElementList* esd_tracks_by_category()
     tlist->SetTitle(Form("N tracks=%d", tc[ti]));
 
     tlist->MakeTracks();
+
+    Bool_t good_cont = ti <= 1;
+    if (AliEveTrackCounter::IsActive())
+    {
+      AliEveTrackCounter::fgInstance->RegisterTracks(tlist, good_cont);
+    }
+    else
+    {
+      if ( ! good_cont)
+        tlist->SetLineStyle(6);
+    }
   }
   cont->SetTitle(Form("N all tracks = %d", count));
   // ??? The following does not always work:
diff --git a/EVE/macros/make_scan_results.C b/EVE/macros/make_scan_results.C
new file mode 100644 (file)
index 0000000..a5b4ba1
--- /dev/null
@@ -0,0 +1,51 @@
+// Label is used to store scanning result for tracks and trackelts.
+//
+// BIT(1) stores the original selection.
+// BIT(0) stores the user selection (set to same value as b1 at init).
+//
+// This allows to check all possible combinations.
+
+
+void make_scan_results()
+{
+  TFile *f = TFile::Open("scan_results.root", "UPDATE");
+
+  f->Delete("SR;*");
+
+  T = new TTree("SR", "Scanning results");
+
+  TClonesArray* clones = new TClonesArray("AliESDtrack", 32);
+  TBranch * tb = T->Branch("T", &clones);
+
+  AliMultiplicity *mult = 0;
+  TBranch *mb = T->Branch("M", &mult);
+
+
+  for (Int_t i=0; i<=9999; ++i)
+  {
+    TString name;
+
+    name.Form("Tracks_%04d", i);
+    TClonesArray* ts = (TClonesArray*) f->Get(name);
+
+    name.Form("Tracklets_%04d", i);
+    AliMultiplicity* ms =  (AliMultiplicity*) f->Get(name);
+
+    if (ts && ms)
+    {
+      tb->SetAddress(&ts);
+      mb->SetAddress(&ms);
+      T->Fill();
+    }
+    else if ((ts && !ms) || (!ts && ms))
+    {
+      Error("make_scan_results", "Only one of tracks/tracklets exists for index %d.", i);
+    }
+
+  }
+
+  T->Write();
+
+  f->Close();
+  delete f;
+}
index 0263875..3d958ef 100644 (file)
@@ -1,4 +1,4 @@
-// Label is used to store scanning result for tracks and trackelts.
+// Display some histograms from scanning.
 //
 // BIT(1) stores the original selection.
 // BIT(0) stores the user selection (set to same value as b1 at init).
@@ -8,47 +8,75 @@
 
 void show_scan_results()
 {
-  TFile *f = TFile::Open("scan_results.root", "UPDATE");
+  TFile *f = TFile::Open("scan_results.root");
 
-  f->Delete("SR;*");
+  TTree* t = (TTree*) gDirectory->Get("SR");
 
-  T = new TTree("SR", "Scanning results");
+  if (t == 0)
+    Error("show_scan_results", "Tree 'SR' with scan results not found.");
 
-  TClonesArray* clones = new TClonesArray("AliESDtrack", 32);
-  TBranch * tb = T->Branch("T", &clones);
+  TCanvas *c = 0;
 
-  AliMultiplicity *mult = 0;
-  TBranch *mb = T->Branch("M", &mult);
 
+  //----------------------------------------------------------------------------
+  // Tracks
+  //----------------------------------------------------------------------------
 
-  for (Int_t i=0; i<=9999; ++i)
-  {
-    TString name;
+  c = new TCanvas("Tracks", "Track Scanning Results", 800, 600);
+  c->Divide(2, 3);
 
-    name.Form("Tracks_%04d", i);
-    TClonesArray* ts = (TClonesArray*) f->Get(name);
+  c->cd(1);
+  t->Draw("Sum$(T.fLabel & 1)");
 
-    name.Form("Tracklets_%04d", i);
-    AliMultiplicity* ms =  (AliMultiplicity*) f->Get(name);
+  c->cd(2);
+  t->Draw("T.GetSign()", "T.fLabel & 1");
 
-    if (ts && ms)
-    {
-      tb->SetAddress(&ts);
-      mb->SetAddress(&ms);
-      T->Fill();
-    }
-    else if ((ts && !ms) || (!ts && ms))
-    {
-      Error("show_scan_results", "Only one of tracks/tracklets exists for index %d.", i);
-    }
+  c->cd(3);
+  t->Draw("T.Pt()", "T.fLabel & 1");
 
-  }
+  c->cd(4);
+  t->Draw("T.Eta()", "T.fLabel & 1");
 
-  T->Write();
+  c->cd(5);
+  t->Draw("T.Phi()", "T.fLabel & 1");
+
+  c->Modified();
+  c->Update();
+
+
+  //----------------------------------------------------------------------------
+  // Trackelts
+  //----------------------------------------------------------------------------
+
+  c = new TCanvas("Tracklets", "Tracklet Scanning Results", 800, 600);
+  c->Divide(2, 3);
+
+  c->cd(1);
+  t->Draw("Sum$(M.fLabels & 1)");
+
+  c->cd(2);
+  t->Draw("M.fNsingle");
+
+  c->cd(3);
+  t->Draw("M.fFiredChips[1]:Sum$(M.fLabels & 1)");
+
+  c->cd(4);
+  t->Draw("M.fDeltTh", "M.fLabels & 1");
+
+  c->cd(5);
+  t->Draw("M.fDeltPhi", "M.fLabels & 1");
+
+  c->cd(6);
+  t->Draw("M.fPhi", "M.fLabels & 1");
+
+  c->Modified();
+  c->Update();
+
+
+  //----------------------------------------------------------------------------
+  // End
+  //----------------------------------------------------------------------------
 
   f->Close();
   delete f;
-
-  // Reopen in read mode.
-  TFile::Open("scan_results.root");
 }
index 7291a78..ec7655b 100644 (file)
@@ -211,48 +211,6 @@ void visscan_init(const TString& cdburi = "",
 
 void on_new_event()
 {
-  AliEveTrackCounter* g_trkcnt = AliEveTrackCounter::fgInstance;
-  g_trkcnt->Reset();
-  g_trkcnt->SetEventId(AliEveEventManager::GetMaster()->GetEventId());
-
-  if (g_esd_tracks_by_category_container != 0)
-  {
-    TEveElementList* cont = g_esd_tracks_by_category_container;
-
-    // Here we expect several TEveTrackList containers.
-    // First two have reasonable primaries (sigma-to-prim-vertex < 5).
-    // Others are almost certainly secondaries.
-    Int_t count = 1;
-    TEveElement::List_i i = cont->BeginChildren();
-    while (i != cont->EndChildren())
-    {
-      TEveTrackList* l = dynamic_cast<TEveTrackList*>(*i);
-      if (l != 0)
-      {
-       g_trkcnt->RegisterTracks(l, (count <= 2));
-       ++count;
-      }
-      ++i;
-    }
-
-    // Set it to zero, so that we do not reuse an old one.
-    g_esd_tracks_by_category_container = 0;
-  }
-  else
-  {
-    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())