]>
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 <TStyle.h> | |
11 | #include <TH2.h> | |
12 | ||
13 | #include "AliTPCParam.h" | |
14 | #include "AliSimDigits.h" | |
15 | #endif | |
16 | ||
17 | Int_t AliTPCDisplayDigits(Int_t eventn, int sec, int row, int lab=-1, | |
18 | int max_t_chan=500, float min_t=0., float max_t=500., | |
19 | int max_p_chan=150, float min_p=0., float max_p=150.) | |
20 | { | |
21 | cerr<<"Displaying digits...\n"; | |
22 | ||
23 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
24 | TFile *f = TFile::Open("rfio:galice.root"); | |
25 | if (!f->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} | |
26 | ||
27 | ||
28 | ||
29 | AliTPCParam *par=(AliTPCParam *)f->Get("75x40_100x60_150x60"); | |
30 | if (!par) { cerr<<"TPC parameters have not been found !\n"; return 2; } | |
31 | ||
32 | Char_t s[80]; | |
33 | sprintf(s,"Sector %d Row %d\n",sec,row); | |
34 | TH2F *h = new TH2F("h",s,max_t_chan,min_t,max_t,max_p_chan,min_p,max_p); | |
35 | ||
36 | Char_t name[100]; | |
37 | sprintf(name,"TreeD_75x40_100x60_150x60_%d",eventn); | |
38 | ||
39 | TTree *t=(TTree*)f->Get(name); | |
40 | if (!t) { cerr<<"TPC digits have not been found !\n"; return 3; } | |
41 | AliSimDigits dummy, *digit=&dummy; | |
42 | t->GetBranch("Segment")->SetAddress(&digit); | |
43 | Int_t sbr=(Int_t)t->GetEntries(); | |
44 | for (Int_t i=0; i<sbr; i++) { | |
45 | if (!t->GetEvent(i)) continue; | |
46 | Int_t s,r; | |
47 | par->AdjustSectorRow(digit->GetID(),s,r); | |
48 | if (s==sec && r==row) goto ok; | |
49 | } | |
50 | return 4; | |
51 | ||
52 | ok: | |
53 | ||
54 | Int_t imax=0, jmax=0, qmax=0; | |
55 | digit->First(); | |
56 | do { | |
57 | //Short_t dig=digit->CurrentDigit(); | |
58 | Int_t i=digit->CurrentRow(), j=digit->CurrentColumn(); | |
59 | Short_t dig=digit->GetDigit(i,j); | |
60 | if (lab >= 0) { | |
61 | Int_t lab0=digit->GetTrackID(i,j,0); | |
62 | Int_t lab1=digit->GetTrackID(i,j,1); | |
63 | Int_t lab2=digit->GetTrackID(i,j,2); | |
64 | if (lab0!=lab) if (lab1!=lab) if (lab2!=lab) continue; | |
65 | if (dig>qmax) {imax=i; jmax=j; qmax=dig;} | |
66 | cerr<<lab0<<' '<<lab1<<' '<<lab2<<endl; | |
67 | } | |
68 | h->Fill(i,j,dig); | |
69 | } while (digit->Next()); | |
70 | if (qmax>0){cerr<<"Peak (time,pad,q) : "<<imax<<' '<<jmax<<' '<<qmax<<endl;} | |
71 | ||
72 | h->SetMaximum(100); | |
73 | gStyle->SetOptStat(0); | |
74 | TCanvas *c1=new TCanvas("ddisplay","TPC digits display",0,0,1110,680); | |
75 | TPad *p1=new TPad("p1","",0,0,1,0.5); | |
76 | p1->Draw(); | |
77 | TPad *p2=new TPad("p2","",0,0.5,1,1); | |
78 | p2->Draw(); | |
79 | p2->cd(); | |
80 | h->DrawCopy("lego"); | |
81 | p1->cd(); | |
82 | h->DrawCopy("colz"); | |
83 | ||
84 | c1->Modified(); c1->Update(); | |
85 | ||
86 | f->Close(); | |
87 | return 0; | |
88 | } | |
89 |