From Alexandru
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Apr 2008 10:19:44 +0000 (10:19 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 8 Apr 2008 10:19:44 +0000 (10:19 +0000)
Remove init_trd.C that used to steer stand-alone trd visualization. To
be replaced with something relying on the future EventManager.

trd_clusters.C, trd_friend_tracks.C: new macros to provide the most
urgently needed functionality.

EVE/alice-macros/init_trd.C [deleted file]
EVE/alice-macros/trd_clusters.C [new file with mode: 0644]
EVE/alice-macros/trd_friend_tracks.C [new file with mode: 0644]

diff --git a/EVE/alice-macros/init_trd.C b/EVE/alice-macros/init_trd.C
deleted file mode 100644 (file)
index f48efcc..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// $Id$
-// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
-
-/**************************************************************************
- * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
- * full copyright notice.                                                 *
- **************************************************************************/
-void init_trd()
-{
-  TString macdir("$(REVESYS)/alice-macros");
-  gSystem->ExpandPathName(macdir);
-  gROOT->GetListOfBrowsables()->Add
-    (new TSystemDirectory(macdir.Data(), macdir.Data()));
-  TEveUtil::AssertMacro("region_marker.C");
-
-  AliEveTRDLoaderManager *trd=new AliEveTRDLoaderManager("TRD manager", "Loader manager for TRD data monitoring");
-  gEve->AddElement(trd);
-  gEve->AddToListTree(trd, kTRUE);
-}
diff --git a/EVE/alice-macros/trd_clusters.C b/EVE/alice-macros/trd_clusters.C
new file mode 100644 (file)
index 0000000..9ab1cc4
--- /dev/null
@@ -0,0 +1,75 @@
+// $Id: tpc_clusters.C 23497 2008-01-23 20:43:14Z mtadel $
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+#ifdef __CINT__
+class TEvePointSet;
+class TEveElement;
+#else
+#include <TEveManager.h>
+#include <TEvePointSet.h>
+#include <EveBase/AliEveEventManager.h>
+
+#include "AliRunLoader.h"
+#include "AliCluster.h"
+#include "AliTRDcluster.h"
+#endif
+
+TEvePointSet* trd_clusters(TEveElement *cont = 0){
+       const Int_t kMaxClusters = 18 * 6 * 24 *10;
+       AliEveEventManager::AssertGeometry();
+
+       TEvePointSet *clusters = new TEvePointSet(kMaxClusters);
+       clusters->SetOwnIds(kTRUE);
+
+       AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
+       rl->LoadRecPoints("TRD");
+
+       TObjArray *TRDcluster = 0x0;
+       TTree *recPoints = rl->GetTreeR("TRD", kFALSE);
+       recPoints->SetBranchAddress("TRDcluster", &TRDcluster);
+
+  Int_t nentr=(Int_t)recPoints->GetEntries();
+  for (Int_t i=0; i<nentr; i++) {
+    if (!recPoints->GetEvent(i)) continue;
+
+    Int_t ncl=TRDcluster->GetEntriesFast();
+
+    while (ncl--) {
+      AliTRDcluster *c = (AliTRDcluster*)TRDcluster->UncheckedAt(ncl);
+      Float_t g[3]; //global coordinates
+      c->GetGlobalXYZ(g);
+                       clusters->SetNextPoint(g[0], g[1], g[2]);
+                       AliCluster *atp = new AliCluster(*c);
+                       clusters->SetPointId(atp);
+    }
+    TRDcluster->Clear();
+  }
+
+  if(clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) {
+    Warning("trd_clusters", "No TRD clusters");
+    delete clusters;
+    return 0;
+  }
+
+  clusters->SetMarkerStyle(2);
+  clusters->SetMarkerSize(0.2);
+  clusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"TRD Clusters");
+  clusters->SetName(form);
+
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+  gEve->AddElement(clusters, cont);
+  gEve->Redraw3D();
+
+  return clusters;
+}
diff --git a/EVE/alice-macros/trd_friend_tracks.C b/EVE/alice-macros/trd_friend_tracks.C
new file mode 100644 (file)
index 0000000..78dffc1
--- /dev/null
@@ -0,0 +1,91 @@
+// $Id: esd_tracks.C 24485 2008-03-13 15:27:38Z mtadel $
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
+
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
+ * full copyright notice.                                                 *
+ **************************************************************************/
+
+TEvePointSet* trd_friend_tracks(TEveElement *cont = 0)
+{
+  if(!AliEveEventManager::AssertESDfriend())
+  {
+    printf("AliESDfriend not found\n");
+    return 0;
+  }
+  AliESDEvent* esd = AliEveEventManager::AssertESD();
+  AliESDfriend *eventESDfriend = AliEveEventManager::AssertESDfriend();
+  AliEveEventManager::AssertGeometry();
+  printf("eventESDfriend = %p\n", eventESDfriend);
+  //   esd->SetESDfriend(eventESDfriend);
+  //   if(!eventESDfriend) return 0;
+
+  Int_t nTracks = esd->GetNumberOfTracks();
+  printf("Number of tracks: %d\n", nTracks);
+  Int_t kMaxClusters = nTracks * 6 * 40 * 3;
+  printf("kMaxClusters = %d\n", kMaxClusters);
+  TEvePointSet *friendClusters = new TEvePointSet(kMaxClusters);
+
+  Int_t kTotalClusters = 0;
+  for (Int_t n=0; n< nTracks; n++)
+  {
+    printf("Taking track %d\n", n);
+    AliESDtrack* at = esd->GetTrack(n);
+    AliESDfriendTrack *friendTrack = eventESDfriend->GetTrack(n);
+
+    TObject *cal = 0x0;
+    Int_t ical = 0;
+    while (cal = friendTrack->GetCalibObject(ical++))
+    {
+      if (strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
+      printf("Got the track\n");
+      AliTRDtrackV1 *trdTrack = dynamic_cast<AliTRDtrackV1 *>(cal);
+      printf("trdTrack = %p\n", trdTrack);
+
+      for (Int_t iseed = 0; iseed < 6; iseed++)
+      {
+        printf("processing tracklet %d\n", iseed);
+        AliTRDseedV1 *tracklet = trdTrack->GetTracklet(iseed);
+        if (!tracklet->IsOK()) continue;
+        for (Int_t itb = 0; itb < 30; itb++)
+        {
+          if (!tracklet->IsUsable(itb)) continue;
+          AliTRDcluster *cl = tracklet->GetClusters(itb);
+          if (!cl) continue;
+          printf("cluster position: x = %f, y = %f, z = %f\n", cl->GetX(), cl->GetY(), cl->GetZ());
+          Float_t globalCoords[3]; //global coordinates
+          cl->GetGlobalXYZ(globalCoords);
+          friendClusters->SetPoint(kTotalClusters, globalCoords[0], globalCoords[1], globalCoords[2]);
+          AliCluster *atp = new AliCluster(*cl);
+          friendClusters->SetPointId(atp);
+          kTotalClusters++;
+        }
+      }
+    }
+  }
+
+  printf("kTotalClusters = %d\n", kTotalClusters);
+
+  if (friendClusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE)
+  {
+    Warning("trd_clusters", "No TRD clusters");
+    delete friendClusters;
+    return 0;
+  }
+
+  friendClusters->SetMarkerStyle(2);
+  friendClusters->SetMarkerSize(0.2);
+  friendClusters->SetMarkerColor(4);
+
+  char form[1000];
+  sprintf(form,"TRD Clusters");
+  friendClusters->SetName(form);
+
+  char tip[1000];
+  sprintf(tip,"N=%d", friendClusters->Size());
+  friendClusters->SetTitle(tip);
+  gEve->AddElement(friendClusters, cont);
+  gEve->Redraw3D();
+  return friendClusters;
+}