]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCHits2Clusters.C
Changed DimuonCombinator into AliDimuCombinator to follow ALICE coding
[u/mrichter/AliRoot.git] / TPC / TPCHits2Clusters.C
1 void TPCHits2Clusters() {
2 // Dynamically link some shared libs
3    if (gClassTable->GetID("AliRun") < 0) {
4       gSystem->Load("libGeant3Dummy.so");      // a dummy version of Geant3
5       gSystem->Load("PHOS/libPHOSdummy.so");   // the standard Alice classes 
6       gSystem->Load("libgalice.so");           // the standard Alice classes 
7    }
8
9 // Connect the Root Galice file containing Geometry, Kine and Hits
10    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
11    if (file) file->Close();
12    file = new TFile("galice.root");
13
14 // Get AliRun object from file or create it if not on file
15    if (!gAlice) {
16       gAlice = (AliRun*)file->Get("gAlice");
17       if (gAlice) printf("AliRun object found on file\n");
18       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
19    }
20
21    gAlice->GetEvent(0);
22
23    AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
24    TPC->Hits2Clusters();
25    TClonesArray *c=TPC->Clusters();
26    int n=c->GetEntriesFast();
27    cout<<"Number of clusters "<<n<<endl;
28
29    TPolyMarker3D *pm=new TPolyMarker3D(n);
30    for (int i=0; i<n; i++) {
31        AliTPCcluster *cl=(AliTPCcluster *)c->UncheckedAt(i);
32        pm->SetPoint(i,cl->fX,cl->fY,cl->fZ);
33    }
34
35    c1=new TCanvas("c1", "Cluster display",0,0,575,750);
36    TView *v=new TView(1);
37    v->SetRange(-430,-560,-430,430,560,1710);
38
39    c1->Clear();
40    c1->SetFillColor(1);
41    c1->SetTheta(90.);
42    c1->SetPhi(0.);
43
44    pm->SetMarkerSize(1);
45    pm->SetMarkerColor(2);
46    pm->SetMarkerStyle(1);
47    pm->Draw();
48
49    gAlice->GetGeometry()->Draw("same");
50 }