new macro to display online tracklets (Jochen)
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Jun 2009 09:38:46 +0000 (09:38 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 25 Jun 2009 09:38:46 +0000 (09:38 +0000)
EVE/alice-macros/trd_mcmtracklets.C [deleted file]
EVE/alice-macros/trd_tracklets.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/trd_mcmtracklets.C b/EVE/alice-macros/trd_mcmtracklets.C
deleted file mode 100644 (file)
index 1c349d0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "TParticlePDG.h"
-#include "TEveLine.h"
-
-TEveElementList *trd_mcmtracklets()
-{
-  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
-  rl->LoadKinematics();
-  AliLoader *loader = rl->GetLoader("TRDLoader");
-  AliDataLoader *dl = loader->GetDataLoader("tracklets");
-  dl->Load();
-  TTree *trklTree = dl->Tree();
-  TBranch *mcmBranch = trklTree->GetBranch("mcmtrklbranch");
-  AliTRDtrackletMCM *trkl = new AliTRDtrackletMCM;
-  mcmBranch->SetAddress(&trkl);
-
-  gEve->DisableRedraw();
-  TEveElementList* listOfTracklets = new TEveElementList("MCM tracklets");
-  gEve->AddElement(listOfTracklets);
-
-  AliTRDgeometry *geo = new AliTRDgeometry;
-  for (Int_t i = 0; i < mcmBranch->GetEntries(); i++) {
-    mcmBranch->GetEntry(i);
-    if (!trkl)
-       continue;
-    AliEveTRDTracklet *evetrkl = new AliEveTRDTracklet(trkl);
-    gEve->AddElement(evetrkl, listOfTracklets);
-
-  }
-
-  gEve->EnableRedraw();
-  gEve->Redraw3D();
-
-  return listOfTracklets;
-}
-
diff --git a/EVE/alice-macros/trd_tracklets.C b/EVE/alice-macros/trd_tracklets.C
new file mode 100644 (file)
index 0000000..ddf82fb
--- /dev/null
@@ -0,0 +1,57 @@
+#include "TEveLine.h"
+
+TEveElementList *trd_tracklets()
+{
+  AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
+  AliLoader *loader = rl ? rl->GetLoader("TRDLoader") : 0x0;
+  AliDataLoader *dl = loader ? loader->GetDataLoader("tracklets") : 0x0;
+  if (!dl)
+    return;
+
+  dl->Load();
+  TTree *trklTree = dl->Tree();
+
+  TBranch *trklBranch = 0x0;
+
+  gEve->DisableRedraw();
+
+  if (trklBranch = trklTree->GetBranch("trkbranch")) {
+    TEveElementList* listOfTracklets = new TEveElementList("Online tracklets");
+    gEve->AddElement(listOfTracklets);
+
+    UInt_t *leaves = new UInt_t[258];
+    trklBranch->SetAddress(leaves);
+
+    for (Int_t iEntry = 0; iEntry < trklBranch->GetEntries(); iEntry++) {
+      trklBranch->GetEntry(iEntry);
+      for (Int_t iTracklet = 0; iTracklet < 256; iTracklet++) {
+        if (leaves[2 + iTracklet] == 0)
+          break;
+        AliEveTRDTrackletOnline *evetrkl = new AliEveTRDTrackletOnline(new AliTRDtrackletWord(leaves[2 + iTracklet], leaves[0] + leaves[1]));
+        gEve->AddElement(evetrkl, listOfTracklets);
+      }
+    }
+    delete [] leaves;
+  }
+
+  if (trklBranch = trklTree->GetBranch("mcmtrklbranch")) {
+    AliTRDtrackletMCM *trkl = 0x0; //new AliTRDtrackletMCM;
+    trklBranch->SetAddress(&trkl);
+
+    TEveElementList* listOfTracklets = new TEveElementList("MCM tracklets");
+    gEve->AddElement(listOfTracklets);
+
+    for (Int_t i = 0; i < trklBranch->GetEntries(); i++) {
+      trklBranch->GetEntry(i);
+      if (!trkl)
+       continue;
+      gEve->AddElement(new AliEveTRDTrackletOnline(trkl), listOfTracklets);
+    }
+  }
+
+  gEve->EnableRedraw();
+  gEve->Redraw3D();
+
+  return 0x0;
+}
+