]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/icepack/macros/icetest.cc
History file of Wa98 updated and subdirectory icepack introduced.
[u/mrichter/AliRoot.git] / RALICE / icepack / macros / icetest.cc
1 //////////////////////////////////////////////////////////////////////////
2 // ROOT macro to show the functionality of data handling in IcePack.
3 // To run this ROOT macro in batch mode and get the output in a file
4 // test.log, just type the following at the regular command prompt ($)
5 //
6 // $ root -b -q icetest.cc >test.log 
7 //
8 // Interactive execution of this macro can be achieved by
9 // the following command after starting a ROOT session
10 // 
11 // $ root> .x icetest.cc
12 //  
13 // The commented-out lines at the end of the macro show how
14 // to obtain a 3D event view of the stored data.
15 // Obviously such an event display can only be invoked by
16 // executing this test macro in interactive mode.
17 //
18 // NvE 01-dec-2004 Utrecht University
19 //////////////////////////////////////////////////////////////////////////
20 {
21  gSystem->Load("ralice");
22  gSystem->Load("icepack");
23  
24  IceEvent* evt=new IceEvent();
25  evt->SetOwner();
26
27  // Amanda module
28  IceAOM m;
29  m.SetUniqueID(123);
30  m.SetNameTitle("OM123","Amanda module");
31
32  Float_t pos[3]={1,2,3};
33  m.SetPosition(pos,"car");
34
35  // The starting unique signal ID.
36  // It will be increased automatically in this macro
37  // when a new signal is created.
38  Int_t sid=1;
39
40  AliSignal s;
41
42  s.SetSlotName("ADC",1);
43  s.SetSlotName("LE",2);
44  s.SetSlotName("TOT",3);
45
46  s.Reset();
47  s.SetName("OM123 Hit 1");
48  s.SetUniqueID(sid++);
49  s.SetSignal(100,"ADC");
50  s.SetSignal(-100,"LE");
51  s.SetSignal(-1000,"TOT");
52  m.AddHit(s);
53
54  s.Reset();
55  s.SetName("OM123 Hit 2");
56  s.SetUniqueID(sid++);
57  s.SetSignal(110,"ADC");
58  s.SetSignal(-101,"LE");
59  s.SetSignal(1001,"TOT");
60  m.AddHit(s);
61
62  s.Reset();
63  s.SetName("OM123 Hit 3");
64  s.SetUniqueID(sid++);
65  s.SetSignal(120,"ADC");
66  s.SetSignal(-102,"LE");
67  s.SetSignal(-1002,"TOT");
68  m.AddHit(s);
69
70  evt->AddDevice(m);
71
72  m.Reset();
73  m.SetUniqueID(456);
74  m.SetName("OM456");
75
76  pos[0]=-4;
77  pos[1]=-5;
78  pos[2]=-6;
79  m.SetPosition(pos,"car");
80
81  s.Reset();
82  s.SetName("OM456 Hit 1");
83  s.SetUniqueID(sid++);
84  s.SetSignal(20,"ADC");
85  s.SetSignal(-200,"LE");
86  s.SetSignal(-2000,"TOT");
87  m.AddHit(s);
88
89  s.Reset();
90  s.SetName("OM456 Hit 2");
91  s.SetUniqueID(sid++);
92  s.SetSignal(21,"ADC");
93  s.SetSignal(-201,"LE");
94  s.SetSignal(2001,"TOT");
95  m.AddHit(s);
96
97  s.Reset();
98  s.SetName("OM456 Hit 3");
99  s.SetUniqueID(sid++);
100  s.SetSignal(22,"ADC");
101  s.SetSignal(-202,"LE");
102  s.SetSignal(-2002,"TOT");
103  m.AddHit(s);
104
105  // Example of explicit hit selection
106  AliSignal* sx=m.GetIdHit(5);
107  if (sx)
108  {
109   cout << " === Hit selection on UniqueID=5 for OM 456 ===" << endl;
110   sx->Data();
111  }
112
113  evt->AddDevice(m);
114
115  m.Reset();
116  m.SetUniqueID(558);
117  m.SetName("OM558");
118
119  pos[0]=5;
120  pos[1]=5;
121  pos[2]=8;
122  m.SetPosition(pos,"car");
123
124  s.Reset();
125  s.SetName("OM558 Hit 1");
126  s.SetUniqueID(sid++);
127  s.SetSignal(30,"ADC");
128  s.SetSignal(-300,"LE");
129  s.SetSignal(-3000,"TOT");
130  m.AddHit(s);
131
132  s.Reset();
133  s.SetName("OM558 Hit 2");
134  s.SetUniqueID(sid++);
135  s.SetSignal(31,"ADC");
136  s.SetSignal(-301,"LE");
137  s.SetSignal(3001,"TOT");
138  m.AddHit(s);
139
140  s.Reset();
141  s.SetName("OM558 Hit 3");
142  s.SetUniqueID(sid++);
143  s.SetSignal(32,"ADC");
144  s.SetSignal(-302,"LE");
145  s.SetSignal(-3002,"TOT");
146  m.AddHit(s);
147
148  evt->AddDevice(m);
149
150  // IceCube in-ice DOM
151  IceIDOM mid;
152  mid.SetUniqueID(958);
153  mid.SetNameTitle("OM958","IceCube in-ice module");
154
155  pos[0]=9;
156  pos[1]=5;
157  pos[2]=8;
158  mid.SetPosition(pos,"car");
159
160  s.Reset();
161  s.SetName("OM958 Hit 1");
162  s.SetUniqueID(sid++);
163  s.SetSignal(40,"ADC");
164  s.SetSignal(-400,"LE");
165  s.SetSignal(-4000,"TOT");
166  mid.AddHit(s);
167
168  s.Reset();
169  s.SetName("OM958 Hit 2");
170  s.SetUniqueID(sid++);
171  s.SetSignal(41,"ADC");
172  s.SetSignal(-401,"LE");
173  s.SetSignal(4001,"TOT");
174  mid.AddHit(s);
175
176  s.Reset();
177  s.SetName("OM958 Hit 3");
178  s.SetUniqueID(sid++);
179  s.SetSignal(42,"ADC");
180  s.SetSignal(-402,"LE");
181  s.SetSignal(-4002,"TOT");
182  mid.AddHit(s);
183
184  evt->AddDevice(mid);
185
186  // IceTop DOM
187  IceTDOM mtd;
188  mtd.SetUniqueID(4958);
189  mtd.SetNameTitle("OM4958","IceTop module");
190
191  pos[0]=49;
192  pos[1]=5;
193  pos[2]=8;
194  mtd.SetPosition(pos,"car");
195
196  s.Reset();
197  s.SetName("OM4958 Hit 1");
198  s.SetUniqueID(sid++);
199  s.SetSignal(50,"ADC");
200  s.SetSignal(-500,"LE");
201  s.SetSignal(-5000,"TOT");
202  mtd.AddHit(s);
203
204  s.Reset();
205  s.SetName("OM4958 Hit 2");
206  s.SetUniqueID(sid++);
207  s.SetSignal(51,"ADC");
208  s.SetSignal(-501,"LE");
209  s.SetSignal(5001,"TOT");
210  mtd.AddHit(s);
211
212  s.Reset();
213  s.SetName("OM4958 Hit 3");
214  s.SetUniqueID(sid++);
215  s.SetSignal(52,"ADC");
216  s.SetSignal(-502,"LE");
217  s.SetSignal(-5002,"TOT");
218  mtd.AddHit(s);
219
220  evt->AddDevice(mtd);
221
222  // Provide event data overview
223  evt->Data();
224
225  // Select a specific device (i.e. OM) from the event
226  AliDevice* dx=(AliDevice*)evt->GetIdDevice(958);
227  if (dx)
228  {
229   cout << " === Device selection on UniqueID=958 for the whole event ===" << endl;
230   dx->Data();
231  }
232
233  // Select a specific hit from the event
234  AliSignal* sx=evt->GetIdHit(5,"IceGOM");
235  if (sx)
236  {
237   cout << " === Hit selection on UniqueID=5 for the whole event via IceGOM ===" << endl;
238   sx->Data();
239  }
240
241  // Dump all the information for the various stored devices
242  cout << endl;
243  cout << " ======= devices dump ========" << endl;
244  cout << endl;
245
246  Int_t ndev=evt->GetNdevices();
247  for (Int_t idev=1; idev<=ndev; idev++)
248  {
249   cout << " Device number : " << idev << endl;
250   IceGOM* om=(IceGOM*)evt->GetDevice(idev);
251   if (om) om->Data();
252  }
253
254  // Dump all the information for the various stored hits
255  cout << endl;
256  cout << " ======= Event all hits dump ========" << endl;
257  cout << endl;
258
259  // Obtain pointers to the hits for all generic OM's (i.e. IceGOM)
260  TObjArray* hits=evt->GetHits("IceGOM");
261  Int_t nhits=0;
262  if (hits) nhits=hits->GetEntries();
263  for (Int_t ih=0; ih<nhits; ih++)
264  {
265   AliSignal* sx=(AliSignal*)hits->At(ih);
266   if (sx) sx->Data();
267  }
268
269  // Obtain the minimum and maximum observed TOT value 
270  Float_t vmin,vmax;
271  evt->GetExtremes("IceGOM",vmin,vmax,"TOT");
272
273  cout << endl;
274  cout << " === Extreme values : vmin = " << vmin << " vmax = " << vmax << endl;
275  cout << endl;
276
277  // Various hit orderings
278  cout << endl;
279  cout << " ======= ordered hits w.r.t. decreasing TOT ========" << endl;
280  cout << endl;
281
282  TObjArray* ordered=evt->SortHits("IceGOM","TOT",-1);
283  nhits=0;
284  if (ordered) nhits=ordered->GetEntries();
285  for (Int_t i=0; i<nhits; i++)
286  {
287   AliSignal* sx=(AliSignal*)ordered->At(i);
288   if (sx) sx->Data();
289  }
290
291  cout << endl;
292  cout << " ======= ordered devices from the ordered hit array  ========" << endl;
293  cout << endl;
294
295  TObjArray* devs=evt->SortDevices(ordered,0,0);
296  ndev=0;
297  if (devs) ndev=devs->GetEntries();
298  for (Int_t id=0; id<ndev; id++)
299  {
300   AliDevice* dx=(AliDevice*)devs->At(id);
301   if (dx) dx->Data();
302  }
303
304  cout << endl;
305  cout << " ======= newly ordered devices w.r.t. decreasing ADC ========" << endl;
306  cout << endl;
307
308  TObjArray* devs=evt->SortDevices("IceGOM","ADC",-1);
309  ndev=0;
310  if (devs) ndev=devs->GetEntries();
311  for (Int_t id2=0; id2<ndev; id2++)
312  {
313   AliDevice* dx=(AliDevice*)devs->At(id2);
314   if (dx) dx->Data();
315  }
316
317  // Example for a 3D signal display of the devices
318 /***********
319  TCanvas* c1=new TCanvas("c1","c1");
320  c1->x3d();
321  TView* view=new TView(1);
322  view->SetRange(-50,-50,-50,50,50,50);
323  view->ShowAxis();
324
325  evt->DisplayHits("IceGOM","TOT",1e4,1);
326 ************/
327 }