]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCDisplayDigits3D.C
Adding new Task - Krypton calibration (Jacek)
[u/mrichter/AliRoot.git] / TPC / AliTPCDisplayDigits3D.C
1 #ifndef __CINT__
2   #include "alles.h"
3   #include "AliTPCtracker.h"
4   #include "TView.h"
5   #include "TPolyMarker3D.h"
6
7 #endif
8 Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15) {
9    cerr<<"Displaying digits...\n";
10
11    TFile *file=TFile::Open("galice.root");
12    if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;}
13
14    TFile *cf=TFile::Open("galice.root");
15    // if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;}
16
17    AliTPCParam *param=(AliTPCParam *)cf->Get("75x40_100x60");
18    if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;}
19
20    TCanvas *c1=new TCanvas("ddisplay", "Digits display",0,0,700,730);
21    TView *v=new TView(1);
22    v->SetRange(-430,-560,-430,430,560,1710);
23    c1->Clear();
24    c1->SetFillColor(1);
25    c1->SetTheta(90.);
26    c1->SetPhi(0.);
27
28    AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
29    digarr->Setup(param);
30    char  cname[100];
31    sprintf(cname,"TreeD_75x40_100x60_%d",eventn);
32
33    digarr->ConnectTree(cname);
34    Int_t nrows=Int_t(digarr->GetTree()->GetEntries());
35    for (Int_t n=0; n<nrows; n++) {
36        AliSimDigits *s=(AliSimDigits*)digarr->LoadEntry(n);
37        Int_t sec,row;
38        param->AdjustSectorRow(s->GetID(),sec,row);
39        Int_t npads, sign;
40        {
41          const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector();
42          if (sec < kNIS) {
43            npads = param->GetNPadsLow(row);
44            sign = (sec < kNIS/2) ? 1 : -1;
45          } else {
46            npads = param->GetNPadsUp(row);
47            sign = ((sec-kNIS) < kNOS/2) ? 1 : -1;
48          }
49        }
50
51        AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row);
52        Int_t ncl=0;
53        if (digrow->First()){
54          while(digrow->Next()) ncl++;
55          ncl++;
56        }
57        TPolyMarker3D *pm=new TPolyMarker3D(ncl);
58        digrow->First();
59        Int_t imar=0;
60        do {
61          Short_t dig=digrow->CurrentDigit();
62          Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec);
63          Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow());        
64          Double_t x=param->GetPadRowRadii(sec,row);
65          if (dig<noiseth) continue;
66          Float_t cs, sn, tmp;
67          param->AdjustCosSin(sec,cs,sn);
68          tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp;
69          pm->SetPoint(imar,x,y,z);
70          imar++;
71        } while (digrow->Next());
72        digarr->ClearRow(sec,row);
73        pm->SetMarkerSize(1); pm->SetMarkerColor(2); pm->SetMarkerStyle(1);
74        pm->Draw();
75    }
76    delete digarr;
77    cf->Close();
78    //draw TPC
79    TGeometry *geom=(TGeometry*)file->Get("AliceGeom");
80    TList *list = geom->GetListOfNodes();
81    TNode * main = (TNode*)((geom->GetListOfNodes())->First());
82    TIter next(main->GetListOfNodes());
83    TNode  *module=0;
84    while((module = (TNode*)next())) {
85      char ch[100];
86      sprintf(ch,"%s\n",module->GetTitle());
87      //printf("%s\n",module->GetTitle());
88      if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C')  //if TPC draw
89        module->SetVisibility(3);
90      else
91        module->SetVisibility(-1);
92    }
93      
94    
95    geom->Draw("same");
96    //v->Draw();
97    c1->Modified(); c1->Update(); 
98
99    file->Close();
100    return 0;
101 }
102