]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/ana_list.C
recover the detector tag int and not the string from the AOD particle
[u/mrichter/AliRoot.git] / EVE / alice-macros / ana_list.C
1 // How to fill the list analyser with objects via a macro: Please see example below!
2 // How to use the list analyser (and especially this macro):
3
4 // -- Primary selection (to add e.g. tracklets, tracks, etc.):
5 // - 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)
6 // - Run this macro (ana_list.C)
7 // - In the tab "eve" in the browser select the list analyser (called "Analysis objects" in the standard case)
8 // - Select the "list" tab in the editor of this object.
9 // - Click the button "start"
10 // - Select the objects you want to add by left-clicking on them in the viewer (or as well in the browser (left panel))
11 // - When you have finished adding the desired objects, click the button "stop"
12 // Use the list analyser "as usual" (see class documentation)
13
14 // -- Secondary selection (to add e.g. single clusters (of a TEvePointSet) or digits (of a TEveQuadSet)):
15 // To add e.g. AliTrackPoints or tracks you can do the following:
16 // - Run e.g. the macro "esd_tracks.C" 
17 // - 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
18 // -> Select "ImportClustersFromIndex"
19 // -> Do this for all tracks you want to analyse.
20 // - Run this macro (ana_list.C)
21 // - In the tab "eve" in the browser select the list analyser (called "Analysis objects" in the standard case)
22 // - Select the "list" tab in the editor of this object.
23 // - Click the button "start"
24 // - 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
25 // - When you have finished adding the desired objects, click the button "stop"
26 // Use the list analyser "as usual" (see class documentation)
27
28 #if !defined(__CINT__) || defined(__MAKECINT__)
29 #include <TEveManager.h>
30
31 #include <AliTRDarrayADC.h>
32 #include <AliEveListAnalyser.h>
33 #endif
34
35 void ana_list(TEveElement *cont = 0)
36 {
37   AliEveListAnalyser * objList = new AliEveListAnalyser("Analysis objects");
38   
39   objList->SetTitle("Analysis objects (0)");
40
41   gEve->AddElement(objList, cont);
42
43   gEve->Redraw3D();
44 }
45
46
47 // 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:
48 /*
49 // Launches the list analyser and loads tracks into the list.
50 // 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:
51 // 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.
52 // In the console type ".x ana_list_load_tracks.C(list)"
53 // For more information please see "ana_list.C" or have a look at the class documentation.
54
55 #ifndef __CINT__
56 #include <TGLViewer.h>
57 #include <TEveManager.h>
58 #include <EveBase/AliEveEventManager.h>
59 #include "TRD/AliTRDarrayADC.h"
60 #include <EveDet/AliEveListAnalyser.h>
61
62 #include "AliESDEvent.h"
63 #include "AliESDfriend.h"
64 #include "TRD/AliTRDReconstructor.h"
65 #include "TRD/AliTRDtrackV1.h"
66 #endif
67
68 void ana_list_load_trd_tracks(AliEveListAnalyser* objects = 0, TEveElement *cont = 0)
69 {
70   // Link data containers
71   AliESDfriend *eventESDfriend = 0x0;
72   if(!(eventESDfriend = AliEveEventManager::AssertESDfriend())){
73     Warning("ana_list_load_tracks", "AliESDfriend not found");
74     return;
75   }
76
77   AliESDEvent* esd = AliEveEventManager::AssertESD();
78
79   AliEveEventManager::AssertGeometry();
80
81   AliTRDrecoParam *trdRecoParam = AliTRDrecoParam::GetLowFluxParam();
82   if (!trdRecoParam)
83   {
84     printf("Could not load AliTRDrecoParam\n");
85     return;
86   }
87   trdRecoParam->SetPIDNeuralNetwork();
88   AliTRDReconstructor *reco = new AliTRDReconstructor();
89   if (!reco)
90   {
91     printf("Could not load AliTRDReconstructor\n");
92     return;
93   }
94   reco->SetRecoParam(trdRecoParam);
95
96
97   if (!objects)
98   {
99     objects = new AliEveListAnalyser("Analysis Objects");
100     gEve->AddElement(objects, cont);
101   }
102
103   // Number of elements already in the list
104   Int_t nOld = objects->NumChildren();
105
106   Int_t count = 0;
107
108   for (Int_t n = 0; n < esd->GetNumberOfTracks(); n++)
109   {
110     AliESDtrack* esdTrack = esd->GetTrack(n);
111     AliESDfriendTrack *friendTrack = eventESDfriend->GetTrack(n);
112
113     if (!esdTrack || !friendTrack)
114     {
115       printf("Problem with track %d\n", n);
116       continue;
117     }
118
119     TObject *cal = 0x0;
120     AliTRDtrackV1 *trackObj = 0x0;
121     AliEveTRDTrack *trackEve = 0x0;
122     Int_t ical = 0;
123
124     while((cal = friendTrack->GetCalibObject(ical++))){
125       if(strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
126       trackObj = new AliTRDtrackV1(*((AliTRDtrackV1*)cal));
127       if (!trackObj)
128       {
129         printf("Cast to AliTRDtrackV1 failed!\n");
130         continue;
131       }
132       if (trackObj->IsOwner()) trackObj->SetOwner();
133       trackObj->SetReconstructor(reco);   
134       
135       trackEve = new AliEveTRDTrack(trackObj);
136       if (!trackEve)
137       {
138         prWintf("Cast to AliEveTRDTrack failed!\n");
139         continue;
140       }
141       objects->AddElement(trackEve);
142       trackEve->SetESDstatus(esdTrack->GetStatus());
143       trackEve->SetName(Form("[%4d] %s", count + nOld, trackEve->GetName()));
144       ++count;
145     }
146   }
147
148   objects->SetTitle(Form("Objects %d", objects->NumChildren()));
149   objects->StampObjProps();
150
151   gEve->Redraw3D();
152
153   return;
154 }
155 */