]>
Commit | Line | Data |
---|---|---|
1 | /**************************************************************************** | |
2 | * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * | |
3 | ****************************************************************************/ | |
4 | ||
5 | #ifndef __CINT__ | |
6 | #include <Riostream.h> | |
7 | #include <TFile.h> | |
8 | #include <TTree.h> | |
9 | #include <TCanvas.h> | |
10 | #include <TView.h> | |
11 | #include <TPolyMarker3D.h> | |
12 | #include <TNode.h> | |
13 | #include <TGeometry.h> | |
14 | ||
15 | #include "AliTPCParam.h" | |
16 | #include "AliClusters.h" | |
17 | #include "AliTPCcluster.h" | |
18 | #endif | |
19 | ||
20 | Int_t AliTPCDisplayClusters(Int_t eventn=0, Int_t noiseth=15) { | |
21 | cerr<<"Displaying clusters...\n"; | |
22 | ||
23 | TFile *file=TFile::Open("galice.root"); | |
24 | if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} | |
25 | ||
26 | TFile *cf=TFile::Open("AliTPCclusters.root"); | |
27 | if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} | |
28 | ||
29 | AliTPCParam *dig=(AliTPCParam *)cf->Get("75x40_100x60_150x60"); | |
30 | if (!dig) {cerr<<"TPC parameters have not been found !\n"; return 2;} | |
31 | ||
32 | TCanvas *c1=new TCanvas("cdisplay", "Cluster display",0,0,700,730); | |
33 | TView *v=new TView(1); | |
34 | v->SetRange(-430,-560,-430,430,560,1710); | |
35 | c1->Clear(); | |
36 | c1->SetFillColor(1); | |
37 | c1->SetTheta(90.); | |
38 | c1->SetPhi(0.); | |
39 | ||
40 | char cname[100]; | |
41 | sprintf(cname,"TreeC_TPC_%d",eventn); | |
42 | TTree *cTree=(TTree *)cf->Get(cname); | |
43 | if (!cTree) { | |
44 | cerr<<"Can't find tree : "<<cname<<endl; | |
45 | return 1; | |
46 | } | |
47 | ||
48 | AliClusters *clusters=new AliClusters(); | |
49 | clusters->SetClass("AliTPCcluster"); | |
50 | ||
51 | cTree->SetBranchAddress("Segment",&clusters); | |
52 | ||
53 | Int_t nrows=Int_t(cTree->GetEntries()); | |
54 | for (Int_t n=0; n<nrows; n++) { | |
55 | cTree->GetEvent(n); | |
56 | Int_t sec,row; | |
57 | dig->AdjustSectorRow(clusters->GetID(),sec,row); | |
58 | TClonesArray &clrow=*clusters->GetArray(); | |
59 | Int_t ncl=clrow.GetEntriesFast(); | |
60 | TPolyMarker3D *pm=new TPolyMarker3D(ncl); | |
61 | while (ncl--) { | |
62 | AliTPCcluster *cl=(AliTPCcluster*)clrow[ncl]; | |
63 | Double_t x=dig->GetPadRowRadii(sec,row), y=cl->GetY(), z=cl->GetZ(); | |
64 | if (cl->GetQ()<noiseth) continue; | |
65 | Float_t cs, sn, tmp; | |
66 | dig->AdjustCosSin(sec,cs,sn); | |
67 | tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; | |
68 | pm->SetPoint(ncl,x,y,z); | |
69 | } | |
70 | clrow.Clear(); | |
71 | pm->SetMarkerSize(1); pm->SetMarkerColor(2); pm->SetMarkerStyle(1); | |
72 | pm->Draw(); | |
73 | } | |
74 | delete cTree; | |
75 | delete dig; | |
76 | cf->Close(); | |
77 | ||
78 | TGeometry *geom=(TGeometry*)file->Get("AliceGeom"); | |
79 | TNode * main = (TNode*)((geom->GetListOfNodes())->First()); | |
80 | TIter next(main->GetListOfNodes()); | |
81 | TNode *module=0; | |
82 | while((module = (TNode*)next())) { | |
83 | char ch[100]; | |
84 | sprintf(ch,"%s\n",module->GetTitle()); | |
85 | //printf("%s\n",module->GetTitle()); | |
86 | if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw | |
87 | module->SetVisibility(3); | |
88 | else | |
89 | module->SetVisibility(-1); | |
90 | } | |
91 | ||
92 | ||
93 | geom->Draw("same"); | |
94 | c1->Modified(); c1->Update(); | |
95 | ||
96 | file->Close(); | |
97 | return 0; | |
98 | } | |
99 |