]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/PMDModule.cxx
Runloader is updated when moving to next file (quick fix).
[u/mrichter/AliRoot.git] / EVE / Alieve / PMDModule.cxx
CommitLineData
ee0e160c 1// $Header$
2
3#include "PMDModule.h"
4
5#include "AliPMDdigit.h"
6#include "AliPMDddldata.h"
7
e8ac0bec 8#include <TClonesArray.h>
9
ee0e160c 10using namespace Reve;
11using namespace Alieve;
12
f0314e4e 13const Float_t PMDModule::fgkRad = 0.25;
14const Float_t PMDModule::fgkSqRoot3 = 1.732050808;
15const Float_t PMDModule::fgkZpos = 0.;
16Int_t PMDModule::fPreTotPads = 0;
17Int_t PMDModule::fCpvTotPads = 0;
18Int_t PMDModule::fPreTotAdc = 0;
19Int_t PMDModule::fCpvTotAdc = 0;
20
21
ee0e160c 22//______________________________________________________________________
23// PMDModule
24//
25
26
27ClassImp(PMDModule)
28
29PMDModule::PMDModule():
f0314e4e 30 fH1(0),
ee0e160c 31 fX(0.),
32 fY(0.),
33 fZ(0.),
f0314e4e 34 fNPads(0),
35 fAdc(0)
ee0e160c 36{
37
38}
39// -------------------------------------------------------------------- //
40void PMDModule::DisplayInit(Int_t ism)
41{
42 TString smodule = "Module";
43 smodule+= ism;
44
45 Float_t xism =0, yism = 0;
46 Float_t dxism =0, dyism = 0;
47
48 GenerateBox(ism,xism,yism,dxism,dyism);
49
50 Reve::FrameBox *pmdModBox = new FrameBox();
51 pmdModBox->SetAAQuadXY(xism, yism, 0, dxism, dyism);
52 pmdModBox->SetFrameColor((Color_t) 31);
53
54 Reve::RGBAPalette *pmdModPalette = new RGBAPalette(20, 1000);
55 pmdModPalette->SetLimits(0, 1000);
56
ee0e160c 57 SetName(smodule.Data());
58 SetOwnIds(kTRUE);
59 Reset(Reve::QuadSet::QT_HexagonXY, kFALSE, 32);
60
61 SetFrame(pmdModBox);
62 SetPalette(pmdModPalette);
63
f0314e4e 64 fH1 = new TH1F("fH1", smodule.Data(), 100, 0., 1000.);
65 fH1->SetDirectory(0);
66 fH1->GetXaxis()->SetTitle("Single Cell Edep (adc)");
ee0e160c 67}
f0314e4e 68
ee0e160c 69// -------------------------------------------------------------------- //
f0314e4e 70
ee0e160c 71void PMDModule::DisplayDigitsData(Int_t ism, TTree *pmdt)
72{
ee0e160c 73 DisplayInit(ism);
74
75 Int_t det, smn, irow, icol, adc;
76 Int_t xpad = 0, ypad = 0;
77 Float_t xpos, ypos;
78
79 TClonesArray *digits = new TClonesArray("AliPMDdigit", 0);
80
81 TBranch *branch = pmdt->GetBranch("PMDDigit");
82 branch->SetAddress(&digits);
83
84 AliPMDdigit *pmddigit;
85
86 branch->GetEntry(ism);
87 Int_t nentries = digits->GetLast();
88 //printf("%d\n", nentries);
89
90 for (Int_t ient = 0; ient < nentries+1; ient++)
91 {
92 pmddigit = (AliPMDdigit*)digits->UncheckedAt(ient);
93
94 det = pmddigit->GetDetector();
95 smn = pmddigit->GetSMNumber();
96 irow = pmddigit->GetRow();
97 icol = pmddigit->GetColumn();
98 adc = (Int_t) pmddigit->GetADC();
99
100 if(smn <12)
101 {
102 xpad = icol;
103 ypad = irow;
104 }
105 else if(smn >=12 && smn < 24)
106 {
107 xpad = irow;
108 ypad = icol;
109 }
110
111 RectGeomCellPos(smn, xpad, ypad, xpos, ypos);
112
113 AddHexagon(xpos, ypos, fgkZpos, fgkRad);
114
115 QuadValue(adc);
116
117 QuadId(new AliPMDdigit(*pmddigit));
118 // new TNamed(Form("Quad with idx=%d", ient),
119 // "This title is not confusing."));
120
121 ++fNPads;
f0314e4e 122 fAdc += adc;
123
124 if (det == 0)
125 {
126 fPreTotAdc += (Int_t) adc;
127 ++fPreTotPads;
128 }
129 if (det == 1)
130 {
131 fCpvTotAdc += (Int_t) adc;
132 ++fCpvTotPads;
133 }
134 fH1->Fill((Float_t)adc);
135
ee0e160c 136 }
137
138 RefitPlex();
139
140 fHMTrans.SetPos(fX, fY, fZ);
141
142 delete digits;
143}
f0314e4e 144
ee0e160c 145// -------------------------------------------------------------------- //
146
147void PMDModule::DisplayRawData(Int_t ism, TObjArray *ddlcont)
148{
f0314e4e 149 DisplayInit(ism);
ee0e160c 150
151 if (ism > 23) ism -= 24;
152
ee0e160c 153 Int_t det, smn, irow, icol, adc;
154 Int_t xpad = 0, ypad = 0;
155 Float_t xpos, ypos;
156
157 Int_t nentries = ddlcont->GetEntries();
158 //printf("%d\n", nentries);
159
160 for (Int_t ient = 0; ient < nentries; ient++)
161 {
162 AliPMDddldata *pmdddl = (AliPMDddldata*)ddlcont->UncheckedAt(ient);
163
164 det = pmdddl->GetDetector();
165 smn = pmdddl->GetSMN();
166 if (smn != ism) continue;
167 irow = pmdddl->GetRow();
168 icol = pmdddl->GetColumn();
169 adc = pmdddl->GetSignal();
170
171 if(smn <12)
172 {
173 xpad = icol;
174 ypad = irow;
175 }
176 else if(smn >=12 && smn < 24)
177 {
178 xpad = irow;
179 ypad = icol;
180 }
181
182 RectGeomCellPos(smn, xpad, ypad, xpos, ypos);
183
184 AddHexagon(xpos, ypos, fgkZpos, fgkRad);
185
186 QuadValue(adc);
187
188 QuadId(new AliPMDddldata(*pmdddl));
189 //new TNamed(Form("Quad with idx=%d", ient),
190 // "This title is not confusing."));
191
192 ++fNPads;
f0314e4e 193 fAdc += adc;
194
195 if (det == 0)
196 {
197 fPreTotAdc += (Int_t) adc;
198 ++fPreTotPads;
199 }
200 if (det == 1)
201 {
202 fCpvTotAdc += (Int_t) adc;
203 ++fCpvTotPads;
204 }
205
206 fH1->Fill((Float_t) adc);
ee0e160c 207 }
208
209 RefitPlex();
210
211 fHMTrans.SetPos(fX, fY, fZ);
212
213}
f0314e4e 214
ee0e160c 215// -------------------------------------------------------------------- //
216
217void PMDModule::RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad,
218 Float_t &xpos, Float_t &ypos)
219{
220 // This routine finds the cell eta,phi for the new PMD rectangular
221 // geometry in ALICE
222 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
223 // modified by B. K. Nandi for change of coordinate sys
224 //
225 // SMA ---> Supermodule Type A ( SM - 0)
226 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
227 // SMB ---> Supermodule Type B ( SM - 2)
228 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
229 //
230 // ism : Serial module number from 0 to 23 for each plane
231
232
233 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
234
235 const Double_t kXcorner[24] =
236 {
237 74.8833, 53.0045, 31.1255, //Type-A
238 74.8833, 53.0045, 31.1255, //Type-A
239 -74.8833, -53.0044, -31.1255, //Type-AR
240 -74.8833, -53.0044, -31.1255, //Type-AR
241 8.9165, -33.7471, //Type-B
242 8.9165, -33.7471, //Type-B
243 8.9165, -33.7471, //Type-B
244 -8.9165, 33.7471, //Type-BR
245 -8.9165, 33.7471, //Type-BR
246 -8.9165, 33.7471, //Type-BR
247 };
248
249
250 const Double_t kYcorner[24] =
251 {
252 86.225, 86.225, 86.225, //Type-A
253 37.075, 37.075, 37.075, //Type-A
254 -86.225, -86.225, -86.225, //Type-AR
255 -37.075, -37.075, -37.075, //Type-AR
256 86.225, 86.225, //Type-B
257 61.075, 61.075, //Type-B
258 35.925, 35.925, //Type-B
259 -86.225, -86.225, //Type-BR
260 -61.075, -61.075, //Type-BR
261 -35.925, -35.925 //Type-BR
262 };
263
264
265 // const Float_t kSqroot3 = 1.732050808; // sqrt(3.);
266 // const Float_t kCellRadius = 0.25;
267
268 //
269 //Every even row of cells is shifted and placed
270 //in geant so this condition
271 //
272 Float_t shift = 0.0;
273 if(ypad%2 == 0)
274 {
275 shift = 0.0;
276 }
277 else
278 {
279 shift = 0.25;
280 }
281
282
283 if(ism < 6)
284 {
285 ypos = kYcorner[ism] - (Float_t) xpad*fgkRad*2.0 - shift;
286 xpos = kXcorner[ism] - (Float_t) ypad*fgkSqRoot3*fgkRad;
287 }
288 else if(ism >=6 && ism < 12)
289 {
290 ypos = kYcorner[ism] + (Float_t) xpad*fgkRad*2.0 + shift;
291 xpos = kXcorner[ism] + (Float_t) ypad*fgkSqRoot3*fgkRad;
292 }
293 else if(ism >= 12 && ism < 18)
294 {
295 ypos = kYcorner[ism] - (Float_t) xpad*fgkRad*2.0 - shift;
296 xpos = kXcorner[ism] - (Float_t) ypad*fgkSqRoot3*fgkRad;
297 }
298 else if(ism >= 18 && ism < 24)
299 {
300 ypos = kYcorner[ism] + (Float_t) xpad*fgkRad*2.0 + shift;
301 xpos = kXcorner[ism] + (Float_t) ypad*fgkSqRoot3*fgkRad;
302 }
303
304}
f0314e4e 305
ee0e160c 306// -------------------------------------------------------------------- //
f0314e4e 307
ee0e160c 308void PMDModule::GenerateBox(Int_t ism, Float_t &xism, Float_t &yism,
309 Float_t &dxism, Float_t &dyism)
310{
311 const Float_t kDia = 0.50;
312
313 const Double_t kXcorner[24] =
314 {
315 74.8833, 53.0045, 31.1255, //Type-A
316 74.8833, 53.0045, 31.1255, //Type-A
317 -74.8833, -53.0044, -31.1255, //Type-AR
318 -74.8833, -53.0044, -31.1255, //Type-AR
319 8.9165, -33.7471, //Type-B
320 8.9165, -33.7471, //Type-B
321 8.9165, -33.7471, //Type-B
322 -8.9165, 33.7471, //Type-BR
323 -8.9165, 33.7471, //Type-BR
324 -8.9165, 33.7471, //Type-BR
325 };
326
327
328 const Double_t kYcorner[24] =
329 {
330 86.225, 86.225, 86.225, //Type-A
331 37.075, 37.075, 37.075, //Type-A
332 -86.225, -86.225, -86.225, //Type-AR
333 -37.075, -37.075, -37.075, //Type-AR
334 86.225, 86.225, //Type-B
335 61.075, 61.075, //Type-B
336 35.925, 35.925, //Type-B
337 -86.225, -86.225, //Type-BR
338 -61.075, -61.075, //Type-BR
339 -35.925, -35.925 //Type-BR
340 };
341
342
343 if (ism > 23) ism -= 24;
344
345
346 if (ism < 6)
347 {
348 xism = kXcorner[ism] + fgkRad;
349 yism = kYcorner[ism] + fgkRad;
350 dxism = -fgkRad*fgkSqRoot3*48.;
351 dyism = -kDia*96. - fgkRad;
352 }
353 if (ism >= 6 && ism < 12)
354 {
355 xism = kXcorner[ism] - fgkRad;
356 yism = kYcorner[ism] - fgkRad;
357 dxism = fgkRad*fgkSqRoot3*48.;
358 dyism = kDia*96. + fgkRad;
359 }
360 if (ism >= 12 && ism < 18)
361 {
362 xism = kXcorner[ism] + fgkRad;
363 yism = kYcorner[ism] + fgkRad;
364 dxism = -fgkRad*fgkSqRoot3*96.;
365 dyism = -kDia*48. - fgkRad;
366 }
367 if (ism >= 18 && ism < 24)
368 {
369 xism = kXcorner[ism] - fgkRad;
370 yism = kYcorner[ism] - fgkRad;
371 dxism = fgkRad*fgkSqRoot3*96.;
372 dyism = kDia*48. + fgkRad;
373 }
374
375}
376
377// -------------------------------------------------------------------- //
378
379void PMDModule::SetPosition(Float_t x, Float_t y, Float_t z)
380{
381 fX = x;
382 fY = y;
383 fZ = z;
384}
385
386// -------------------------------------------------------------------- //