]>
Commit | Line | Data |
---|---|---|
8c555625 | 1 | void AliTPCTestClustering() { |
2 | const char *pname="Param1"; | |
3 | const char *tname="TreeD0_Param1"; | |
4 | ||
5 | // Dynamically link some shared libs | |
6 | if (gClassTable->GetID("AliRun") < 0) { | |
7 | gROOT->LoadMacro("loadlibs.C"); | |
8 | loadlibs(); | |
9 | } else { | |
10 | delete gAlice; | |
11 | gAlice=0; | |
12 | } | |
13 | ||
14 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
15 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); | |
16 | if (!file) file = new TFile("galice.root"); | |
17 | ||
18 | // Get AliRun object from file or create it if not on file | |
19 | if (!gAlice) { | |
20 | gAlice = (AliRun*)file->Get("gAlice"); | |
21 | if (gAlice) printf("AliRun object found on file\n"); | |
22 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
23 | } | |
24 | ||
25 | gAlice->GetEvent(0); | |
26 | ||
27 | AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); | |
28 | int ver=TPC->IsVersion(); | |
29 | cerr<<"TPC version "<<ver<<" has been found !\n"; | |
30 | ||
31 | AliTPCD *dig=(AliTPCD*)file->Get(pname); | |
32 | if (dig!=0) TPC->SetDigParam(dig); | |
33 | else cerr<<"Warning: default TPC parameters will be used !\n"; | |
34 | ||
35 | switch (ver) { | |
36 | case 1: | |
37 | cerr<<"Making clusters...\n"; | |
38 | TPC->Hits2Clusters(); | |
39 | break; | |
40 | case 2: | |
41 | cerr<<"Looking for clusters...\n"; | |
42 | TPC->Digits2Clusters(); | |
43 | break; | |
44 | default: | |
45 | cerr<<"Invalid TPC version !\n"; | |
46 | return; | |
47 | } | |
48 | TClonesArray *c=TPC->Clusters(); | |
49 | int n=c->GetEntriesFast(); | |
50 | cerr<<"Number of clusters "<<n<<" \n"; | |
51 | ||
52 | AliTPCParam *par=&TPC->GetDigParam()->GetParam(); | |
53 | Float_t x[3]; | |
54 | TPolyMarker3D *pm=new TPolyMarker3D(n); | |
55 | for (int i=0; i<n; i++) { | |
56 | AliTPCcluster *cl=(AliTPCcluster *)c->UncheckedAt(i); | |
57 | cl->GetXYZ(x,par); | |
58 | Double_t xx=x[0], yy=x[1], zz=x[2]; | |
59 | pm->SetPoint(i,xx,yy,zz); | |
60 | } | |
61 | ||
62 | c1=new TCanvas("c1", "Cluster display",0,0,660,740); | |
63 | TView *v=new TView(1); | |
64 | v->SetRange(-430,-560,-430,430,560,1710); | |
65 | ||
66 | c1->Clear(); | |
67 | c1->SetFillColor(1); | |
68 | c1->SetTheta(90.); | |
69 | c1->SetPhi(0.); | |
70 | ||
71 | pm->SetMarkerSize(1); | |
72 | pm->SetMarkerColor(2); | |
73 | pm->SetMarkerStyle(1); | |
74 | pm->Draw(); | |
75 | ||
76 | gAlice->GetGeometry()->Draw("same"); | |
77 | } |