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