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()
60 void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t ium, Int_t xpad, Int_t ypad, Float_t &xpos, Float_t &ypos)
62 // This routine finds the cell eta,phi for the new PMD rectangular
64 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
65 // modified by B. K. Nnadi for change of coordinate sys
67 // SMA ---> Supermodule Type A ( SM - 0)
68 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
69 // SMB ---> Supermodule Type B ( SM - 2)
70 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
72 // ism : number of supermodules in one plane = 4
73 // ium : number of unitmodules in one SM = 6
74 // gbum : (global) unit module numbering in a supermodule
77 Int_t gbum = ism*6 + ium;
81 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
87 74.8833, 53.0045, 31.1255, //Type-A
88 74.8833, 53.0045, 31.1255, //Type-A
89 -74.8833, -53.0044, -31.1255, //Type-AR
90 -74.8833, -53.0044, -31.1255, //Type-AR
91 8.9165, -33.7471, //Type-B
92 8.9165, -33.7471, //Type-B
93 8.9165, -33.7471, //Type-B
94 -8.9165, 33.7471, //Type-BR
95 -8.9165, 33.7471, //Type-BR
96 -8.9165, 33.7471, //Type-BR
102 86.225, 86.225, 86.225, //Type-A
103 37.075, 37.075, 37.075, //Type-A
104 -86.225, -86.225, -86.225, //Type-AR
105 -37.075, -37.075, -37.075, //Type-AR
106 86.225, 86.225, //Type-B
107 61.075, 61.075, //Type-B
108 35.925, 35.925, //Type-B
109 -86.225, -86.225, //Type-BR
110 -61.075, -61.075, //Type-BR
111 -35.925, -35.925 //Type-BR
115 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
116 const Float_t kCellRadius = 0.25;
119 //Every even row of cells is shifted and placed
120 //in geant so this condition
122 Float_t cellRadius = 0.25;
126 shift = -cellRadius/2.0;
135 ypos = ycorner[gbum] - irow*kCellRadius*2.0 + shift;
136 xpos = xcorner[gbum] - icol*kSqroot3*kCellRadius;
140 ypos = ycorner[gbum] + irow*kCellRadius*2.0 + shift;
141 xpos = xcorner[gbum] + icol*kSqroot3*kCellRadius;
145 ypos = ycorner[gbum] - irow*kCellRadius*2.0 + shift;
146 xpos = xcorner[gbum] - icol*kSqroot3*kCellRadius;
150 ypos = ycorner[gbum] + irow*kCellRadius*2.0 + shift;
151 xpos = xcorner[gbum] + icol*kSqroot3*kCellRadius;
156 void AliPMDUtility::RectGeomCellPos(Int_t ism, Int_t ium, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
158 // If the xpad and ypad inputs are float, then 0.5 is added to it
159 // to find the layer which is shifted.
160 // This routine finds the cell eta,phi for the new PMD rectangular
162 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
163 // modified by B. K. Nnadi for change of coordinate sys
165 // SMA ---> Supermodule Type A ( SM - 0)
166 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
167 // SMB ---> Supermodule Type B ( SM - 2)
168 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
170 // ism : number of supermodules in one plane = 4
171 // ium : number of unitmodules in one SM = 6
172 // gbum : (global) unit module numbering in a supermodule
175 Int_t gbum = ism*6 + ium;
179 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
184 74.8833, 53.0045, 31.1255, //Type-A
185 74.8833, 53.0045, 31.1255, //Type-A
186 -74.8833, -53.0044, -31.1255, //Type-AR
187 -74.8833, -53.0044, -31.1255, //Type-AR
188 8.9165, -33.7471, //Type-B
189 8.9165, -33.7471, //Type-B
190 8.9165, -33.7471, //Type-B
191 -8.9165, 33.7471, //Type-BR
192 -8.9165, 33.7471, //Type-BR
193 -8.9165, 33.7471, //Type-BR
200 86.225, 86.225, 86.225, //Type-A
201 37.075, 37.075, 37.075, //Type-A
202 -86.225, -86.225, -86.225, //Type-AR
203 -37.075, -37.075, -37.075, //Type-AR
204 86.225, 86.225, //Type-B
205 61.075, 61.075, //Type-B
206 35.925, 35.925, //Type-B
207 -86.225, -86.225, //Type-BR
208 -61.075, -61.075, //Type-BR
209 -35.925, -35.925 //Type-BR
213 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
214 const Float_t kCellRadius = 0.25;
217 //Every even row of cells is shifted and placed
218 //in geant so this condition
220 Float_t cellRadius = 0.25;
222 Int_t iirow = (Int_t) (irow+0.5);
225 shift = -cellRadius/2.0;
235 ypos = ycorner[gbum] - irow*kCellRadius*2.0 + shift;
236 xpos = xcorner[gbum] - icol*kSqroot3*kCellRadius;
240 ypos = ycorner[gbum] + irow*kCellRadius*2.0 + shift;
241 xpos = xcorner[gbum] + icol*kSqroot3*kCellRadius;
245 ypos = ycorner[gbum] - irow*kCellRadius*2.0 + shift;
246 xpos = xcorner[gbum] - icol*kSqroot3*kCellRadius;
250 ypos = ycorner[gbum] + irow*kCellRadius*2.0 + shift;
251 xpos = xcorner[gbum] + icol*kSqroot3*kCellRadius;
258 void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
265 void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
271 void AliPMDUtility::CalculateEta()
273 Float_t rpxpy, theta, eta;
275 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
276 theta = TMath::ATan2(rpxpy,fPz);
277 eta = -TMath::Log(TMath::Tan(0.5*theta));
281 void AliPMDUtility::CalculatePhi()
283 Float_t pybypx, phi = 0., phi1;
288 if(fPy<0) phi = 270.;
293 if(pybypx < 0) pybypx = - pybypx;
294 phi1 = TMath::ATan(pybypx)*180./3.14159;
296 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
297 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
298 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
299 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
302 phi = phi*3.14159/180.;
307 void AliPMDUtility::CalculateEtaPhi()
309 Float_t rpxpy, theta, eta;
310 Float_t pybypx, phi = 0., phi1;
312 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
313 theta = TMath::ATan2(rpxpy,fPz);
314 eta = -TMath::Log(TMath::Tan(0.5*theta));
319 if(fPy<0) phi = 270.;
324 if(pybypx < 0) pybypx = - pybypx;
325 phi1 = TMath::ATan(pybypx)*180./3.14159;
326 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
327 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
328 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
329 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
332 phi = phi*3.14159/180.;
338 Float_t AliPMDUtility::GetTheta() const
342 Float_t AliPMDUtility::GetEta() const
346 Float_t AliPMDUtility::GetPhi() const