Support for automatic pedestal estimation per pad (Marian and Matevz).
[u/mrichter/AliRoot.git] / EVE / test-macros / tpc_sector_raw_test.C
1 class AliRawReaderRoot;
2
3 namespace Alieve {
4 class TPCData;
5 }
6
7 Alieve::TPCData*  x = 0;
8 AliRawReaderRoot* reader = 0;
9
10 void tpc_sector_raw_test(const char *file = "",Int_t ievent = 0)
11 {
12   gROOT->Macro("alieve_loadlibs.C");
13   gSystem->Load("libAlieve");
14
15   reader = new AliRawReaderRoot(file);
16   reader->RequireHeader(kFALSE);
17   reader->Reset();
18   for(Int_t i = 0; i <= ievent; i++)
19     reader->NextEvent();
20   AliTPCRawStreamOld input(reader);
21   reader->SelectEquipment(-1);
22
23   x = new Alieve::TPCData;
24   //x->SetSectorBlockSize(8192);
25   x->SetAutoPedestal(kTRUE);
26   x->SetLoadThreshold(3);
27   //x->CreateAllSectors();
28   x->LoadRaw(input, kTRUE);
29
30   gStyle->SetPalette(1, 0);
31
32   Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
33   s->SetDataSource(x);
34   s->SetMainColor(36);
35   gReve->AddRenderElement(s);
36   gReve->DrawRenderElement(s);
37
38 }
39
40 void tpc_raw_pad_dump(Int_t s, Int_t r, Int_t p)
41 {
42   reader->Reset();
43   reader->NextEvent();
44
45   if(r >= Alieve::TPCSectorData::GetInnSeg().fNRows) {
46     r -= Alieve::TPCSectorData::GetInnSeg().fNRows;
47     s += 36;
48   }
49
50   AliTPCRawStream input(reader);
51   Int_t sector = input.GetSector();
52   Int_t row    = input.GetRow();
53
54   while (input.Next()) {
55     if (input.IsNewRow()) {
56       sector = input.GetSector();
57       row    = input.GetRow();
58     }
59     if(sector != s || row != r) continue;
60
61     Int_t signal = input.GetSignal();
62     Int_t pad    = input.GetPad();
63     Int_t time   = input.GetTime();
64
65     if(pad == p)
66       printf("%d %d\n", time, signal);
67   }
68 }