From Alexandru
[u/mrichter/AliRoot.git] / EVE / test-macros / tpc_gui_hack.C
CommitLineData
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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
ef2e5239 9
10// Function to spawn a gui for reading rootified raw-data from TPC sector test.
11
12#ifdef __CINT__
13
14class AliRawReaderRoot;
15
d810d0de 16class AliEveTPCData;
17class AliEveTPCSector2D;
18class AliEveTPCSector3D;
ef2e5239 19
20#else
21
84aff7a4 22#include <TEve.h>
23#include <TEveManager.h>
cb4245bb 24#include <EveDet/AliEveTPCData.h>
25#include <EveDet/AliEveTPCSector2D.h>
26#include <EveDet/AliEveTPCSector3D.h>
ef2e5239 27
28#include <RAW/AliRawReaderRoot.h>
29#include <TPC/AliTPCRawStream.h>
30
31#include <TSystem.h>
32#include <TStyle.h>
33
34#endif
35
36
d810d0de 37AliEveTPCSectorData* su = 0;
38AliEveTPCSectorData* sl = 0;
ef2e5239 39
d810d0de 40AliEveTPCLoader* loader = 0;
ef2e5239 41
42void tpc_gui_hack(const char *file=0, Int_t ievent=0)
43{
44 gStyle->SetPalette(1, 0);
45
d810d0de 46 AliEveTPCLoader* l = new AliEveTPCLoader; loader = l;
47 AliEveTPCData* d = new AliEveTPCData;
ef2e5239 48 // d->SetLoadPedestal(5);
49 d->SetLoadThreshold(5);
50 d->SetAutoPedestal(kTRUE);
51 l->SetData(d);
52 l->SetDoubleSR(kTRUE);
53 l->SetInitParams(50, 980, 15);
7ffb2ef3 54 // l->SetTPCEquipementMap("EquipmentIdMap.data");
ef2e5239 55
56 su = d->GetSectorData( 4, kTRUE);
57 sl = d->GetSectorData(13, kTRUE);
58
84aff7a4 59 gEve->AddElement(l);
60 gEve->NotifyBrowser(l);
61 gEve->DrawElement(l);
ef2e5239 62
63 if(file != 0) {
64 l->SetFile(file);
65 l->OpenFile();
66 l->GotoEvent(ievent);
67 }
68}
69
d810d0de 70void disable_pad(Int_t row, Int_t pad, AliEveTPCSectorData* sd,
ef2e5239 71 Int_t thrExt=10, Float_t thrFac=2)
72{
d810d0de 73 if(row < 0 || row >= AliEveTPCSectorData::GetNAllRows())
ef2e5239 74 { printf("row off, %d\n", row); return; }
75
d810d0de 76 Int_t npads = AliEveTPCSectorData::GetNPadsInRow(row);
ef2e5239 77 if(pad < 0) pad = npads + pad;
78 if(pad < 0 || pad >= npads) { printf("pad off\n"); return; }
79
80 sd->AddPadRowHack(row, pad, thrExt, thrFac);
81}
82
83void disable_std()
84{
85 // The noisy pads in lower inner seg, left edge
86 disable_pad(30, 1, sl, 200, 5);
87 disable_pad(30, 2, sl, 200, 5);
88 disable_pad(31, 1, sl, 200, 5);
89
90 // The noisy pads in lower inner seg, middle
91 disable_pad(31, 44, sl);
92 disable_pad(31, 43, sl);
93 disable_pad(30, 43, sl);
94
95 for(Int_t r=16; r<32; ++r) {
96 disable_pad(r, 0, su, 20, 3);
97 disable_pad(r, 1, su, 20, 3);
98 disable_pad(r, 2, su, 20, 3);
99 disable_pad(r, 3, su, 20, 3);
100 disable_pad(r, 4, su, 20, 3);
101 }
102
103 { // Top 12, 4 pads on the negative side.
d810d0de 104 AliEveTPCSectorData::SegmentInfo& o1si = AliEveTPCSectorData::GetOut1Seg();
ef2e5239 105 Int_t last = o1si.GetLastRow();
106 for(Int_t r=last - 11; r<=last; ++r) {
107 disable_pad(r, -1, su, 20, 4);
108 disable_pad(r, -2, su, 10, 3);
109 disable_pad(r, -3, su, 10, 3);
110 disable_pad(r, -4, su, 5, 2.5);
111 disable_pad(r, -5, su, 5, 2.5);
112 disable_pad(r, 0, su, 5, 2.5);
113 disable_pad(r, 1, su, 20, 4);
114 disable_pad(r, 2, su, 10, 3);
115 disable_pad(r, 3, su, 10, 3);
116 disable_pad(r, 4, su, 5, 2.5);
117
118 disable_pad(r, -1, sl, 20, 4);
119 disable_pad(r, -2, sl, 10, 3);
120 disable_pad(r, -3, sl, 10, 3);
121 disable_pad(r, -4, sl, 5, 2.5);
122 disable_pad(r, -5, sl, 5, 2.5);
123 }
124
125 disable_pad(last-8, -4, sl, 5, 2.5);
126
127 disable_pad(last-9, -2, sl, 5, 2);
128 disable_pad(last-9, -3, sl, 5, 2.5);
129 disable_pad(last-9, -4, sl, 5, 2.5);
130 disable_pad(last-9, -5, sl, 5, 2.5);
131 disable_pad(last-8, -5, sl, 5, 2.5);
132 }
133
134 {
d810d0de 135 AliEveTPCSectorData::SegmentInfo& o2si = AliEveTPCSectorData::GetOut2Seg();
ef2e5239 136 Int_t first = o2si.GetFirstRow();
137 Int_t last = o2si.GetLastRow();
138
139 for(Int_t r=first; r<=last; ++r) {
140 disable_pad(r, -1, su, 30, 3.5);
141 disable_pad(r, -2, su, 25, 3);
142 disable_pad(r, -3, su, 20, 3);
143 disable_pad(r, 0, su, 30, 3.5);
144 disable_pad(r, 1, su, 25, 3);
145
146 disable_pad(r, 0, sl, 30, 3.5);
147 disable_pad(r, 1, sl, 25, 3);
148 disable_pad(r, 2, sl, 20, 3);
149 disable_pad(r, 3, sl, 20, 3);
150 disable_pad(r, 4, sl, 20, 3);
151 disable_pad(r, 5, sl, 20, 3);
152 disable_pad(r, -1, sl, 30, 3.5);
153 disable_pad(r, -2, sl, 25, 3);
154 disable_pad(r, -3, sl, 25, 3);
155 disable_pad(r, -4, sl, 25, 3);
156 disable_pad(r, -5, sl, 25, 3);
157 }
158
159 for(Int_t pad=3; pad<30; ++pad) {
160 disable_pad(last, -pad-1, sl, 20, 3);
161 disable_pad(last, pad, su, 20, 3);
162 }
163 for(Int_t pad=3; pad<15; ++pad) {
164 disable_pad(last-1, -pad-1, sl, 20, 3);
165 disable_pad(last-2, -pad-1, sl, 20, 3);
166 }
167 disable_pad(last, 2, su, 20, 3);
168 }
169
170 loader->LoadEvent(); loader->UpdateSectors();
171}