1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 //-----------------------------------------------------//
18 // Date : August 05 2003 //
20 // Utility code for ALICE-PMD //
22 //-----------------------------------------------------//
24 #include "Riostream.h"
25 #include "AliPMDUtility.h"
31 ClassImp(AliPMDUtility)
33 AliPMDUtility::AliPMDUtility()
35 // Default constructor
44 AliPMDUtility::AliPMDUtility(Float_t px, Float_t py, Float_t pz)
55 AliPMDUtility::~AliPMDUtility()
59 void AliPMDUtility::HexGeomCellPos(Int_t ism, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
61 // This converts PMD cluster or CELL coordinates
62 // to Global coordinates.
63 // Written by Prof. S.C. Phatak
65 const Float_t kCellDia = 0.5;
66 const Float_t kPi = TMath::Pi(); //3.14159;
67 const Double_t kSqroot3by2 = 0.8660254; // sqrth = sqrt(3.)/2.
74 Supermodeule number starting from 0
75 ism --> supermodule no ( 0 - 26 )
76 idet --> detector ( pmd or cpv : not required now )
77 j --> xpad ( goes from 1 to 72 )
78 k --> ypad ( goes from 1 to 72 )
79 xp --> global x coordinate
80 yp --> global y coordinate
82 (xp0,yp0) corner positions of all supermodules in global
83 coordinate system. That is the origin
84 of the local ( supermodule ) coordinate system.
89 -17.9084, 18.2166, 54.3416, -35.9709, 0.154144,
90 36.2791, -54.0334, -17.9084, 18.2166, 36.7791,
91 18.7166, 0.654194, 72.9041, 54.8416, 36.7792,
92 109.029, 90.9666, 72.9042, -18.8708, -36.9334,
93 -54.996, -36.9332, -54.9958, -73.0584, -54.9956,
99 -32.1395, -32.1395, -32.1395, -63.4247, -63.4247,
100 -63.4247, -94.7098, -94.7098, -94.7098, 0.545689,
101 31.8309, 63.1161, 0.545632, 31.8308, 63.116,
102 0.545573, 31.8308, 63.116, 31.5737, 0.288616,
103 -30.9965, 62.859, 31.5738, 0.288733, 94.1442,
108 angles of rotation for three sets of supermodules
109 The angle is same for first nine, next nine and last nine
113 Float_t th[3] = {0., -2.*kPi/3., 2.*kPi/3.};
114 Float_t xr, yr, xinit, yinit, cs, sn;
117 xinit and yinit are coordinates of the cell in local coordinate system
120 xinit = (j)*kCellDia+(k)/2.*kCellDia;
121 yinit = kSqroot3by2*(k)/2.;
128 xr=cs*xinit+sn*yinit;
129 yr=-sn*xinit+cs*yinit;
138 void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t ium, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
140 // This routine finds the cell eta,phi for the new PMD rectangular
142 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
143 // modified by B. K. Nnadi for change of coordinate sys
145 // SMA ---> Supermodule Type A ( SM - 0)
146 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
147 // SMB ---> Supermodule Type B ( SM - 2)
148 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
150 // ism : number of supermodules in one plane = 4
151 // ium : number of unitmodules in one SM = 6
152 // gbum : (global) unit module numbering in a supermodule
155 Int_t gbum = ism*6 + ium;
159 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
161 Double_t xcorner[24] =
163 85.15, 60.85, 36.55, 85.15, 60.85, 36.55, //SMA
164 -85.15, -60.85, -36.55, -85.15, -60.85, -36.55, //SMAR
165 84.90, 36.60, 84.90, 36.60, 84.90, 36.60, //SMB
166 -84.90, -36.60, -84.90, -36.60, -84.90, -36.60 //SMBR
169 Double_t ycorner[24] =
171 32.45708755, 32.45708755, 32.45708755, //SMA
172 -9.30645245, -9.30645245, -9.30645245, //SMA
173 -32.45708755, -32.45708755, -32.45708755, //SMAR
174 9.30645245, 9.30645245, 9.30645245, //SMAR
175 -31.63540818, -31.63540818, -52.61435544, //SMB
176 -52.61435544, -73.59330270, -73.59330270, //SMB
177 31.63540818, 31.63540818, 52.61435544, //SMBR
178 52.61435544, 73.59330270, 73.59330270 //SMBR
181 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
182 const Float_t kCellRadius = 0.25;
185 //Every even row of cells is shifted and placed
186 //in geant so this condition
197 if(ism == 0 || ism == 2)
199 ypos = ycorner[gbum] +
200 irow*kCellRadius*kSqroot3;
202 xpos = xcorner[gbum] -
203 icol*2.0*kCellRadius - shift;
205 else if(ism == 1 || ism == 3)
207 ypos = ycorner[gbum] -
208 irow*kCellRadius*kSqroot3;
210 xpos = xcorner[gbum] +
211 icol*2.0*kCellRadius + shift;
215 void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t ium, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
217 // If the xpad and ypad inputs are float, then 0.5 is added to it
218 // to find the layer which is shifted.
219 // This routine finds the cell eta,phi for the new PMD rectangular
221 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
222 // modified by B. K. Nnadi for change of coordinate sys
224 // SMA ---> Supermodule Type A ( SM - 0)
225 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
226 // SMB ---> Supermodule Type B ( SM - 2)
227 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
229 // ism : number of supermodules in one plane = 4
230 // ium : number of unitmodules in one SM = 6
231 // gbum : (global) unit module numbering in a supermodule
234 Int_t gbum = ism*6 + ium;
238 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
240 Double_t xcorner[24] =
242 85.15, 60.85, 36.55, 85.15, 60.85, 36.55, //SMA
243 -85.15, -60.85, -36.55, -85.15, -60.85, -36.55, //SMAR
244 84.90, 36.60, 84.90, 36.60, 84.90, 36.60, //SMB
245 -84.90, -36.60, -84.90, -36.60, -84.90, -36.60 //SMBR
248 Double_t ycorner[24] =
250 32.45708755, 32.45708755, 32.45708755, //SMA
251 -9.30645245, -9.30645245, -9.30645245, //SMA
252 -32.45708755, -32.45708755, -32.45708755, //SMAR
253 9.30645245, 9.30645245, 9.30645245, //SMAR
254 -31.63540818, -31.63540818, -52.61435544, //SMB
255 -52.61435544, -73.59330270, -73.59330270, //SMB
256 31.63540818, 31.63540818, 52.61435544, //SMBR
257 52.61435544, 73.59330270, 73.59330270 //SMBR
260 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
261 const Float_t kCellRadius = 0.25;
264 //Every even row of cells is shifted and placed
265 //in geant so this condition
268 Int_t iirow = (Int_t) (irow+0.5);
277 if(ism == 0 || ism == 2)
279 ypos = ycorner[gbum] +
280 irow*kCellRadius*kSqroot3;
282 xpos = xcorner[gbum] -
283 icol*2.0*kCellRadius - shift;
285 else if(ism == 1 || ism == 3)
287 ypos = ycorner[gbum] -
288 irow*kCellRadius*kSqroot3;
290 xpos = xcorner[gbum] +
291 icol*2.0*kCellRadius + shift;
295 void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
302 void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
308 void AliPMDUtility::CalculateEta()
310 Float_t rpxpy, theta, eta;
312 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
313 theta = TMath::ATan2(rpxpy,fPz);
314 eta = -TMath::Log(TMath::Tan(0.5*theta));
318 void AliPMDUtility::CalculatePhi()
320 Float_t pybypx, phi = 0., phi1;
325 if(fPy<0) phi = 270.;
330 if(pybypx < 0) pybypx = - pybypx;
331 phi1 = TMath::ATan(pybypx)*180./3.14159;
333 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
334 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
335 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
336 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
339 phi = phi*3.14159/180.;
344 void AliPMDUtility::CalculateEtaPhi()
346 Float_t rpxpy, theta, eta;
347 Float_t pybypx, phi = 0., phi1;
349 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
350 theta = TMath::ATan2(rpxpy,fPz);
351 eta = -TMath::Log(TMath::Tan(0.5*theta));
356 if(fPy<0) phi = 270.;
361 if(pybypx < 0) pybypx = - pybypx;
362 phi1 = TMath::ATan(pybypx)*180./3.14159;
363 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
364 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
365 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
366 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
369 phi = phi*3.14159/180.;
375 Float_t AliPMDUtility::GetTheta() const
379 Float_t AliPMDUtility::GetEta() const
383 Float_t AliPMDUtility::GetPhi() const