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 ($)
6 // $ root -b -q icetest.cc >test.log
8 // Interactive execution of this macro can be achieved by
9 // the following command after starting a ROOT session
11 // $ root> .x icetest.cc
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.
18 // NvE 01-dec-2004 Utrecht University
19 //////////////////////////////////////////////////////////////////////////
21 gSystem->Load("ralice");
22 gSystem->Load("icepack");
24 IceEvent* evt=new IceEvent();
30 m.SetNameTitle("OM123","Amanda module");
32 Float_t pos[3]={1,2,3};
33 m.SetPosition(pos,"car");
35 // The starting unique signal ID.
36 // It will be increased automatically in this macro
37 // when a new signal is created.
42 s.SetSlotName("ADC",1);
43 s.SetSlotName("LE",2);
44 s.SetSlotName("TOT",3);
47 s.SetName("OM123 Hit 1");
49 s.SetSignal(100,"ADC");
50 s.SetSignal(-100,"LE");
51 s.SetSignal(-1000,"TOT");
55 s.SetName("OM123 Hit 2");
57 s.SetSignal(110,"ADC");
58 s.SetSignal(-101,"LE");
59 s.SetSignal(1001,"TOT");
63 s.SetName("OM123 Hit 3");
65 s.SetSignal(120,"ADC");
66 s.SetSignal(-102,"LE");
67 s.SetSignal(-1002,"TOT");
79 m.SetPosition(pos,"car");
82 s.SetName("OM456 Hit 1");
84 s.SetSignal(20,"ADC");
85 s.SetSignal(-200,"LE");
86 s.SetSignal(-2000,"TOT");
90 s.SetName("OM456 Hit 2");
92 s.SetSignal(21,"ADC");
93 s.SetSignal(-201,"LE");
94 s.SetSignal(2001,"TOT");
98 s.SetName("OM456 Hit 3");
100 s.SetSignal(22,"ADC");
101 s.SetSignal(-202,"LE");
102 s.SetSignal(-2002,"TOT");
105 // Example of explicit hit selection
106 AliSignal* sx=m.GetIdHit(5);
109 cout << " === Hit selection on UniqueID=5 for OM 456 ===" << endl;
122 m.SetPosition(pos,"car");
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");
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");
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");
150 // IceCube in-ice DOM
152 mid.SetUniqueID(958);
153 mid.SetNameTitle("OM958","IceCube in-ice module");
158 mid.SetPosition(pos,"car");
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");
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");
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");
188 mtd.SetUniqueID(4958);
189 mtd.SetNameTitle("OM4958","IceTop module");
194 mtd.SetPosition(pos,"car");
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");
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");
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");
222 // Provide event data overview
225 // Select a specific device (i.e. OM) from the event
226 AliDevice* dx=(AliDevice*)evt->GetIdDevice(958);
229 cout << " === Device selection on UniqueID=958 for the whole event ===" << endl;
233 // Select a specific hit from the event
234 AliSignal* sx=evt->GetIdHit(5,"IceGOM");
237 cout << " === Hit selection on UniqueID=5 for the whole event via IceGOM ===" << endl;
241 // Dump all the information for the various stored devices
243 cout << " ======= devices dump ========" << endl;
246 Int_t ndev=evt->GetNdevices();
247 for (Int_t idev=1; idev<=ndev; idev++)
249 cout << " Device number : " << idev << endl;
250 IceGOM* om=(IceGOM*)evt->GetDevice(idev);
254 // Dump all the information for the various stored hits
256 cout << " ======= Event all hits dump ========" << endl;
259 // Obtain pointers to the hits for all generic OM's (i.e. IceGOM)
260 TObjArray* hits=evt->GetHits("IceGOM");
262 if (hits) nhits=hits->GetEntries();
263 for (Int_t ih=0; ih<nhits; ih++)
265 AliSignal* sx=(AliSignal*)hits->At(ih);
269 // Obtain the minimum and maximum observed TOT value
271 evt->GetExtremes("IceGOM",vmin,vmax,"TOT");
274 cout << " === Extreme values : vmin = " << vmin << " vmax = " << vmax << endl;
277 // Various hit orderings
279 cout << " ======= ordered hits w.r.t. decreasing TOT ========" << endl;
282 TObjArray* ordered=evt->SortHits("IceGOM","TOT",-1);
284 if (ordered) nhits=ordered->GetEntries();
285 for (Int_t i=0; i<nhits; i++)
287 AliSignal* sx=(AliSignal*)ordered->At(i);
292 cout << " ======= ordered devices from the ordered hit array ========" << endl;
295 TObjArray* devs=evt->SortDevices(ordered,0,0);
297 if (devs) ndev=devs->GetEntries();
298 for (Int_t id=0; id<ndev; id++)
300 AliDevice* dx=(AliDevice*)devs->At(id);
305 cout << " ======= newly ordered devices w.r.t. decreasing ADC ========" << endl;
308 TObjArray* devs=evt->SortDevices("IceGOM","ADC",-1);
310 if (devs) ndev=devs->GetEntries();
311 for (Int_t id2=0; id2<ndev; id2++)
313 AliDevice* dx=(AliDevice*)devs->At(id2);
317 // Example for a 3D signal display of the devices
319 TCanvas* c1=new TCanvas("c1","c1");
321 TView* view=new TView(1);
322 view->SetRange(-50,-50,-50,50,50,50);
325 evt->DisplayHits("IceGOM","TOT",1e4,1);