]>
Commit | Line | Data |
---|---|---|
bca2f0a5 | 1 | #ifndef __CINT__ |
2 | #include <TEveManager.h> | |
3 | #include <TEvePointSet.h> | |
0016c40b | 4 | #include <TGeoManager.h> |
bca2f0a5 | 5 | |
6c49a8e1 | 6 | #include <AliRunLoader.h> |
7 | #include <AliCluster.h> | |
8 | #include <AliTracker.h> | |
9 | #include <AliReconstruction.h> | |
10 | #include <AliESDEvent.h> | |
11 | #include <AliESDtrack.h> | |
12 | #include <AliESDfriend.h> | |
13 | #include <AliITSRecoParam.h> | |
14 | #include <AliEveEventManager.h> | |
bca2f0a5 | 15 | #endif |
16 | ||
17 | void clusters() | |
18 | { | |
19 | AliEveEventManager::AssertGeometry(); | |
20 | ||
21 | AliRunLoader *rl = AliEveEventManager::AssertRunLoader(); | |
22 | AliESDEvent *esd = AliEveEventManager::AssertESD(); | |
8661a211 | 23 | AliEveEventManager::AssertESDfriend(); |
24 | AliEveEventManager::AssertMagField(); | |
bca2f0a5 | 25 | |
8661a211 | 26 | const char* detNames[] = { "ITS", "TPC", /*"TRD",*/ "TOF", "HMPID" }; |
27 | const Int_t detIds[] = { 0, 1, /* 2, */ 3, 5 }; | |
bca2f0a5 | 28 | const Int_t detN = sizeof(detNames)/sizeof(char*); |
29 | ||
94dae497 | 30 | // Hack - AliReconstruction does wonders with gGeoManager. |
31 | TGeoManager* xxx = gGeoManager; gGeoManager = 0; | |
bca2f0a5 | 32 | AliReconstruction* reco = new AliReconstruction; |
94dae497 | 33 | gGeoManager = xxx; |
34 | ||
35 | // Hack for ITS - it requires RecoParams outside event-loop! | |
0016c40b | 36 | reco->SetRecoParam("ITS", AliITSRecoParam::GetLowFluxParam()); |
94dae497 | 37 | |
bca2f0a5 | 38 | reco->ImportRunLoader(rl); |
39 | { | |
40 | TString alldets; | |
41 | for (Int_t i = 0; i < detN; ++i) { | |
42 | alldets += detNames[i]; | |
43 | alldets += " "; | |
44 | } | |
45 | reco->CreateTrackers(alldets); | |
46 | } | |
47 | ||
48 | TObjArray* clarr = new TObjArray(); | |
49 | ||
50 | // Load clusters, fill them into clarr. | |
51 | ||
52 | for (Int_t i = 0; i < detN; ++i) | |
53 | { | |
54 | Int_t det = detIds[i]; | |
55 | rl->LoadRecPoints(detNames[i]); | |
56 | ||
57 | TTree *cTree = rl->GetTreeR(detNames[i], false); | |
58 | if (cTree == 0) | |
59 | continue; | |
60 | ||
61 | AliTracker* tracker = reco->GetTracker(det); | |
0016c40b | 62 | if (tracker == 0) continue; |
bca2f0a5 | 63 | tracker->LoadClusters(cTree); |
64 | tracker->FillClusterArray(clarr); | |
65 | } | |
66 | ||
67 | // Loop over tracks and friends, tag used clusters. | |
68 | ||
69 | for (Int_t n = 0; n < esd->GetNumberOfTracks(); ++n) | |
70 | { | |
71 | AliESDtrack* at = esd->GetTrack(n); | |
72 | ||
73 | Int_t idx[200]; | |
74 | for (Int_t i = 0; i < detN; ++i) | |
75 | { | |
76 | Int_t det = detIds[i]; | |
77 | AliTracker* tracker = reco->GetTracker(det); | |
0016c40b | 78 | if (tracker == 0) continue; |
bca2f0a5 | 79 | Int_t nclusters = at->GetClusters(det, idx); |
f63f6252 | 80 | Int_t p=0; |
81 | for (Int_t c = 0; c < nclusters; ) | |
bca2f0a5 | 82 | { |
f63f6252 | 83 | Int_t index = idx[p++]; |
84 | if (index < 0) continue; | |
85 | c++; | |
86 | AliCluster* cluster = tracker->GetCluster(index); | |
87 | if (cluster) cluster->IncreaseClusterUsage(); | |
88 | //else printf("Zero cluster pointer for detector: %s\n",detNames[i]); | |
bca2f0a5 | 89 | } |
90 | } | |
91 | } | |
92 | ||
6b6f47ac | 93 | for (Int_t i = 0; i < detN; ++i) |
94 | rl->UnloadRecPoints(detNames[i]); | |
95 | ||
bca2f0a5 | 96 | // Fill visualization structs |
97 | ||
98 | TEveElementList* list = new TEveElementList("Clusters"); | |
99 | gEve->AddElement(list); | |
100 | ||
101 | TEvePointSet* shared = new TEvePointSet("Shared Clusters"); | |
fbc350a3 | 102 | shared->SetMainColor(2); |
bca2f0a5 | 103 | shared->SetMarkerSize(0.4); |
104 | shared->SetMarkerStyle(2); | |
105 | list->AddElement(shared); | |
106 | ||
107 | TEvePointSet* used = new TEvePointSet("Single-used Clusters"); | |
fbc350a3 | 108 | used->SetMainColor(3); |
bca2f0a5 | 109 | used->SetMarkerSize(0.4); |
110 | used->SetMarkerStyle(2); | |
111 | list->AddElement(used); | |
112 | ||
113 | TEvePointSet* nonused = new TEvePointSet("Not-used Clusters"); | |
fbc350a3 | 114 | nonused->SetMainColor(4); |
bca2f0a5 | 115 | nonused->SetMarkerSize(0.4); |
116 | nonused->SetMarkerStyle(2); | |
117 | list->AddElement(nonused); | |
118 | ||
119 | // Loop over all clusters, fill appropriate container based | |
120 | // on shared/used information. | |
121 | ||
122 | Int_t ncl = clarr->GetEntriesFast(); | |
123 | for (Int_t i = 0; i < ncl; ++i) | |
124 | { | |
125 | AliCluster *cluster = (AliCluster*) clarr->UncheckedAt(i); | |
126 | TEvePointSet *dest = 0; | |
127 | if (cluster->IsClusterShared()) | |
128 | dest = shared; | |
129 | else if (cluster->IsClusterUsed()) | |
130 | dest = used; | |
131 | else | |
132 | dest = nonused; | |
133 | ||
134 | Float_t g[3]; //global coordinates | |
135 | cluster->GetGlobalXYZ(g); | |
136 | dest->SetNextPoint(g[0], g[1], g[2]); | |
137 | dest->SetPointId(cluster); | |
138 | } | |
139 | ||
140 | delete clarr; | |
141 | ||
142 | // ??? What to do with trackers ??? | |
143 | // I'd propose: have global reconstruction that owns them. | |
144 | // AliEveEventManager::AssertAliReconstruction(); | |
145 | // do we have bit-field for detectors, like | |
146 | // enum AliDetectors_e { | |
147 | // kITS = BIT(0), | |
148 | // kTPC = BIT(1), | |
149 | // ... | |
150 | // kCentralTracking = kITS | kTPC | kTRD | kTOF, | |
151 | // ... | |
152 | // }; | |
153 | ||
154 | gEve->Redraw3D(); | |
155 | } |