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