]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RALICE/wa98/Wa98Event.cxx
Additional protection
[u/mrichter/AliRoot.git] / RALICE / wa98 / Wa98Event.cxx
CommitLineData
5c9fc915 1// $Id$
2
3///////////////////////////////////////////////////////////////////////////
4// Class Wa98Event
5// Creation and investigation of a Wa98 physics event.
6// This event class is derived from AliEvent and has some Wa98 specific
7// extensions like e.g. the information from the trigger calorimeters
8// and some LEDA specific functions.
9//
10//--- Author: Nick van Eijndhoven 24-apr-2002 UU-SAP Utrecht
11//- Modified: NvE $Date$ UU-SAP Utrecht
12///////////////////////////////////////////////////////////////////////////
13
14#include "Wa98Event.h"
15#include "Riostream.h"
16
17ClassImp(Wa98Event) // Class implementation to enable ROOT I/O
18
19Wa98Event::Wa98Event() : AliEvent()
20{
21// Default constructor.
22// All variables initialised to default values.
23 Reset();
24}
25///////////////////////////////////////////////////////////////////////////
26Wa98Event::Wa98Event(Int_t n) : AliEvent(n)
27{
28// Create an event to hold initially a maximum of n tracks
29// All variables initialised to default values
30 Reset();
31}
32///////////////////////////////////////////////////////////////////////////
33Wa98Event::~Wa98Event()
34{
35// Default destructor
36}
37///////////////////////////////////////////////////////////////////////////
38Wa98Event::Wa98Event(Wa98Event& evt) : AliEvent(evt)
39{
40// Copy constructor.
41 fTrig=evt.fTrig;
42 fWeight=evt.fWeight;
43 fZdc=evt.fZdc;
44 fEmir=evt.fEmir;
45 fEmire=evt.fEmire;
46 fEmirh=evt.fEmirh;
47 fEtm=evt.fEtm;
48 fEtme=evt.fEtme;
49 fEtmh=evt.fEtmh;
50}
51///////////////////////////////////////////////////////////////////////////
52void Wa98Event::Reset()
53{
54// Reset all variables to default values
55// The max. number of tracks is set to the initial value again
56// The max. number of vertices is set to the default value again
57 fTrig=0;
58 fWeight=0;
59 fZdc=0;
60 fEmir=0;
61 fEmire=0;
62 fEmirh=0;
63 fEtm=0;
64 fEtme=0;
65 fEtmh=0;
66
67 AliEvent::Reset();
68}
69///////////////////////////////////////////////////////////////////////////
70void Wa98Event::SetTrig(Int_t trig)
71{
72// Set the trigger class.
73// Trigger classes : 1=nsc 3=cen 5=per 6=mbias 7=beam 8=inbeam ped
74 fTrig=trig;
75}
76///////////////////////////////////////////////////////////////////////////
77Int_t Wa98Event::GetTrig()
78{
79// Provide the trigger class.
80// Trigger classes : 1=nsc 3=cen 5=per 6=mbias 7=beam 8=inbeam ped
81 return fTrig;
82}
83///////////////////////////////////////////////////////////////////////////
84void Wa98Event::SetWeight(Int_t w)
85{
86// Set the event weight to account for the downscale factor.
87 fWeight=w;
88}
89///////////////////////////////////////////////////////////////////////////
90Int_t Wa98Event::GetWeight()
91{
92// Provide the event weight factor to account for the DAQ downscaling.
93 return fWeight;
94}
95///////////////////////////////////////////////////////////////////////////
96void Wa98Event::SetZdc(Float_t zdc)
97{
98// Set the ZDC signal in GeV.
99 fZdc=zdc;
100}
101///////////////////////////////////////////////////////////////////////////
102Float_t Wa98Event::GetZdc()
103{
104// Provide the ZDC signal in GeV.
105 return fZdc;
106}
107///////////////////////////////////////////////////////////////////////////
108void Wa98Event::SetMiracE(Float_t tot,Float_t em,Float_t had)
109{
110// Set the total, EM and hadronic signals for MIRAC in GeV.
111 fEmir=tot;
112 fEmire=em;
113 fEmirh=had;
114}
115///////////////////////////////////////////////////////////////////////////
116Float_t Wa98Event::GetEmir()
117{
118// Provide the total MIRAC signal in GeV.
119 return fEmir;
120}
121///////////////////////////////////////////////////////////////////////////
122Float_t Wa98Event::GetEmire()
123{
124// Provide the MIRAC EM signal in GeV.
125 return fEmire;
126}
127///////////////////////////////////////////////////////////////////////////
128Float_t Wa98Event::GetEmirh()
129{
130// Provide the MIRAC hadronic signal in GeV.
131 return fEmirh;
132}
133///////////////////////////////////////////////////////////////////////////
134void Wa98Event::SetMiracEt(Float_t tot,Float_t em,Float_t had)
135{
136// Set the total, EM and hadronic Et signals for MIRAC in GeV.
137 fEtm=tot;
138 fEtme=em;
139 fEtmh=had;
140}
141///////////////////////////////////////////////////////////////////////////
142Float_t Wa98Event::GetEtm()
143{
144// Provide the total MIRAC Et signal in GeV.
145 return fEtm;
146}
147///////////////////////////////////////////////////////////////////////////
148Float_t Wa98Event::GetEtme()
149{
150// Provide the MIRAC EM Et signal in GeV.
151 return fEtme;
152}
153///////////////////////////////////////////////////////////////////////////
154Float_t Wa98Event::GetEtmh()
155{
156// Provide the MIRAC hadronic Et signal in GeV.
157 return fEtmh;
158}
159///////////////////////////////////////////////////////////////////////////
160void Wa98Event::InitLeda(AliCalorimeter* cal)
161{
162// Set module positions and flag bad modules for this LEDA part.
163 if (cal)
164 {
165 Int_t nrows=cal->GetNrows();
166 if (nrows==40)
167 {
168 SetPositionsLedalw(cal);
169 SetBadModulesLedalw(cal);
170 }
171 if (nrows==44)
172 {
173 SetPositionsLedaup(cal);
174 SetBadModulesLedaup(cal);
175 }
176 if (nrows!=40 && nrows!=44)
177 {
178 cout << " *Wa98Event::InitLeda* Not a LEDA configuration. nrows = " << nrows << endl;
179 }
180 }
181 else
182 {
183 cout << " *Wa98Event::InitLeda* Calorimeter pointer was zero. " << endl;
184 }
185}
186///////////////////////////////////////////////////////////////////////////
187void Wa98Event::SetBadModulesLedaup(AliCalorimeter* cal)
188{
189// Marking of the bad modules the upper LEDA
190
191 Int_t nr=cal->GetNrows();
192 Int_t nc=cal->GetNcolumns();
193
194// Declare the non-existing modules as dead
195 Int_t row0=0;
196 for (Int_t col=1; col<=nc; col++)
197 {
198 if (col<19 || col>126) row0=41;
199 if (col>36 && col<109) row0=41;
200 if (col<13 || col>132) row0=37;
201 if (col>42 && col<103) row0=37;
202 if (col< 7 || col>138) row0=33;
203 if (col>48 && col< 97) row0=33;
204
205 for (Int_t row=row0; row<=nr; row++)
206 {
207 cal->SetDead(row,col);
208 }
209 }
210
211 // The bad area as seen in the first 50 events of Pb96 run 9066
212 for (Int_t i=24; i<=33; i++)
213 {
214 for (Int_t j=1; j<=20; j++)
215 {
216 cal->SetDead(i,j);
217 }
218 }
219}
220//////////////////////////////////////////////////////////////////////////
221void Wa98Event::SetBadModulesLedalw(AliCalorimeter* cal)
222{
223// Marking of the bad modules the lower LEDA
224
225 Int_t nr=cal->GetNrows();
226 Int_t nc=cal->GetNcolumns();
227
228// Declare the non-existing modules as dead
229 Int_t row0=0;
230 for (Int_t col=1; col<=nc; col++)
231 {
232 if (col<19 || col>126) row0=37;
233 if (col>36 && col<109) row0=37;
234 if (col<13 || col>132) row0=33;
235 if (col>42 && col<103) row0=33;
236 if (col< 7 || col>138) row0=29;
237 if (col>48 && col< 97) row0=29;
238
239 for (Int_t row=row0; row<=nr; row++)
240 {
241 cal->SetDead(row,col);
242 }
243 }
244}
245//////////////////////////////////////////////////////////////////////////
246void Wa98Event::SetPositionsLedaup(AliCalorimeter* cal)
247{
248// Determination of the lab. position of each module of the upper LEDA
249
250 Float_t sx=4.105; // X-dimension of a module in cm
251 Float_t sy=4.085; // Y-dimension of a module in cm
252 Float_t tilt=8.31; // Tilt angle in degrees
253
254 Float_t pi=acos(-1.);
255 Float_t tiltr=tilt*pi/180.; // Tilt angle in radians
256
257 Float_t dx=sx; // X-displacement skipping 1 module horizontal
258 Float_t dy=sy*cos(tiltr); // Y-displacement skipping 1 module vertical
259 Float_t dz=sy*sin(tiltr); // Z-displacement skipping 1 module vertical
260
261 // Position of the left upper module (1,1) looking downstream
262 Float_t x0=293.;
263 Float_t y0=345.73;
264 Float_t z0=2180.12;
265
266 // Determine and store position of each module
267 Int_t nr=cal->GetNrows();
268 Int_t nc=cal->GetNcolumns();
269 Float_t pos[3];
270 for (Int_t i=1; i<=nr; i++)
271 {
272 for (Int_t j=1; j<=nc; j++)
273 {
274 pos[0]=x0-float(j-1)*dx;
275 pos[1]=y0-float(i-1)*dy;
276 pos[2]=z0+float(i-1)*dz;
277 cal->SetPosition(i,j,pos,"car");
278 }
279 }
280}
281//////////////////////////////////////////////////////////////////////////
282void Wa98Event::SetPositionsLedalw(AliCalorimeter* cal)
283{
284// Determination of the lab. position of each module of the lower LEDA
285
286 Float_t sx=4.105; // X-dimension of a module in cm
287 Float_t sy=4.085; // Y-dimension of a module in cm
288 Float_t tilt=8.31; // Tilt angle in degrees
289
290 Float_t pi=acos(-1.);
291 Float_t tiltr=tilt*pi/180.; // Tilt angle in radians
292
293 Float_t dx=sx; // X-displacement skipping 1 module horizontal
294 Float_t dy=sy*cos(tiltr); // Y-displacement skipping 1 module vertical
295 Float_t dz=sy*sin(tiltr); // Z-displacement skipping 1 module vertical
296
297 // Position of the left lower module (1,1) looking downstream
298 Float_t x0=291.91;
299 Float_t y0=-331.14;
300 Float_t z0=2183.14;
301
302 // Determine and store position of each module
303 Int_t nr=cal->GetNrows();
304 Int_t nc=cal->GetNcolumns();
305 Float_t pos[3];
306 for (Int_t i=1; i<=nr; i++)
307 {
308 for (Int_t j=1; j<=nc; j++)
309 {
310 pos[0]=x0-float(j-1)*dx;
311 pos[1]=y0+float(i-1)*dy;
312 pos[2]=z0+float(i-1)*dz;
313 cal->SetPosition(i,j,pos,"car");
314 }
315 }
316}
317//////////////////////////////////////////////////////////////////////////
318void Wa98Event::ClusterLeda(AliCalorimeter* cal,Int_t n,Int_t mode)
319{
320// Group LEDA modules into clusters.
321// The parameter n indicates the number of rings for the grouping process
322// (default n=2) and the parameter mode indicates the sorting algorithm
323// (default mode=1). See AliCalorimeter::Group() for further details.
324// This function invokes AliCalorimeter::Group(n) and automatically
325// sets the uncertainties on the cluster positions.
326// The precision of a cluster position in the X-Y plane has been seen
327// to be about half the size of a module, so dx=dy=2cm.
328
329 Float_t err[3]={2,2,0};
330 AliCalcluster* c=0;
331
332 if (cal)
333 {
334 cal->Group(n,mode);
335 for (Int_t i=1; i<=cal->GetNclusters(); i++)
336 {
337 c=cal->GetCluster(i);
338 if (c) c->SetPositionErrors(err,"car");
339 }
340 }
341 else
342 {
343 cout << " *Wa98Event::ClusterLeda* Calorimeter pointer was zero. " << endl;
344 }
345}
346//////////////////////////////////////////////////////////////////////////
347void Wa98Event::VetoLeda(AliCalorimeter* cal,Float_t dtheta,Float_t dphi)
348{
349// Perform LEDA-Veto cluster association.
350// An association is only made if the Veto signal appears into a small
351// cone around the LEDA cluster position.
352// The cone dimensions are given by the parameters "dtheta" and "dphi"
353// (in degrees) and the default values are dtheta=0.2 and dphi=1.
354// The automatic straight line extrapolation of the Veto signal position
355// onto the LEDA surface is used in the association procedure.
356
357 Float_t pi=acos(-1.);
358
359 AliCalcluster* c;
360 AliSignal* v;
361 Float_t posc[3],posv[3];
362 Float_t dth,dph;
363
364 Int_t nc=cal->GetNclusters();
365 Int_t nv=cal->GetNvetos();
366 if (nv)
367 {
368 for (Int_t i=1; i<=nc; i++)
369 {
370 c=cal->GetCluster(i);
371 c->GetPosition(posc,"sph");
372
373 for (Int_t j=1; j<=nv; j++)
374 {
375 v=cal->GetVetoSignal(j);
376 v->GetPosition(posv,"sph");
377 // Associate a close-by veto to this LEDA cluster
378 dth=(posc[1]-posv[1])*180./pi;
379 dph=(posc[2]-posv[2])*180./pi;
380 if (fabs(dth)<dtheta && fabs(dph)<dphi) c->AddVetoSignal(v);
381 }
382 }
383 }
384}
385///////////////////////////////////////////////////////////////////////////