]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
092578a7 | 9 | |
10 | // Functions to read rootified raw-data from TPC sector test. | |
11 | // | |
12 | // Use tpc_sector_raw_test("filename.root") for initialization, | |
13 | // next_event() to advance along the data stream. | |
14 | // When there is no more data ROOT will crash. | |
15 | ||
16 | class AliRawReaderRoot; | |
17 | ||
18 | namespace Alieve { | |
d810d0de | 19 | class AliEveTPCData; |
20 | class AliEveTPCSector2D; | |
21 | class AliEveTPCSector3D; | |
092578a7 | 22 | } |
23 | ||
092578a7 | 24 | |
d810d0de | 25 | AliEveTPCData* x = 0; |
26 | AliEveTPCSector2D* s = 0; | |
27 | AliEveTPCSector3D* t = 0; | |
092578a7 | 28 | |
5987168b | 29 | AliRawReaderRoot* reader = 0; |
092578a7 | 30 | Int_t event = -1; |
5987168b | 31 | Int_t default_sector = 13; |
092578a7 | 32 | |
33 | void tpc_sector_raw_test(const char *file = "", Int_t ievent = 0) | |
34 | { | |
092578a7 | 35 | gStyle->SetPalette(1, 0); |
36 | ||
37 | reader = new AliRawReaderRoot(file); | |
217e7091 | 38 | //reader->LoadEquipmentIdsMap |
39 | // (gSystem->ExpandPathName("$(ALICE_ROOT)/TPC/mapping/EquipmentIdMap.data")); | |
40 | // (gSystem->ExpandPathName("EquipmentIdMap.data")); | |
7ffb2ef3 | 41 | |
092578a7 | 42 | reader->Reset(); |
5987168b | 43 | for(Int_t i=0; i<ievent; ++i, ++event) { |
44 | if(reader->NextEvent() == kFALSE) { | |
45 | printf("End of raw stream at event %d (reqired event %d).\n", i, ievent); | |
46 | return; | |
47 | } | |
48 | } | |
092578a7 | 49 | |
d810d0de | 50 | x = new AliEveTPCData; |
5987168b | 51 | // x->SetLoadPedestal(5); |
092578a7 | 52 | x->SetLoadThreshold(5); |
53 | x->SetAutoPedestal(kTRUE); | |
54 | ||
d810d0de | 55 | s = new AliEveTPCSector2D(); |
5987168b | 56 | s->SetSectorID(default_sector); |
601bca51 | 57 | s->SetAutoTrans(kTRUE); // place on proper 3D coordinates |
092578a7 | 58 | s->SetDataSource(x); |
59 | s->SetFrameColor(36); | |
84aff7a4 | 60 | gEve->AddElement(s); |
61 | gEve->DrawElement(s); | |
092578a7 | 62 | |
d810d0de | 63 | t = new AliEveTPCSector3D(); |
5987168b | 64 | t->SetSectorID(default_sector); |
601bca51 | 65 | t->SetAutoTrans(kTRUE); |
092578a7 | 66 | t->SetDataSource(x); |
67 | t->SetMaxTime(1023); | |
68 | t->SetDriftVel(2.273); | |
84aff7a4 | 69 | gEve->AddElement(t); |
70 | gEve->DrawElement(t); | |
092578a7 | 71 | |
72 | next_event(); | |
73 | } | |
74 | ||
75 | void next_event() | |
76 | { | |
5987168b | 77 | if(reader->NextEvent() == kTRUE) { |
78 | ++event; | |
79 | } else { | |
80 | printf("Reached end of stream, rewinding to first event.\n"); | |
81 | event = 0; | |
82 | reader->RewindEvents(); | |
83 | reader->NextEvent(); | |
84 | } | |
092578a7 | 85 | |
86 | printf("Now loading event %d\n", event); | |
5987168b | 87 | reader->Reset(); |
88 | AliTPCRawStream input(reader); | |
89 | input.SetOldRCUFormat(kTRUE); | |
217e7091 | 90 | reader->Select("TPC"); // ("TPC", firstRCU, lastRCU); |
5987168b | 91 | |
92 | x->DropAllSectors(); | |
092578a7 | 93 | x->LoadRaw(input, kTRUE, kTRUE); |
94 | ||
95 | printf("Updating scene\n"); | |
96 | s->IncRTS(); | |
97 | t->IncRTS(); | |
84aff7a4 | 98 | gEve->Redraw3D(); |
092578a7 | 99 | } |
100 | ||
101 | void tpc_raw_pad_dump(Int_t s, Int_t r, Int_t p) | |
102 | { | |
d810d0de | 103 | if(r >= AliEveTPCSectorData::GetInnSeg().GetNRows()) { |
104 | r -= AliEveTPCSectorData::GetInnSeg().GetNRows(); | |
092578a7 | 105 | s += 36; |
106 | } | |
107 | ||
5987168b | 108 | reader->Reset(); |
109 | AliTPCRawStream input(reader); | |
110 | input.SetOldRCUFormat(kTRUE); | |
111 | // reader->Select(0, firstRCU, lastRCU); | |
092578a7 | 112 | |
113 | Int_t sector = input.GetSector(); | |
114 | Int_t row = input.GetRow(); | |
115 | ||
116 | while (input.Next()) { | |
117 | if (input.IsNewRow()) { | |
118 | sector = input.GetSector(); | |
119 | row = input.GetRow(); | |
120 | } | |
121 | if(sector != s || row != r) continue; | |
122 | ||
123 | Int_t signal = input.GetSignal(); | |
124 | Int_t pad = input.GetPad(); | |
125 | Int_t time = input.GetTime(); | |
126 | ||
127 | if(pad == p) | |
128 | printf("%d %d\n", time, signal); | |
129 | } | |
130 | } |