]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RALICE/icepack/IceEvent.cxx
10-may-2006 NvE Distance determination between tracks and/or jets introduced in
[u/mrichter/AliRoot.git] / RALICE / icepack / IceEvent.cxx
1 /*******************************************************************************
2  * Copyright(c) 2003, IceCube Experiment at the South Pole. All rights reserved.
3  *
4  * Author: The IceCube RALICE-based Offline Project.
5  * Contributors are mentioned in the code where appropriate.
6  *
7  * Permission to use, copy, modify and distribute this software and its
8  * documentation strictly for non-commercial purposes is hereby granted
9  * without fee, provided that the above copyright notice appears in all
10  * copies and that both the copyright notice and this permission notice
11  * appear in the supporting documentation.
12  * The authors make no claims about the suitability of this software for
13  * any purpose. It is provided "as is" without express or implied warranty.
14  *******************************************************************************/
15
16 // $Id$
17
18 ///////////////////////////////////////////////////////////////////////////
19 // Class IceEvent
20 // Handling of IceCube event data.
21 // Basically this class provides an IceCube tailored user interface
22 // to the functionality of the class AliEvent.
23 //
24 // Notes :
25 // ------
26 // * In the event structure MC tracks are labeled with a negative track ID,
27 //   whereas reconstructed tracks are labeled with a positive track ID.
28 //   This allows for a direct selection of either MC or Reco tracks via the
29 //   GetIdTrack() facility.
30 // * The particle codes used for the various tracks are the PDG ones.
31 //   For IceCube specific "particle" types (e.g. deltae) the PDG database
32 //   has been extended, as can be seen in the IceF2k class which provides
33 //   a conversion facility from the F2K into the Ralice/IcePack format.
34 //
35 // Examples :
36 // ==========
37 //
38 // Creation and filling of an event with some fictitious module data
39 // -----------------------------------------------------------------
40 // IceEvent* evt=new IceEvent();
41 // evt->SetOwner();
42 //
43 // // The starting unique signal ID.
44 // // In this example it will be increased everytime
45 // // when a new signal is created.
46 // Int_t sid=1;
47 //
48 // // Amanda module
49 // IceAOM m;
50 // m.SetUniqueID(123);
51 // m.SetNameTitle("OM123","Amanda module");
52 //
53 // Float_t pos[3]={1,2,3};
54 // m.SetPosition(pos,"car");
55 //
56 // AliSignal s;
57 //
58 // s.SetSlotName("ADC",1);
59 // s.SetSlotName("LE",2);
60 // s.SetSlotName("TOT",3);
61 //
62 // s.Reset();
63 // s.SetName("OM123 Hit 1");
64 // s.SetUniqueID(sid++);
65 // s.SetSignal(100,"ADC");
66 // s.SetSignal(-100,"LE");
67 // s.SetSignal(-1000,"TOT");
68 // m.AddHit(s);
69 //
70 // s.Reset();
71 // s.SetName("OM123 Hit 2");
72 // s.SetUniqueID(sid++);
73 // s.SetSignal(110,"ADC");
74 // s.SetSignal(-101,"LE");
75 // s.SetSignal(1001,"TOT");
76 // m.AddHit(s);
77 //
78 // s.Reset();
79 // s.SetName("OM123 Hit 3");
80 // s.SetUniqueID(sid++);
81 // s.SetSignal(120,"ADC");
82 // s.SetSignal(-102,"LE");
83 // s.SetSignal(-1002,"TOT");
84 // m.AddHit(s);
85 //
86 // evt->AddDevice(m);
87 //
88 // m.Reset();
89 // m.SetUniqueID(456);
90 // m.SetName("OM456");
91 //
92 // pos[0]=-4;
93 // pos[1]=-5;
94 // pos[2]=-6;
95 // m.SetPosition(pos,"car");
96 //
97 // s.Reset();
98 // s.SetName("OM456 Hit 1");
99 // s.SetUniqueID(sid++);
100 // s.SetSignal(20,"ADC");
101 // s.SetSignal(-200,"LE");
102 // s.SetSignal(-2000,"TOT");
103 // m.AddHit(s);
104 //
105 // s.Reset();
106 // s.SetName("OM456 Hit 2");
107 // s.SetUniqueID(sid++);
108 // s.SetSignal(21,"ADC");
109 // s.SetSignal(-201,"LE");
110 // s.SetSignal(2001,"TOT");
111 // m.AddHit(s);
112 //
113 // s.Reset();
114 // s.SetName("OM456 Hit 3");
115 // s.SetUniqueID(sid++);
116 // s.SetSignal(22,"ADC");
117 // s.SetSignal(-202,"LE");
118 // s.SetSignal(-2002,"TOT");
119 // m.AddHit(s);
120 //
121 // evt->AddDevice(m);
122 //
123 // // IceCube in-ice DOM
124 // IceIDOM mid;
125 // mid.SetUniqueID(958);
126 // mid.SetNameTitle("OM958","IceCube in-ice module");
127 //
128 // pos[0]=9;
129 // pos[1]=5;
130 // pos[2]=8;
131 // mid.SetPosition(pos,"car");
132 //
133 // s.Reset();
134 // s.SetName("OM958 Hit 1");
135 // s.SetUniqueID(sid++);
136 // s.SetSignal(40,"ADC");
137 // s.SetSignal(-400,"LE");
138 // s.SetSignal(-4000,"TOT");
139 // mid.AddHit(s);
140 //
141 // s.Reset();
142 // s.SetName("OM958 Hit 2");
143 // s.SetUniqueID(sid++);
144 // s.SetSignal(41,"ADC");
145 // s.SetSignal(-401,"LE");
146 // s.SetSignal(4001,"TOT");
147 // mid.AddHit(s);
148 //
149 // s.Reset();
150 // s.SetName("OM958 Hit 3");
151 // s.SetUniqueID(sid++);
152 // s.SetSignal(42,"ADC");
153 // s.SetSignal(-402,"LE");
154 // s.SetSignal(-4002,"TOT");
155 // mid.AddHit(s);
156 //
157 // evt->AddDevice(mid);
158 //
159 // // IceTop DOM
160 // IceTDOM mtd;
161 // mtd.SetUniqueID(4958);
162 // mtd.SetNameTitle("OM4958","IceTop module");
163 //
164 // pos[0]=49;
165 // pos[1]=5;
166 // pos[2]=8;
167 // mtd.SetPosition(pos,"car");
168 //
169 // s.Reset();
170 // s.SetName("OM4958 Hit 1");
171 // s.SetUniqueID(sid++);
172 // s.SetSignal(50,"ADC");
173 // s.SetSignal(-500,"LE");
174 // s.SetSignal(-5000,"TOT");
175 // mtd.AddHit(s);
176 //
177 // s.Reset();
178 // s.SetName("OM4958 Hit 2");
179 // s.SetUniqueID(sid++);
180 // s.SetSignal(51,"ADC");
181 // s.SetSignal(-501,"LE");
182 // s.SetSignal(5001,"TOT");
183 // mtd.AddHit(s);
184 //
185 // s.Reset();
186 // s.SetName("OM4958 Hit 3");
187 // s.SetUniqueID(sid++);
188 // s.SetSignal(52,"ADC");
189 // s.SetSignal(-502,"LE");
190 // s.SetSignal(-5002,"TOT");
191 // mtd.AddHit(s);
192 //
193 // evt->AddDevice(mtd);
194 //
195 // Investigation of the event contents
196 // -----------------------------------
197 // // Provide event data overview
198 // evt->Data();
199 //
200 // // Select a specific device (i.e. OM) from the event
201 // AliDevice* dx=(AliDevice*)evt->GetIdDevice(958);
202 // if (dx) dx->Data();
203 //
204 // // Select a specific hit from the event
205 // AliSignal* sx=evt->GetIdHit(5,"IceGOM");
206 // if (sx) sx->Data();
207 //
208 // // Dump all the information for the various stored devices
209 // Int_t ndev=evt->GetNdevices();
210 // for (Int_t idev=1; idev<=ndev; idev++)
211 // {
212 //  IceGOM* om=(IceGOM*)evt->GetDevice(idev);
213 //  if (om) om->Data();
214 // }
215 //
216 // // Dump all the information for the various stored hits
217 // // Obtain pointers to the hits for all generic OM's (i.e. IceGOM)
218 // TObjArray* hits=evt->GetHits("IceGOM");
219 // Int_t nhits=0;
220 // if (hits) nhits=hits->GetEntries();
221 // for (Int_t ih=0; ih<nhits; ih++)
222 // {
223 //  AliSignal* sx=(AliSignal*)hits->At(ih);
224 //  if (sx) sx->Data();
225 // }
226 //
227 // // Obtain the minimum and maximum recorded TOT value 
228 // Float_t vmin,vmax;
229 // evt->GetExtremes("IceGOM",vmin,vmax,"TOT");
230 // cout << " Extreme values : vmin = " << vmin << " vmax = " << vmax << endl;
231 //
232 // Some simple module and hit manipulations
233 // ----------------------------------------
234 // // Ordered hits w.r.t. decreasing TOT
235 // TObjArray* ordered=evt->SortHits("IceGOM","TOT",-1);
236 // nhits=0;
237 // if (ordered) nhits=ordered->GetEntries();
238 // for (Int_t i=0; i<nhits; i++)
239 // {
240 //  AliSignal* sx=(AliSignal*)ordered->At(i);
241 //  if (sx) sx->Data();
242 // }
243 //
244 // // Ordered devices from the already ordered hit array
245 // TObjArray* devs=evt->SortDevices(ordered,0,0);
246 // ndev=0;
247 // if (devs) ndev=devs->GetEntries();
248 // for (Int_t id=0; id<ndev; id++)
249 // {
250 //  AliDevice* dx=(AliDevice*)devs->At(id);
251 //  if (dx) dx->Data();
252 // }
253 //
254 // // Newly ordered devices w.r.t. decreasing ADC
255 // TObjArray* devs=evt->SortDevices("IceGOM","ADC",-1);
256 // ndev=0;
257 // if (devs) ndev=devs->GetEntries();
258 // for (Int_t id2=0; id2<ndev; id2++)
259 // {
260 //  AliDevice* dx=(AliDevice*)devs->At(id2);
261 //  if (dx) dx->Data();
262 // }
263 //
264 // A simple 3D event display of the modules
265 // ----------------------------------------
266 // TCanvas* c1=new TCanvas("c1","c1");
267 // c1->x3d();
268 // TView* view=new TView(1);
269 // view->SetRange(-50,-50,-50,50,50,50);
270 // view->ShowAxis();
271 //
272 // evt->DisplayHits("IceGOM","TOT",1e4,1);
273 //
274 //
275 //--- Author: Nick van Eijndhoven 23-jun-2004 Utrecht University
276 //- Modified: NvE $Date$ Utrecht University
277 ///////////////////////////////////////////////////////////////////////////
278
279 #include "IceEvent.h"
280 #include "Riostream.h"
281  
282 ClassImp(IceEvent) // Class implementation to enable ROOT I/O
283  
284 IceEvent::IceEvent() : AliEvent()
285 {
286 // Default constructor.
287 }
288 ///////////////////////////////////////////////////////////////////////////
289 IceEvent::~IceEvent()
290 {
291 // Default destructor.
292 }
293 ///////////////////////////////////////////////////////////////////////////
294 IceEvent::IceEvent(const IceEvent& evt) : AliEvent(evt)
295 {
296 // Copy constructor.
297 }
298 ///////////////////////////////////////////////////////////////////////////
299 TObject* IceEvent::Clone(const char* name) const
300 {
301 // Make a deep copy of the current object and provide the pointer to the copy.
302 // This memberfunction enables automatic creation of new objects of the
303 // correct type depending on the object type, a feature which may be very useful
304 // for containers like AliEvent when adding objects in case the
305 // container owns the objects. This feature allows e.g. AliEvent
306 // to store either IceEvent objects or objects derived from IceEvent
307 // via tha AddDevice memberfunction, provided these derived classes also have
308 // a proper Clone memberfunction. 
309
310  IceEvent* evt=new IceEvent(*this);
311  if (name)
312  {
313   if (strlen(name)) evt->SetName(name);
314  }
315  return evt;
316 }
317 ///////////////////////////////////////////////////////////////////////////