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 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. Nandi 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 : Serial module number from 0 to 23 for each plane
75 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
79 74.8833, 53.0045, 31.1255, //Type-A
80 74.8833, 53.0045, 31.1255, //Type-A
81 -74.8833, -53.0044, -31.1255, //Type-AR
82 -74.8833, -53.0044, -31.1255, //Type-AR
83 8.9165, -33.7471, //Type-B
84 8.9165, -33.7471, //Type-B
85 8.9165, -33.7471, //Type-B
86 -8.9165, 33.7471, //Type-BR
87 -8.9165, 33.7471, //Type-BR
88 -8.9165, 33.7471, //Type-BR
94 86.225, 86.225, 86.225, //Type-A
95 37.075, 37.075, 37.075, //Type-A
96 -86.225, -86.225, -86.225, //Type-AR
97 -37.075, -37.075, -37.075, //Type-AR
98 86.225, 86.225, //Type-B
99 61.075, 61.075, //Type-B
100 35.925, 35.925, //Type-B
101 -86.225, -86.225, //Type-BR
102 -61.075, -61.075, //Type-BR
103 -35.925, -35.925 //Type-BR
107 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
108 const Float_t kCellRadius = 0.25;
111 //Every even row of cells is shifted and placed
112 //in geant so this condition
114 Float_t cellRadius = 0.25;
118 shift = -cellRadius/2.0;
128 ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
129 xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
131 else if(ism >=6 && ism < 12)
133 ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
134 xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
136 else if(ism >= 12 && ism < 18)
138 ypos = ycorner[ism] - (Float_t) xpad*kCellRadius*2.0 + shift;
139 xpos = xcorner[ism] - (Float_t) ypad*kSqroot3*kCellRadius;
141 else if(ism >= 18 && ism < 24)
143 ypos = ycorner[ism] + (Float_t) xpad*kCellRadius*2.0 + shift;
144 xpos = xcorner[ism] + (Float_t) ypad*kSqroot3*kCellRadius;
149 void AliPMDUtility::RectGeomCellPos(Int_t ism, Float_t xpad, Float_t ypad, Float_t &xpos, Float_t &ypos)
151 // If the xpad and ypad inputs are float, then 0.5 is added to it
152 // to find the layer which is shifted.
153 // This routine finds the cell eta,phi for the new PMD rectangular
155 // Authors : Bedanga Mohanty and Dipak Mishra - 29.4.2003
156 // modified by B. K. Nnadi for change of coordinate sys
158 // SMA ---> Supermodule Type A ( SM - 0)
159 // SMAR ---> Supermodule Type A ROTATED ( SM - 1)
160 // SMB ---> Supermodule Type B ( SM - 2)
161 // SMBR ---> Supermodule Type B ROTATED ( SM - 3)
163 // ism : Serial Module number from 0 to 23 for each plane
165 // Corner positions (x,y) of the 24 unit moudles in ALICE PMD
169 74.8833, 53.0045, 31.1255, //Type-A
170 74.8833, 53.0045, 31.1255, //Type-A
171 -74.8833, -53.0044, -31.1255, //Type-AR
172 -74.8833, -53.0044, -31.1255, //Type-AR
173 8.9165, -33.7471, //Type-B
174 8.9165, -33.7471, //Type-B
175 8.9165, -33.7471, //Type-B
176 -8.9165, 33.7471, //Type-BR
177 -8.9165, 33.7471, //Type-BR
178 -8.9165, 33.7471, //Type-BR
185 86.225, 86.225, 86.225, //Type-A
186 37.075, 37.075, 37.075, //Type-A
187 -86.225, -86.225, -86.225, //Type-AR
188 -37.075, -37.075, -37.075, //Type-AR
189 86.225, 86.225, //Type-B
190 61.075, 61.075, //Type-B
191 35.925, 35.925, //Type-B
192 -86.225, -86.225, //Type-BR
193 -61.075, -61.075, //Type-BR
194 -35.925, -35.925 //Type-BR
198 const Float_t kSqroot3 = 1.73205; // sqrt(3.);
199 const Float_t kCellRadius = 0.25;
202 //Every even row of cells is shifted and placed
203 //in geant so this condition
205 Float_t cellRadius = 0.25;
207 Int_t iirow = (Int_t) (xpad+0.5);
210 shift = -cellRadius/2.0;
219 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
220 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
222 else if(ism >=6 && ism < 12)
224 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
225 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
227 else if(ism >= 12 && ism < 18)
229 ypos = ycorner[ism] - xpad*kCellRadius*2.0 + shift;
230 xpos = xcorner[ism] - ypad*kSqroot3*kCellRadius;
232 else if(ism >= 18 && ism < 24)
234 ypos = ycorner[ism] + xpad*kCellRadius*2.0 + shift;
235 xpos = xcorner[ism] + ypad*kSqroot3*kCellRadius;
240 void AliPMDUtility::SetPxPyPz(Float_t px, Float_t py, Float_t pz)
247 void AliPMDUtility::SetXYZ(Float_t xpos, Float_t ypos, Float_t zpos)
253 void AliPMDUtility::CalculateEta()
255 Float_t rpxpy, theta, eta;
257 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
258 theta = TMath::ATan2(rpxpy,fPz);
259 eta = -TMath::Log(TMath::Tan(0.5*theta));
263 void AliPMDUtility::CalculatePhi()
265 Float_t pybypx, phi = 0., phi1;
270 if(fPy<0) phi = 270.;
275 if(pybypx < 0) pybypx = - pybypx;
276 phi1 = TMath::ATan(pybypx)*180./3.14159;
278 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
279 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
280 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
281 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
284 phi = phi*3.14159/180.;
289 void AliPMDUtility::CalculateEtaPhi()
291 Float_t rpxpy, theta, eta;
292 Float_t pybypx, phi = 0., phi1;
294 rpxpy = TMath::Sqrt(fPx*fPx + fPy*fPy);
295 theta = TMath::ATan2(rpxpy,fPz);
296 eta = -TMath::Log(TMath::Tan(0.5*theta));
301 if(fPy<0) phi = 270.;
306 if(pybypx < 0) pybypx = - pybypx;
307 phi1 = TMath::ATan(pybypx)*180./3.14159;
308 if(fPx > 0 && fPy > 0) phi = phi1; // 1st Quadrant
309 if(fPx < 0 && fPy > 0) phi = 180 - phi1; // 2nd Quadrant
310 if(fPx < 0 && fPy < 0) phi = 180 + phi1; // 3rd Quadrant
311 if(fPx > 0 && fPy < 0) phi = 360 - phi1; // 4th Quadrant
314 phi = phi*3.14159/180.;
320 Float_t AliPMDUtility::GetTheta() const
324 Float_t AliPMDUtility::GetEta() const
328 Float_t AliPMDUtility::GetPhi() const