2 #include <TEveManager.h>
3 #include <TEvePointSet.h>
4 #include <TGeoManager.h>
5 #include <EveBase/AliEveEventManager.h>
7 #include "AliRunLoader.h"
8 #include "AliCluster.h"
9 #include "AliTracker.h"
10 #include "AliReconstruction.h"
11 #include "AliESDEvent.h"
12 #include "AliESDtrack.h"
13 #include "AliESDfriend.h"
15 #include "ITS/AliITSRecoParam.h"
20 AliEveEventManager::AssertGeometry();
22 AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
23 AliESDEvent *esd = AliEveEventManager::AssertESD();
24 AliEveEventManager::AssertESDfriend();
25 AliEveEventManager::AssertMagField();
27 const char* detNames[] = { "ITS", "TPC", /*"TRD",*/ "TOF", "HMPID" };
28 const Int_t detIds[] = { 0, 1, /* 2, */ 3, 5 };
29 const Int_t detN = sizeof(detNames)/sizeof(char*);
31 // Hack - AliReconstruction does wonders with gGeoManager.
32 TGeoManager* xxx = gGeoManager; gGeoManager = 0;
33 AliReconstruction* reco = new AliReconstruction;
36 // Hack for ITS - it requires RecoParams outside event-loop!
37 reco->SetRecoParam("ITS", AliITSRecoParam::GetLowFluxParam());
39 reco->ImportRunLoader(rl);
42 for (Int_t i = 0; i < detN; ++i) {
43 alldets += detNames[i];
46 reco->CreateTrackers(alldets);
49 TObjArray* clarr = new TObjArray();
51 // Load clusters, fill them into clarr.
53 for (Int_t i = 0; i < detN; ++i)
55 Int_t det = detIds[i];
56 rl->LoadRecPoints(detNames[i]);
58 TTree *cTree = rl->GetTreeR(detNames[i], false);
62 AliTracker* tracker = reco->GetTracker(det);
63 if (tracker == 0) continue;
64 tracker->LoadClusters(cTree);
65 tracker->FillClusterArray(clarr);
68 // Loop over tracks and friends, tag used clusters.
70 for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n)
72 AliESDtrack* at = esd->GetTrack(n);
75 for (Int_t i = 0; i < detN; ++i)
77 Int_t det = detIds[i];
78 AliTracker* tracker = reco->GetTracker(det);
79 if (tracker == 0) continue;
80 Int_t nclusters = at->GetClusters(det, idx);
82 for (Int_t c = 0; c < nclusters; )
84 Int_t index = idx[p++];
85 if (index < 0) continue;
87 AliCluster* cluster = tracker->GetCluster(index);
88 if (cluster) cluster->IncreaseClusterUsage();
89 //else printf("Zero cluster pointer for detector: %s\n",detNames[i]);
94 for (Int_t i = 0; i < detN; ++i)
95 rl->UnloadRecPoints(detNames[i]);
97 // Fill visualization structs
99 TEveElementList* list = new TEveElementList("Clusters");
100 gEve->AddElement(list);
102 TEvePointSet* shared = new TEvePointSet("Shared Clusters");
103 shared->SetMainColor(2);
104 shared->SetMarkerSize(0.4);
105 shared->SetMarkerStyle(2);
106 list->AddElement(shared);
108 TEvePointSet* used = new TEvePointSet("Single-used Clusters");
109 used->SetMainColor(3);
110 used->SetMarkerSize(0.4);
111 used->SetMarkerStyle(2);
112 list->AddElement(used);
114 TEvePointSet* nonused = new TEvePointSet("Not-used Clusters");
115 nonused->SetMainColor(4);
116 nonused->SetMarkerSize(0.4);
117 nonused->SetMarkerStyle(2);
118 list->AddElement(nonused);
120 // Loop over all clusters, fill appropriate container based
121 // on shared/used information.
123 Int_t ncl = clarr->GetEntriesFast();
124 for (Int_t i = 0; i < ncl; ++i)
126 AliCluster *cluster = (AliCluster*) clarr->UncheckedAt(i);
127 TEvePointSet *dest = 0;
128 if (cluster->IsClusterShared())
130 else if (cluster->IsClusterUsed())
135 Float_t g[3]; //global coordinates
136 cluster->GetGlobalXYZ(g);
137 dest->SetNextPoint(g[0], g[1], g[2]);
138 dest->SetPointId(cluster);
143 // ??? What to do with trackers ???
144 // I'd propose: have global reconstruction that owns them.
145 // AliEveEventManager::AssertAliReconstruction();
146 // do we have bit-field for detectors, like
147 // enum AliDetectors_e {
151 // kCentralTracking = kITS | kTPC | kTRD | kTOF,