]>
Commit | Line | Data |
---|---|---|
73042f01 | 1 | Int_t AliTPCDisplayDigits(int sec, int row, int lab=-1, |
cc80f89e | 2 | int max_t_chan=500, float min_t=0., float max_t=500., |
3 | int max_p_chan=150, float min_p=0., float max_p=150.) | |
4 | { | |
73042f01 | 5 | cerr<<"Displaying digits...\n"; |
cc80f89e | 6 | |
7 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
73042f01 | 8 | TFile *f = TFile::Open("galice.root"); |
9 | if (!f->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} | |
cc80f89e | 10 | |
73042f01 | 11 | AliTPCParam *par=(AliTPCParam *)f->Get("75x40_100x60"); |
cc80f89e | 12 | |
13 | char s[80]; | |
14 | sprintf(s,"Sector %d Row %d\n",sec,row); | |
15 | TH2F *h = new TH2F("h",s,max_t_chan,min_t,max_t,max_p_chan,min_p,max_p); | |
16 | ||
73042f01 | 17 | TTree *t=(TTree*)f->Get("TreeD_75x40_100x60"); |
cc80f89e | 18 | AliSimDigits dummy, *digit=&dummy; |
19 | t->GetBranch("Segment")->SetAddress(&digit); | |
20 | for (int i=0; i<t->GetEntries(); i++) { | |
21 | t->GetEvent(i); | |
22 | int ss,rr; | |
23 | par->AdjustSectorRow(digit->GetID(),ss,rr); | |
24 | if (ss==sec && rr==row) goto ok; | |
25 | } | |
73042f01 | 26 | return 2; |
cc80f89e | 27 | |
28 | ok: | |
29 | int imax=0, jmax=0, qmax=0; | |
30 | digit->First(); | |
31 | do { | |
32 | Short_t dig=digit->CurrentDigit(); | |
33 | int i=digit->CurrentRow(), j=digit->CurrentColumn(); | |
34 | if (lab >= 0) { | |
35 | int lab0=digit->GetTrackID(i,j,0); | |
36 | int lab1=digit->GetTrackID(i,j,1); | |
37 | int lab2=digit->GetTrackID(i,j,2); | |
38 | if (lab0!=lab) if (lab1!=lab) if (lab2!=lab) continue; | |
39 | if (dig>qmax) {imax=i; jmax=j; qmax=dig;} | |
40 | cerr<<lab0<<' '<<lab1<<' '<<lab2<<endl; | |
41 | } | |
42 | h->Fill(i,j,dig); | |
43 | } while (digit->Next()); | |
73042f01 | 44 | if (qmax>0){cerr<<"Peak (time,pad,q) : "<<imax<<' '<<jmax<<' '<<qmax<<endl;} |
cc80f89e | 45 | |
46 | h->SetMaximum(100); | |
47 | gStyle->SetOptStat(0); | |
73042f01 | 48 | TCanvas *c1=new TCanvas("ddisplay","TPC digits display",0,0,1110,680); |
cc80f89e | 49 | TPad *p1=new TPad("p1","",0,0,1,0.5); |
50 | p1->Draw(); | |
51 | TPad *p2=new TPad("p2","",0,0.5,1,1); | |
52 | p2->Draw(); | |
53 | p2->cd(); | |
73042f01 | 54 | h->DrawCopy("lego"); |
cc80f89e | 55 | p1->cd(); |
73042f01 | 56 | h->DrawCopy("colz"); |
57 | ||
58 | c1->Modified(); c1->Update(); | |
59 | ||
60 | f->Close(); | |
61 | return 0; | |
cc80f89e | 62 | } |
63 |