]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
cb4245bb | 9 | |
ba978640 | 10 | #if !defined(__CINT__) || defined(__MAKECINT__) |
6aafad45 | 11 | #include <TColor.h> |
176fc00c | 12 | #include <TTree.h> |
ba978640 | 13 | #include <TEveManager.h> |
14 | #include <TEvePointSet.h> | |
32e219c2 | 15 | |
71d5ee50 | 16 | #include <AliCluster.h> |
17 | #include <AliRunLoader.h> | |
18 | #include <AliTPCClustersRow.h> | |
19 | #include <AliTPCclusterMI.h> | |
20 | #include <AliEveEventManager.h> | |
ba978640 | 21 | #else |
22 | class TEveElement; | |
23 | class TEvePointSet; | |
32e219c2 | 24 | #endif |
25 | ||
84aff7a4 | 26 | TEvePointSet* tpc_clusters(TEveElement* cont=0, Float_t maxR=270) |
ae1afd97 | 27 | { |
6aafad45 | 28 | |
ae1afd97 | 29 | const Int_t kMaxCl=100*160; |
30 | ||
6aafad45 | 31 | Int_t fNColorBins = 5; |
32 | ||
d810d0de | 33 | AliEveEventManager::AssertGeometry(); |
ae1afd97 | 34 | |
d810d0de | 35 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); |
ae1afd97 | 36 | rl->LoadRecPoints("TPC"); |
37 | ||
787c89c5 | 38 | TTree *cTree = rl->GetTreeR("TPC", false); |
39 | if (cTree == 0) | |
40 | return 0; | |
41 | ||
42 | AliTPCClustersRow *clrow = new AliTPCClustersRow(); | |
ae1afd97 | 43 | clrow->SetClass("AliTPCclusterMI"); |
44 | clrow->SetArray(kMaxCl); | |
32e219c2 | 45 | cTree->SetBranchAddress("Segment", &clrow); |
ae1afd97 | 46 | |
787c89c5 | 47 | TEvePointSet* clusters = new TEvePointSet(kMaxCl); |
48 | clusters->SetOwnIds(kTRUE); | |
49 | ||
6aafad45 | 50 | TEvePointSetArray * cc = new TEvePointSetArray("TPC Clusters Colorized"); |
51 | cc->SetMainColor(kRed); | |
52 | cc->SetMarkerStyle(4); | |
53 | cc->SetMarkerSize(0.4); | |
54 | cc->InitBins("Cluster Charge", fNColorBins, 0., fNColorBins*60.); | |
55 | ||
56 | cc->GetBin(0)->SetMainColor(kGray); | |
57 | cc->GetBin(0)->SetMarkerSize(0.4); | |
58 | cc->GetBin(1)->SetMainColor(kBlue); | |
59 | cc->GetBin(1)->SetMarkerSize(0.42); | |
60 | cc->GetBin(2)->SetMainColor(kCyan); | |
61 | cc->GetBin(2)->SetMarkerSize(0.44); | |
62 | cc->GetBin(3)->SetMainColor(kGreen); | |
63 | cc->GetBin(3)->SetMarkerSize(0.46); | |
64 | cc->GetBin(4)->SetMainColor(kYellow); | |
65 | cc->GetBin(4)->SetMarkerSize(0.48); | |
66 | cc->GetBin(5)->SetMainColor(kRed); | |
67 | cc->GetBin(5)->SetMarkerSize(0.50); | |
68 | cc->GetBin(6)->SetMainColor(kMagenta); | |
69 | cc->GetBin(6)->SetMarkerSize(0.52); | |
787c89c5 | 70 | |
ae1afd97 | 71 | Float_t maxRsqr = maxR*maxR; |
ae1afd97 | 72 | Int_t nentr=(Int_t)cTree->GetEntries(); |
0abe4b3a | 73 | for (Int_t i=0; i<nentr; i++) |
74 | { | |
ae1afd97 | 75 | if (!cTree->GetEvent(i)) continue; |
76 | ||
0abe4b3a | 77 | TClonesArray *cl = clrow->GetArray(); |
78 | Int_t ncl = cl->GetEntriesFast(); | |
ae1afd97 | 79 | |
0abe4b3a | 80 | while (ncl--) |
81 | { | |
6aafad45 | 82 | |
83 | AliTPCclusterMI* clusterMi = (AliTPCclusterMI*) cl->At(ncl); | |
84 | ||
0abe4b3a | 85 | AliCluster *c = (AliCluster*) cl->UncheckedAt(ncl); |
ae1afd97 | 86 | Float_t g[3]; //global coordinates |
87 | c->GetGlobalXYZ(g); | |
88 | if (g[0]*g[0]+g[1]*g[1] < maxRsqr) | |
89 | { | |
6aafad45 | 90 | cc->Fill(g[0], g[1], g[2], clusterMi->GetQ()); |
ae1afd97 | 91 | clusters->SetNextPoint(g[0], g[1], g[2]); |
92 | AliCluster *atp = new AliCluster(*c); | |
93 | clusters->SetPointId(atp); | |
94 | } | |
95 | } | |
96 | cl->Clear(); | |
97 | } | |
98 | ||
99 | delete clrow; | |
100 | ||
442b2a2f | 101 | rl->UnloadRecPoints("TPC"); |
6b6f47ac | 102 | |
0abe4b3a | 103 | if (clusters->Size() == 0 && gEve->GetKeepEmptyCont() == kFALSE) |
104 | { | |
8ebd7df4 | 105 | Warning("tpc_clusters.C", "No TPC clusters"); |
ae1afd97 | 106 | delete clusters; |
107 | return 0; | |
108 | } | |
109 | ||
30650838 | 110 | clusters->SetName("TPC Clusters"); |
ae1afd97 | 111 | |
9dcd42ea | 112 | clusters->SetTitle(Form("N=%d", clusters->Size())); |
f6afd0e1 | 113 | |
9dcd42ea | 114 | const TString viz_tag("REC Clusters TPC"); |
30650838 | 115 | |
68ca2fe7 | 116 | clusters->ApplyVizTag(viz_tag, "Clusters"); |
f6afd0e1 | 117 | |
6aafad45 | 118 | // clusters->SetRnrSelf(kFALSE); |
119 | // clusters->SetRnrChildren(kFALSE); | |
120 | ||
121 | // gEve->AddElement(clusters, cont); | |
122 | ||
123 | cc->SetRnrSelf(kTRUE); | |
124 | ||
125 | gEve->AddElement(cc); | |
f6afd0e1 | 126 | |
84aff7a4 | 127 | gEve->Redraw3D(); |
ae1afd97 | 128 | |
129 | return clusters; | |
130 | } |