]>
Commit | Line | Data |
---|---|---|
6e9ab565 | 1 | #ifndef __CINT__ |
2 | #include "alles.h" | |
3 | #include "AliTPCtracker.h" | |
4 | #include "TView.h" | |
5 | #include "TPolyMarker3D.h" | |
6 | #include "AliSimDigits.h" | |
7a09f434 | 7 | #include "AliTPCParamSR.h" |
6e9ab565 | 8 | #endif |
9 | ||
10 | // | |
11 | // display 3D digits | |
12 | // input parameter is event number - threshol to the noise | |
13 | // if sdigits=kTRUE it will display Sdigits - otherwise it display digits | |
14 | // signal event is displayed with yellow color | |
15 | ||
16 | Int_t AliTPCDisplayDigits3D(Int_t eventn=0, Int_t noiseth=15, Bool_t sdigits=kFALSE) { | |
17 | cerr<<"Displaying digits...\n"; | |
18 | ||
19 | TFile *file=TFile::Open("galice.root"); | |
20 | if (!file->IsOpen()) {cerr<<"Can't open galice.root !\n"; return 1;} | |
21 | ||
22 | TFile *cf=TFile::Open("galice.root"); | |
23 | // if (!cf->IsOpen()){cerr<<"Can't open AliTPCclusters.root !\n"; return 3;} | |
24 | ||
7a09f434 | 25 | AliTPCParamSR *param=(AliTPCParamSR *)cf->Get("75x40_100x60"); |
26 | if(param){ | |
27 | cerr<<"2 pad-length geom hits with 3 pad-lengths geom parameters\n"; | |
28 | delete param; | |
29 | param = new AliTPCParamSR(); | |
30 | } | |
31 | else | |
32 | { | |
33 | param=(AliTPCParamSR *)gDirectory->Get("75x40_100x60_150x60"); | |
34 | } | |
35 | ||
6e9ab565 | 36 | if (!param) {cerr<<"TPC parameters have not been found !\n"; return 2;} |
37 | ||
38 | TCanvas *c1=new TCanvas("ddisplay", "Digits display",0,0,700,730); | |
39 | TView *v=new TView(1); | |
40 | v->SetRange(-430,-560,-430,430,560,1710); | |
41 | c1->Clear(); | |
42 | c1->SetFillColor(1); | |
43 | c1->SetTheta(90.); | |
44 | c1->SetPhi(0.); | |
45 | ||
46 | AliTPCDigitsArray *digarr=new AliTPCDigitsArray; | |
47 | digarr->Setup(param); | |
48 | ||
49 | char cname[100]; | |
50 | if (!sdigits) | |
7a09f434 | 51 | sprintf(cname,"TreeD_75x40_100x60_150x60_%d",eventn); |
6e9ab565 | 52 | else |
7a09f434 | 53 | sprintf(cname,"TreeS_75x40_100x60_150x60_%d",eventn); |
6e9ab565 | 54 | |
55 | // some "constants" | |
56 | Int_t markerColorSignal = 5; | |
57 | Int_t markerColorBgr = 2; | |
58 | Int_t MASK = 10000000; | |
59 | ||
60 | digarr->ConnectTree(cname); | |
61 | Int_t nrows=Int_t(digarr->GetTree()->GetEntries()); | |
62 | Int_t all0=0; | |
63 | for (Int_t n=0; n<nrows; n++) { | |
64 | AliSimDigits *s=(AliSimDigits*)digarr->LoadEntry(n); | |
65 | Int_t sec,row; | |
66 | param->AdjustSectorRow(s->GetID(),sec,row); | |
67 | Int_t npads, sign; | |
68 | { | |
69 | const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); | |
70 | if (sec < kNIS) { | |
71 | npads = param->GetNPadsLow(row); | |
72 | sign = (sec < kNIS/2) ? 1 : -1; | |
73 | } else { | |
74 | npads = param->GetNPadsUp(row); | |
75 | sign = ((sec-kNIS) < kNOS/2) ? 1 : -1; | |
76 | } | |
77 | } | |
78 | ||
79 | AliSimDigits *digrow = (AliSimDigits*)digarr->GetRow(sec,row); | |
80 | Int_t ncl=0; | |
81 | if (digrow->First()){ | |
82 | while(digrow->Next()) ncl++; | |
83 | ncl++; | |
84 | } | |
85 | TPolyMarker3D *pm=new TPolyMarker3D(ncl); | |
86 | TPolyMarker3D *pmSignal=new TPolyMarker3D(ncl); // polymarker for signal | |
87 | Int_t imarBgr=0; | |
88 | Int_t imarSignal=0; | |
89 | if (digrow->First()) do { | |
90 | Short_t dig=digrow->CurrentDigit(); | |
91 | Double_t y = (digrow->CurrentColumn()- 0.5 - 0.5*npads)*param->GetPadPitchWidth(sec); | |
92 | Double_t z = sign*(param->GetZLength()-param->GetZWidth()*digrow->CurrentRow()); | |
93 | Double_t x=param->GetPadRowRadii(sec,row); | |
94 | if (dig<noiseth) continue; | |
95 | Int_t trackId = digrow->GetTrackID(digrow->CurrentRow(),digrow->CurrentColumn(),0); | |
96 | Float_t cs, sn, tmp; | |
97 | param->AdjustCosSin(sec,cs,sn); | |
98 | tmp = x*cs-y*sn; y= x*sn+y*cs; x=tmp; | |
99 | if (trackId<0) continue; //if signal from croostalk - we don't have track ID information | |
100 | if (trackId < MASK-1) { | |
101 | pmSignal->SetPoint(imarSignal,x,y,z); | |
102 | imarSignal++; | |
103 | } else { | |
104 | pm->SetPoint(imarBgr,x,y,z); | |
105 | imarBgr++; | |
106 | } | |
107 | } while (digrow->Next()); | |
108 | ||
109 | // change color for signal | |
110 | digarr->ClearRow(sec,row); | |
111 | pm->SetMarkerSize(1); | |
112 | pm->SetMarkerColor(markerColorBgr); | |
113 | pm->SetMarkerStyle(1); | |
114 | pm->Draw(); | |
115 | ||
116 | pmSignal->SetMarkerSize(1); | |
117 | pmSignal->SetMarkerColor(markerColorSignal); | |
118 | pmSignal->SetMarkerStyle(1); | |
119 | pmSignal->Draw(); | |
120 | all0+=imarSignal; | |
121 | } | |
122 | printf("%d\n",all0); | |
123 | ||
124 | ||
125 | delete digarr; | |
126 | cf->Close(); | |
127 | //draw TPC skeleton | |
128 | TGeometry *geom=(TGeometry*)file->Get("AliceGeom"); | |
129 | TNode * main = (TNode*)((geom->GetListOfNodes())->First()); | |
130 | TIter next(main->GetListOfNodes()); | |
131 | TNode *module=0; | |
132 | while((module = (TNode*)next())) { | |
133 | char ch[100]; | |
134 | sprintf(ch,"%s\n",module->GetTitle()); | |
135 | //printf("%s\n",module->GetTitle()); | |
136 | if (ch[0]=='T'&&ch[1]=='P' && ch[2]=='C') //if TPC draw | |
137 | module->SetVisibility(3); | |
138 | else | |
139 | module->SetVisibility(-1); | |
140 | } | |
141 | ||
142 | ||
143 | geom->Draw("same"); | |
144 | //v->Draw(); | |
145 | c1->Modified(); c1->Update(); | |
146 | ||
147 | file->Close(); | |
148 | return 0; | |
149 | } | |
150 |