2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "AliEvePMDModule.h"
12 #include "AliPMDdigit.h"
13 #include "AliPMDddldata.h"
15 #include <TEveTrans.h>
17 #include <TClonesArray.h>
21 const Float_t AliEvePMDModule::fgkRad = 0.25;
22 const Float_t AliEvePMDModule::fgkSqRoot3 = 1.732050808;
23 const Float_t AliEvePMDModule::fgkZpos = 0.;
24 Int_t AliEvePMDModule::fgPreTotPads = 0;
25 Int_t AliEvePMDModule::fgCpvTotPads = 0;
26 Int_t AliEvePMDModule::fgPreTotAdc = 0;
27 Int_t AliEvePMDModule::fgCpvTotAdc = 0;
30 //______________________________________________________________________________
35 ClassImp(AliEvePMDModule)
37 AliEvePMDModule::AliEvePMDModule():
48 AliEvePMDModule::~AliEvePMDModule()
55 // -------------------------------------------------------------------- //
56 void AliEvePMDModule::DisplayInit(Int_t ism)
58 // Initialize display parameters for module ism.
60 TString smodule = "Module";
63 Float_t xism =0, yism = 0;
64 Float_t dxism =0, dyism = 0;
66 GenerateBox(ism,xism,yism,dxism,dyism);
68 TEveFrameBox *pmdModBox = new TEveFrameBox();
69 pmdModBox->SetAAQuadXY(xism, yism, 0, dxism, dyism);
70 pmdModBox->SetFrameColor(Color_t(31));
71 pmdModBox->SetFrameFill(kTRUE);
74 SetName(smodule.Data());
76 Reset(TEveQuadSet::kQT_HexagonXY, kFALSE, 32);
78 fH1 = new TH1F("fH1", smodule.Data(), 100, 0., 1000.);
80 fH1->GetXaxis()->SetTitle("Single Cell Edep (adc)");
83 // -------------------------------------------------------------------- //
85 void AliEvePMDModule::DisplayDigitsData(Int_t ism, TTree *pmdt)
87 // Populate internal structures with data from pmdt for module ism.
91 Int_t det, smn, irow, icol, adc;
92 Int_t xpad = 0, ypad = 0;
95 TClonesArray *digits = new TClonesArray("AliPMDdigit", 0);
97 TBranch *branch = pmdt->GetBranch("PMDDigit");
98 branch->SetAddress(&digits);
100 AliPMDdigit *pmddigit;
102 branch->GetEntry(ism);
103 Int_t nentries = digits->GetLast();
104 //printf("%d\n", nentries);
106 for (Int_t ient = 0; ient < nentries+1; ient++)
108 pmddigit = (AliPMDdigit*)digits->UncheckedAt(ient);
110 det = pmddigit->GetDetector();
111 smn = pmddigit->GetSMNumber();
112 irow = pmddigit->GetRow();
113 icol = pmddigit->GetColumn();
114 adc = (Int_t) pmddigit->GetADC();
121 else if(smn >=12 && smn < 24)
127 RectGeomCellPos(smn, xpad, ypad, xpos, ypos);
129 AddHexagon(xpos, ypos, fgkZpos, fgkRad);
133 QuadId(new AliPMDdigit(*pmddigit));
134 // new TNamed(Form("Quad with idx=%d", ient),
135 // "This title is not confusing."));
142 fgPreTotAdc += (Int_t) adc;
147 fgCpvTotAdc += (Int_t) adc;
150 fH1->Fill((Float_t)adc);
156 RefMainTrans().SetPos(fX, fY, fZ);
161 // -------------------------------------------------------------------- //
163 void AliEvePMDModule::DisplayRawData(Int_t ism, TObjArray *ddlcont)
165 // Populate internal structures with data from ddlcont for module ism.
169 if (ism > 23) ism -= 24;
171 Int_t det, smn, irow, icol, adc;
172 Int_t xpad = 0, ypad = 0;
175 Int_t nentries = ddlcont->GetEntries();
176 //printf("%d\n", nentries);
178 for (Int_t ient = 0; ient < nentries; ient++)
180 AliPMDddldata *pmdddl = (AliPMDddldata*)ddlcont->UncheckedAt(ient);
182 det = pmdddl->GetDetector();
183 smn = pmdddl->GetSMN();
184 if (smn != ism) continue;
185 irow = pmdddl->GetRow();
186 icol = pmdddl->GetColumn();
187 adc = pmdddl->GetSignal();
194 else if(smn >=12 && smn < 24)
200 RectGeomCellPos(smn, xpad, ypad, xpos, ypos);
202 AddHexagon(xpos, ypos, fgkZpos, fgkRad);
206 QuadId(new AliPMDddldata(*pmdddl));
207 //new TNamed(Form("Quad with idx=%d", ient),
208 // "This title is not confusing."));
215 fgPreTotAdc += (Int_t) adc;
220 fgCpvTotAdc += (Int_t) adc;
224 fH1->Fill((Float_t) adc);
229 RefMainTrans().SetPos(fX, fY, fZ);
233 // -------------------------------------------------------------------- //
235 void AliEvePMDModule::RectGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad,
236 Float_t &xpos, Float_t &ypos)
238 // This routine finds the cell eta,phi for the new PMD rectangular
240 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
241 // modified by B. K. Nandi for change of coordinate sys
243 // SMA ---> Supermodule Type A ( SM - 0)
244 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
245 // SMB ---> Supermodule Type B ( SM - 2)
246 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
248 // ism : Serial module number from 0 to 23 for each plane
251 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
253 const Double_t kXcorner[24] =
255 74.8833, 53.0045, 31.1255, //Type-A
256 74.8833, 53.0045, 31.1255, //Type-A
257 -74.8833, -53.0044, -31.1255, //Type-AR
258 -74.8833, -53.0044, -31.1255, //Type-AR
259 8.9165, -33.7471, //Type-B
260 8.9165, -33.7471, //Type-B
261 8.9165, -33.7471, //Type-B
262 -8.9165, 33.7471, //Type-BR
263 -8.9165, 33.7471, //Type-BR
264 -8.9165, 33.7471, //Type-BR
268 const Double_t kYcorner[24] =
270 86.225, 86.225, 86.225, //Type-A
271 37.075, 37.075, 37.075, //Type-A
272 -86.225, -86.225, -86.225, //Type-AR
273 -37.075, -37.075, -37.075, //Type-AR
274 86.225, 86.225, //Type-B
275 61.075, 61.075, //Type-B
276 35.925, 35.925, //Type-B
277 -86.225, -86.225, //Type-BR
278 -61.075, -61.075, //Type-BR
279 -35.925, -35.925 //Type-BR
283 // const Float_t kSqroot3 = 1.732050808; // sqrt(3.);
284 // const Float_t kCellRadius = 0.25;
287 //Every even row of cells is shifted and placed
288 //in geant so this condition
303 ypos = kYcorner[ism] - (Float_t) xpad*fgkRad*2.0 - shift;
304 xpos = kXcorner[ism] - (Float_t) ypad*fgkSqRoot3*fgkRad;
306 else if(ism >=6 && ism < 12)
308 ypos = kYcorner[ism] + (Float_t) xpad*fgkRad*2.0 + shift;
309 xpos = kXcorner[ism] + (Float_t) ypad*fgkSqRoot3*fgkRad;
311 else if(ism >= 12 && ism < 18)
313 ypos = kYcorner[ism] - (Float_t) xpad*fgkRad*2.0 - shift;
314 xpos = kXcorner[ism] - (Float_t) ypad*fgkSqRoot3*fgkRad;
316 else if(ism >= 18 && ism < 24)
318 ypos = kYcorner[ism] + (Float_t) xpad*fgkRad*2.0 + shift;
319 xpos = kXcorner[ism] + (Float_t) ypad*fgkSqRoot3*fgkRad;
324 // -------------------------------------------------------------------- //
326 void AliEvePMDModule::GenerateBox(Int_t ism, Float_t &xism, Float_t &yism,
327 Float_t &dxism, Float_t &dyism)
329 // Generate bounding-box.
331 const Float_t kDia = 0.50;
333 const Double_t kXcorner[24] =
335 74.8833, 53.0045, 31.1255, //Type-A
336 74.8833, 53.0045, 31.1255, //Type-A
337 -74.8833, -53.0044, -31.1255, //Type-AR
338 -74.8833, -53.0044, -31.1255, //Type-AR
339 8.9165, -33.7471, //Type-B
340 8.9165, -33.7471, //Type-B
341 8.9165, -33.7471, //Type-B
342 -8.9165, 33.7471, //Type-BR
343 -8.9165, 33.7471, //Type-BR
344 -8.9165, 33.7471, //Type-BR
348 const Double_t kYcorner[24] =
350 86.225, 86.225, 86.225, //Type-A
351 37.075, 37.075, 37.075, //Type-A
352 -86.225, -86.225, -86.225, //Type-AR
353 -37.075, -37.075, -37.075, //Type-AR
354 86.225, 86.225, //Type-B
355 61.075, 61.075, //Type-B
356 35.925, 35.925, //Type-B
357 -86.225, -86.225, //Type-BR
358 -61.075, -61.075, //Type-BR
359 -35.925, -35.925 //Type-BR
363 if (ism > 23) ism -= 24;
368 xism = kXcorner[ism] + fgkRad;
369 yism = kYcorner[ism] + fgkRad;
370 dxism = -fgkRad*fgkSqRoot3*48.;
371 dyism = -kDia*96. - fgkRad;
373 if (ism >= 6 && ism < 12)
375 xism = kXcorner[ism] - fgkRad;
376 yism = kYcorner[ism] - fgkRad;
377 dxism = fgkRad*fgkSqRoot3*48.;
378 dyism = kDia*96. + fgkRad;
380 if (ism >= 12 && ism < 18)
382 xism = kXcorner[ism] + fgkRad;
383 yism = kYcorner[ism] + fgkRad;
384 dxism = -fgkRad*fgkSqRoot3*96.;
385 dyism = -kDia*48. - fgkRad;
387 if (ism >= 18 && ism < 24)
389 xism = kXcorner[ism] - fgkRad;
390 yism = kYcorner[ism] - fgkRad;
391 dxism = fgkRad*fgkSqRoot3*96.;
392 dyism = kDia*48. + fgkRad;
397 // -------------------------------------------------------------------- //
399 void AliEvePMDModule::SetPosition(Float_t x, Float_t y, Float_t z)
401 // Set position of module.
408 // -------------------------------------------------------------------- //