3 // Author: Mateusz Ploskon
5 void showLegend(TH1F *h, TH1F *h2)
7 TLegend * leg = new TLegend(0, 0, 0.2, 0.2);
8 leg->AddEntry(h, h->GetTitle(), "LBF");
9 leg->AddEntry(h2, h2->GetTitle(), "LBF");
13 void AliTRDtestDigitsRW(Int_t thresh = 0, Int_t maxDet = 540)
15 AliCDBManager *cdb = AliCDBManager::Instance();
16 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
20 TFile *finD = TFile::Open("TRD.Digits.root");
21 TTree *treeD = (TTree*)finD->Get("Event0/TreeD");
23 AliTRDdigitsManager manD;
24 manD.ReadDigits(treeD);
26 AliTRDdigitsManager manR;
29 AliRawReaderRoot reader("raw.root", 0);
31 AliTRDRawStreamV2 stream(&reader);
32 stream.SetRawVersion(3);
35 while (stream.NextChamber(&manR) >= 0)
38 cout << "Chambers loaded - stream V2 " << ichambers << endl;
40 TH1F *hsignalD = new TH1F("hsignalD", "hsignalD - stream D", 1000, 0, 1000);
41 hsignalD->SetFillColor(32);
42 hsignalD->SetFillStyle(1001);
43 TH1F *hsignalR = new TH1F("hsignalR", "hsignalR - stream V2", 1000, 0, 1000);
44 hsignalR->SetLineWidth(2);
45 hsignalR->SetLineColor(kRed);
47 TH1F *htbinD = new TH1F("htbinD", "htbinD - stream D", 30, 0, 30);
48 htbinD->SetFillColor(32);
49 htbinD->SetFillStyle(1001);
50 TH1F *htbinR = new TH1F("htbinR", "htbinR - stream V2", 30, 0, 30);
51 htbinR->SetLineWidth(2);
52 htbinR->SetLineColor(kRed);
54 TH1F *hdetD = new TH1F("hdetD", "hdetD - stream D", 540, 0, 540);
55 hdetD->SetFillColor(32);
56 hdetD->SetFillStyle(1001);
57 TH1F *hdetR = new TH1F("hdetR", "hdetR - stream V2", 540, 0, 540);
58 hdetR->SetLineWidth(2);
59 hdetR->SetLineColor(kRed);
61 TH2F *h2D = new TH2F("h2D", "h2D - stream D", 16, 0, 16, 144, 0, 144 );
62 TH2F *h2R = new TH2F("h2R", "h2R - stream V2", 16, 0, 16, 144, 0, 144 );
64 TH2F *h2Drct[16]; // 1 for each row
65 TH2F *h2Rrct[16]; // 1 for each row
66 for (Int_t ir = 0; ir < 16; ir++)
70 sprintf(cname, "h2Drct_%d", ir);
71 sprintf(ctitle, "D Row %d;col;tbin;value", ir);
72 h2Drct[ir] = new TH2F(cname, ctitle, 144, 0, 144, 30, 0, 30);
74 sprintf(cname, "h2Rrct_%d", ir);
75 sprintf(ctitle, "R Row %d;col;tbin;value", ir);
76 h2Rrct[ir] = new TH2F(cname, ctitle, 144, 0, 144, 30, 0, 30);
79 for (Int_t idet = 0; idet < maxDet; idet++)
81 digitsD = manD.GetDigits(idet);
83 digitsR = manR.GetDigits(idet);
85 Int_t rowMax = digitsD->GetNrow();
86 Int_t colMax = digitsD->GetNcol();
87 Int_t timeMax = digitsD->GetNtime();
89 //cout << "\r Detector " << idet << endl;
90 cout << "\r Detector " << idet; cout.flush();
92 for (Int_t irow = 0; irow < rowMax; irow++)
94 for (Int_t icol = 0; icol < colMax; icol++)
96 for (Int_t itime = 0; itime < timeMax; itime++)
98 Int_t ivalD = digitsD->GetDataUnchecked(irow, icol, itime);
99 Int_t ivalR = digitsR->GetDataUnchecked(irow, icol, itime);
101 //if (ivalD > thresh && ivalR > thresh)
104 hsignalD->Fill(ivalD);
105 htbinD->Fill(itime, ivalD);
106 hdetD->Fill(idet, ivalD);
107 h2D->Fill(irow, icol, ivalD);
108 h2Drct[irow]->Fill(icol, itime, ivalD);
111 hsignalR->Fill(ivalR);
112 htbinR->Fill(itime, ivalR);
113 hdetR->Fill(idet, ivalR);
114 h2R->Fill(irow, icol, ivalR);
115 h2Rrct[irow]->Fill(icol, itime, ivalR);
120 digitsD->Compress(1,0);
125 gStyle->SetPalette(1);
127 TCanvas *tc = new TCanvas("tc_d", "tc_d");
131 hsignalD->Draw("same");
132 hsignalR->Draw("same");
134 showLegend(hsignalR, hsignalD);
138 htbinD->Draw("same");
139 htbinR->Draw("same");
153 TCanvas *tc1 = new TCanvas("tc_d_rct_1", "tc_d_rct_1");
156 TCanvas *tc2 = new TCanvas("tc_d_rct_2", "tc_d_rct_2");
158 for (Int_t ir = 0; ir < 16; ir++)
163 h2Drct[ir]->Draw("colz");
165 h2Rrct[ir]->Draw("colz");
169 tc2->cd((ir-8)*2 + 1);
170 h2Drct[ir]->Draw("colz");
171 tc2->cd((ir-8)*2 + 2);
172 h2Rrct[ir]->Draw("colz");
176 //TCanvas *tc = new TCanvas("tc_d_rct", "tc_d_rct");
179 // for (Int_t ir = 0; ir < 16; ir++)
182 // h2Drct[ir]->Draw("colz");
185 // h2Rrct[ir]->Draw("colz");
190 ///---------------------------------------------------------------
191 void testDigits2streams()
193 AliCDBManager *cdb = AliCDBManager::Instance();
194 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
196 //AliCDBStorage* localStorage = cdb->GetStorage("local://$ALICE_ROOT/OCDB");
197 // cout << "[I] Is storage set : " << cdb->IsDefaultStorageSet() << endl;
200 // TFile *finD = TFile::Open("TRD.Digits.root");
201 // TTree *treeD = (TTree*)finD->Get("Event0/TreeD");
203 // AliTRDdigitsManager manD;
204 // manD.ReadDigits(treeD);
207 AliTRDdigitsManager manD;
210 AliRawReaderRoot reader1("raw.root", 0);
211 reader1.Select("TRD");
212 AliTRDRawStream stream1(&reader1);
213 stream1.SetRawVersion(2);
216 while (stream1.NextChamber(&manD) >= 0)
219 cout << "Chambers loaded - stream V1" << ichambers << endl;
222 AliTRDdigitsManager manR;
225 AliRawReaderRoot reader("raw.root", 0);
226 reader.Select("TRD");
227 AliTRDRawStreamV2 stream(&reader);
228 stream.SetRawVersion(2);
231 while (stream.NextChamber(&manR) >= 0)
234 cout << "Chambers loaded - stream V2" << ichambers << endl;
236 AliTRDdataArrayI *digitsD = 0;
237 AliTRDdataArrayI *digitsR = 0;
239 TH1F *hsignalD = new TH1F("hsignalD", "hsignalD - stream V1", 1000, 0, 1000);
240 hsignalD->SetFillColor(32);
241 hsignalD->SetFillStyle(1001);
242 TH1F *hsignalR = new TH1F("hsignalR", "hsignalR - stream V2", 1000, 0, 1000);
243 hsignalR->SetLineWidth(2);
244 hsignalR->SetLineColor(kRed);
246 TH1F *htbinD = new TH1F("htbinD", "htbinD - stream V1", 30, 0, 30);
247 htbinD->SetFillColor(32);
248 htbinD->SetFillStyle(1001);
249 TH1F *htbinR = new TH1F("htbinR", "htbinR - stream V2", 30, 0, 30);
250 htbinR->SetLineWidth(2);
251 htbinR->SetLineColor(kRed);
253 TH2F *h2D = new TH2F("h2D", "h2D - stream V1", 16, 0, 16, 144, 0, 144 );
254 TH2F *h2R = new TH2F("h2R", "h2R - stream V2", 16, 0, 16, 144, 0, 144 );
256 //for (Int_t idet = 0; idet < 540; idet++)
257 for (Int_t idet = 0; idet < 10; idet++)
258 //for (Int_t idet = 0; idet < 10; idet++)
260 digitsD = manD.GetDigits(idet);
262 digitsR = manR.GetDigits(idet);
264 Int_t rowMax = digitsD->GetNrow();
265 Int_t colMax = digitsD->GetNcol();
266 Int_t timeMax = digitsD->GetNtime();
268 //cout << "\r Detector " << idet << endl;
269 cout << "\r Detector " << idet; cout.flush();
271 for (Int_t irow = 0; irow < rowMax; irow++)
273 for (Int_t icol = 0; icol < colMax; icol++)
275 for (Int_t itime = 0; itime < timeMax; itime++)
277 Int_t ivalD = digitsD->GetDataUnchecked(irow, icol, itime);
278 Int_t ivalR = digitsR->GetDataUnchecked(irow, icol, itime);
280 hsignalD->Fill(ivalD);
281 hsignalR->Fill(ivalR);
283 htbinD->Fill(itime, ivalD);
284 htbinR->Fill(itime, ivalR);
286 h2D->Fill(irow, icol, ivalD);
287 h2R->Fill(irow, icol, ivalR);
293 digitsD->Compress(1,0);
298 gStyle->SetPalette(1);
300 TCanvas *tc = new TCanvas("tc", "tc");
304 hsignalD->Draw("same");
305 hsignalR->Draw("same");
307 showLegend(hsignalR, hsignalD);
311 htbinD->Draw("same");
312 htbinR->Draw("same");
321 ///---------------------------------------------------------------
324 AliCDBManager *cdb = AliCDBManager::Instance();
325 cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
327 //AliCDBStorage* localStorage = cdb->GetStorage("local://$ALICE_ROOT/OCDB");
328 // cout << "[I] Is storage set : " << cdb->IsDefaultStorageSet() << endl;
331 TFile *finD = TFile::Open("TRD.Digits.root");
332 TTree *treeD = (TTree*)finD->Get("Event0/TreeD");
334 AliTRDdigitsManager manD;
336 manD.ReadDigits(treeD);
338 AliTRDdataArrayI *digitsD = 0;
340 for (Int_t idet = 0; idet < 540; idet++)
342 digitsD = manD.GetDigits(idet);
345 Int_t rowMax = digitsD->GetNrow();
346 Int_t colMax = digitsD->GetNcol();
347 Int_t timeMax = digitsD->GetNtime();
349 cout << "Detector " << idet << " nrows " << rowMax << endl;
351 for (Int_t irow = 0; irow < rowMax; irow++)
353 for (Int_t icol = 0; icol < colMax; icol++)
355 for (Int_t itime = 0; itime < timeMax; itime++)
357 Int_t ivalD = digitsD->GetDataUnchecked(irow, icol, itime);
358 cout << Form("det %d rct %d %d %d valD=%d", idet, irow, icol, itime, ivalD) << endl;
363 digitsD->Compress(1,0);