]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/ana_list.C
Add function geom_its_dets() that displays the branches containing sensitive volumes.
[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
29
30 void ana_list(TEveElement *cont = 0)
31 {
32   AliEveListAnalyser * objList = new AliEveListAnalyser("Analysis objects");
33   
34   objList->SetTitle("Analysis objects (0)");
35
36   gEve->AddElement(objList, cont);
37
38   gEve->Redraw3D();
39 }
40
41
42 // 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:
43 /*
44 // Launches the list analyser and loads tracks into the list.
45 // 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:
46 // 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.
47 // In the console type ".x ana_list_load_tracks.C(list)"
48 // For more information please see "ana_list.C" or have a look at the class documentation.
49
50 #ifndef __CINT__
51 #include <TGLViewer.h>
52 #include <TEveManager.h>
53 #include <EveBase/AliEveEventManager.h>
54 #include "TRD/AliTRDarrayADC.h"
55 #include <EveDet/AliEveListAnalyser.h>
56
57 #include "AliESDEvent.h"
58 #include "AliESDfriend.h"
59 #include "TRD/AliTRDReconstructor.h"
60 #include "TRD/AliTRDtrackV1.h"
61 #endif
62
63 void ana_list_load_trd_tracks(AliEveListAnalyser* objects = 0, TEveElement *cont = 0)
64 {
65   // Link data containers
66   AliESDfriend *eventESDfriend = 0x0;
67   if(!(eventESDfriend = AliEveEventManager::AssertESDfriend())){
68     Warning("ana_list_load_tracks", "AliESDfriend not found");
69     return;
70   }
71
72   AliESDEvent* esd = AliEveEventManager::AssertESD();
73
74   AliEveEventManager::AssertGeometry();
75
76   AliTRDrecoParam *trdRecoParam = AliTRDrecoParam::GetLowFluxParam();
77   if (!trdRecoParam)
78   {
79     printf("Could not load AliTRDrecoParam\n");
80     return;
81   }
82   trdRecoParam->SetPIDNeuralNetwork();
83   AliTRDReconstructor *reco = new AliTRDReconstructor();
84   if (!reco)
85   {
86     printf("Could not load AliTRDReconstructor\n");
87     return;
88   }
89   reco->SetRecoParam(trdRecoParam);
90
91
92   if (!objects)
93   {
94     objects = new AliEveListAnalyser("Analysis Objects");
95     gEve->AddElement(objects, cont);
96   }
97
98   // Number of elements already in the list
99   Int_t nOld = objects->NumChildren();
100
101   Int_t count = 0;
102
103   for (Int_t n = 0; n < esd->GetNumberOfTracks(); n++)
104   {
105     AliESDtrack* esdTrack = esd->GetTrack(n);
106     AliESDfriendTrack *friendTrack = eventESDfriend->GetTrack(n);
107
108     if (!esdTrack || !friendTrack)
109     {
110       printf("Problem with track %d\n", n);
111       continue;
112     }
113
114     TObject *cal = 0x0;
115     AliTRDtrackV1 *trackObj = 0x0;
116     AliEveTRDTrack *trackEve = 0x0;
117     Int_t ical = 0;
118
119     while((cal = friendTrack->GetCalibObject(ical++))){
120       if(strcmp(cal->IsA()->GetName(), "AliTRDtrackV1") != 0) continue;
121       trackObj = new AliTRDtrackV1(*((AliTRDtrackV1*)cal));
122       if (!trackObj)
123       {
124         printf("Cast to AliTRDtrackV1 failed!\n");
125         continue;
126       }
127       if (trackObj->IsOwner()) trackObj->SetOwner();
128       trackObj->SetReconstructor(reco);   
129       
130       trackEve = new AliEveTRDTrack(trackObj);
131       if (!trackEve)
132       {
133         prWintf("Cast to AliEveTRDTrack failed!\n");
134         continue;
135       }
136       objects->AddElement(trackEve);
137       trackEve->SetESDstatus(esdTrack->GetStatus());
138       trackEve->SetName(Form("[%4d] %s", count + nOld, trackEve->GetName()));
139       ++count;
140     }
141   }
142
143   objects->SetTitle(Form("Objects %d", objects->NumChildren()));
144   objects->StampObjProps();
145
146   gEve->Redraw3D();
147
148   return;
149 }
150 */