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