]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/alice-macros/ana_list.C
Restored compilation and functionallity (Ruben)
[u/mrichter/AliRoot.git] / EVE / alice-macros / ana_list.C
index d2b5f60753fef9edcdd713cdfbf6aa37052b794a..919db811681838a8abf2541eea7b66fa27dbbd5c 100755 (executable)
@@ -1,3 +1,52 @@
+// How to fill the list analyser with objects via a macro: Please see example below!
+// How to use the list analyser (and especially this macro):
+
+// -- Primary selection (to add e.g. tracklets, tracks, etc.):
+// - Load the objects you want to analyse with a sufficient macro (e.g. for tracks and tracklets you can use ana_list_load_tracks.C)
+// - Run this macro (ana_list.C)
+// - In the tab "eve" in the browser select the list analyser (called "Analysis objects" in the standard case)
+// - Select the "list" tab in the editor of this object.
+// - Click the button "start"
+// - Select the objects you want to add by left-clicking on them in the viewer (or as well in the browser (left panel))
+// - When you have finished adding the desired objects, click the button "stop"
+// Use the list analyser "as usual" (see class documentation)
+
+// -- Secondary selection (to add e.g. single clusters (of a TEvePointSet) or digits (of a TEveQuadSet)):
+// To add e.g. AliTrackPoints or tracks you can do the following:
+// - Run e.g. the macro "esd_tracks.C" 
+// - Select some track you want to analyse as follows: Hold "shift" und right-click on the track (sometimes you have to hold the right mouse button). The menu pops up
+// -> Select "ImportClustersFromIndex"
+// -> Do this for all tracks you want to analyse.
+// - Run this macro (ana_list.C)
+// - In the tab "eve" in the browser select the list analyser (called "Analysis objects" in the standard case)
+// - Select the "list" tab in the editor of this object.
+// - Click the button "start"
+// - Select e.g. clusters by holding "ctrl"+"alt" (depending on your system, holding the "alt" only can also be fine) and left-clicking on the desired cluster
+// - When you have finished adding the desired objects, click the button "stop"
+// Use the list analyser "as usual" (see class documentation)
+
+
+
+void ana_list(TEveElement *cont = 0)
+{
+  AliEveListAnalyser * objList = new AliEveListAnalyser("Analysis objects");
+  
+  objList->SetTitle("Analysis objects (0)");
+
+  gEve->AddElement(objList, cont);
+
+  gEve->Redraw3D();
+}
+
+
+// Example about filling the list analyser with objects via a macro. You can use the following example macro to load the list with trd tracks:
+/*
+// Launches the list analyser and loads tracks into the list.
+// If you already have a list (or rather a list analyser) with objects and you want to add the tracks to this list, do the following:
+// Right-click the list analyser in the eve-browser and select "ExportToCint". Choose e.g. "list" for the name in the window that pops up.
+// In the console type ".x ana_list_load_tracks.C(list)"
+// For more information please see "ana_list.C" or have a look at the class documentation.
+
 #ifndef __CINT__
 #include <TGLViewer.h>
 #include <TEveManager.h>
 #include "TRD/AliTRDtrackV1.h"
 #endif
 
-void ana_list(TEveElement *cont = 0)
+void ana_list_load_trd_tracks(AliEveListAnalyser* objects = 0, TEveElement *cont = 0)
 {
   // Link data containers
   AliESDfriend *eventESDfriend = 0x0;
   if(!(eventESDfriend = AliEveEventManager::AssertESDfriend())){
-    Warning("trd_loadObjectList", "AliESDfriend not found");
+    Warning("ana_list_load_tracks", "AliESDfriend not found");
     return;
   }
 
@@ -40,7 +89,16 @@ void ana_list(TEveElement *cont = 0)
   reco->SetRecoParam(trdRecoParam);
 
 
-  AliEveListAnalyser *objects = new AliEveListAnalyser("TRD Analysis Object");
+  if (!objects)
+  {
+    objects = new AliEveListAnalyser("Analysis Objects");
+    gEve->AddElement(objects, cont);
+  }
+
+  // Number of elements already in the list
+  Int_t nOld = objects->NumChildren();
+
+  Int_t count = 0;
 
   for (Int_t n = 0; n < esd->GetNumberOfTracks(); n++)
   {
@@ -54,43 +112,39 @@ void ana_list(TEveElement *cont = 0)
     }
 
     TObject *cal = 0x0;
+    AliTRDtrackV1 *trackObj = 0x0;
+    AliEveTRDTrack *trackEve = 0x0;
     Int_t ical = 0;
 
     while((cal = friendTrack->GetCalibObject(ical++))){
       if(strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
-      AliTRDtrackV1 *trackObj = dynamic_cast<AliTRDtrackV1 *>(cal);
+      trackObj = new AliTRDtrackV1(*((AliTRDtrackV1*)cal));
       if (!trackObj)
       {
         printf("Cast to AliTRDtrackV1 failed!\n");
         continue;
       }
-      trackObj->SetReconstructor(reco);
-      AliEveTRDTrack *trackEve = new AliEveTRDTrack(trackObj);
+      if (trackObj->IsOwner()) trackObj->SetOwner();
+      trackObj->SetReconstructor(reco);   
+      
+      trackEve = new AliEveTRDTrack(trackObj);
       if (!trackEve)
       {
-        printf("Cast to AliEveTRDTrack failed!\n");
+        prWintf("Cast to AliEveTRDTrack failed!\n");
         continue;
       }
       objects->AddElement(trackEve);
       trackEve->SetESDstatus(esdTrack->GetStatus());
-      trackEve->SetName(Form("[%4d] %s", n, trackEve->GetName()));
+      trackEve->SetName(Form("[%4d] %s", count + nOld, trackEve->GetName()));
+      ++count;
     }
   }
 
-  delete reco;
-
   objects->SetTitle(Form("Objects %d", objects->NumChildren()));
   objects->StampObjProps();
-  gEve->AddElement(objects, cont);
-
 
   gEve->Redraw3D();
 
-  //  TGLViewer *v = gEve->GetDefaultGLViewer();
-  //  v->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
-  //  ((TGLOrthoCamera&)v->CurrentCamera()).SetEnableRotate(kTRUE);
-  //  v->UpdateScene();
-
   return;
 }
+*/