092578a7 |
1 | // $Header$ |
2 | |
3 | // Functions to read rootified raw-data from TPC sector test. |
4 | // |
5 | // Use tpc_sector_raw_test("filename.root") for initialization, |
6 | // next_event() to advance along the data stream. |
7 | // When there is no more data ROOT will crash. |
8 | |
9 | class AliRawReaderRoot; |
10 | |
11 | namespace Alieve { |
12 | class TPCData; |
13 | class TPCSector2D; |
14 | class TPCSector3D; |
15 | } |
16 | |
17 | using namespace Alieve; |
18 | |
19 | TPCData* x = 0; |
20 | TPCSector2D* s = 0; |
21 | TPCSector3D* t = 0; |
22 | |
23 | AliRawReaderRoot* reader = 0; |
24 | Int_t event = -1; |
25 | |
26 | void tpc_sector_raw_test(const char *file = "", Int_t ievent = 0) |
27 | { |
28 | // gROOT->Macro("alieve_loadlibs.C"); |
29 | // Only sub-set of ALICE libraries is needed: |
30 | gSystem->Load("libESD"); |
31 | gSystem->Load("libSTEER"); |
32 | gSystem->Load("libRAWData"); |
33 | gSystem->Load("libTPCbase"); |
34 | gSystem->Load("libTPCrec"); |
35 | gSystem->Load("libTPCsim"); |
36 | // ALICE visualization |
37 | gSystem->Load("libAlieve"); |
38 | |
39 | gStyle->SetPalette(1, 0); |
40 | |
41 | reader = new AliRawReaderRoot(file); |
42 | reader->RequireHeader(kFALSE); |
43 | reader->Reset(); |
44 | for(Int_t i=0; i<ievent; ++i, ++event) |
45 | reader->NextEvennt(); |
46 | |
47 | x = new TPCData; |
48 | //x->SetLoadPedestal(5); |
49 | x->SetLoadThreshold(5); |
50 | x->SetAutoPedestal(kTRUE); |
51 | |
52 | s = new TPCSector2D(); |
53 | // s->SetSectorID(0); // 0 is default |
54 | // s->SetTrans(kTRUE); // place on proper 3D coordinates |
55 | s->SetDataSource(x); |
56 | s->SetFrameColor(36); |
57 | gReve->AddRenderElement(s); |
58 | gReve->DrawRenderElement(s); |
59 | |
60 | t = new TPCSector3D(); |
61 | // t->SetSectorID(0); |
62 | // t->SetTrans(kTRUE); |
63 | t->SetDataSource(x); |
64 | t->SetMaxTime(1023); |
65 | t->SetDriftVel(2.273); |
66 | gReve->AddRenderElement(t); |
67 | gReve->DrawRenderElement(t); |
68 | |
69 | next_event(); |
70 | } |
71 | |
72 | void next_event() |
73 | { |
74 | reader->NextEvent(); |
75 | ++event; |
76 | |
77 | printf("Now loading event %d\n", event); |
78 | AliTPCRawStreamOld input(reader); |
79 | reader->SelectEquipment(-1); |
80 | x->LoadRaw(input, kTRUE, kTRUE); |
81 | |
82 | printf("Updating scene\n"); |
83 | s->IncRTS(); |
84 | t->IncRTS(); |
85 | gReve->Redraw3D(); |
86 | } |
87 | |
88 | void tpc_raw_pad_dump(Int_t s, Int_t r, Int_t p) |
89 | { |
90 | reader->Reset(); |
91 | reader->NextEvent(); |
92 | |
93 | if(r >= TPCSectorData::GetInnSeg().GetNRows()) { |
94 | r -= TPCSectorData::GetInnSeg().GetNRows(); |
95 | s += 36; |
96 | } |
97 | |
98 | // AliTPCRawStream input(reader); |
99 | AliTPCRawStreamOld input(reader); |
100 | reader->SelectEquipment(-1); |
101 | |
102 | Int_t sector = input.GetSector(); |
103 | Int_t row = input.GetRow(); |
104 | |
105 | while (input.Next()) { |
106 | if (input.IsNewRow()) { |
107 | sector = input.GetSector(); |
108 | row = input.GetRow(); |
109 | } |
110 | if(sector != s || row != r) continue; |
111 | |
112 | Int_t signal = input.GetSignal(); |
113 | Int_t pad = input.GetPad(); |
114 | Int_t time = input.GetTime(); |
115 | |
116 | if(pad == p) |
117 | printf("%d %d\n", time, signal); |
118 | } |
119 | } |