1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////////
20 // Author: Artur Szostak
21 // Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
23 ////////////////////////////////////////////////////////////////////////////////
25 #include "AliHLTMUONCalculations.h"
28 AliHLTFloat32_t AliHLTMUONCalculations::fgZf = -975.0; // cm
30 AliHLTFloat32_t AliHLTMUONCalculations::fgQBLScaled
31 = 3.0 * 2.99792458e8 / 1e9; // T.m.*c/1e9
33 AliHLTMUONParticleSign AliHLTMUONCalculations::fgSign = kSignUnknown;
34 AliHLTFloat32_t AliHLTMUONCalculations::fgPx = 0;
35 AliHLTFloat32_t AliHLTMUONCalculations::fgPy = 0;
36 AliHLTFloat32_t AliHLTMUONCalculations::fgPz = 0;
39 bool AliHLTMUONCalculations::ComputeMomentum(
41 AliHLTFloat32_t y1, AliHLTFloat32_t y2,
42 AliHLTFloat32_t z1, AliHLTFloat32_t z2
45 AliHLTFloat64_t z2mz1 = z2 - z1;
46 if (z2mz1 == 0 or z1 == 0)
48 fgSign = kSignUnknown;
49 fgPx = fgPy = fgPz = 0;
52 AliHLTFloat64_t thetaTimesZf = (y1*z2 - y2*z1) / z2mz1;
53 AliHLTFloat64_t xf = x1 * fgZf / z1;
54 AliHLTFloat64_t yf = y2 - ((y2-y1) * (z2-fgZf)) / z2mz1;
56 if (thetaTimesZf == 0)
58 fgSign = kSignUnknown;
59 fgPx = fgPy = fgPz = 0;
62 AliHLTFloat64_t pDivZf = (fgQBLScaled / thetaTimesZf);
63 AliHLTFloat64_t p = pDivZf * fgZf;
64 pDivZf = fabs(pDivZf);
71 fgSign = kSignUnknown;
73 fgPx = AliHLTFloat32_t( pDivZf * xf );
74 fgPy = AliHLTFloat32_t( pDivZf * yf );
75 fgPz = AliHLTFloat32_t( sqrt(p*p - fgPx*fgPx - fgPy*fgPy) );
76 // fgPz must be the same sign as fgZf else it could not have been measured.
77 if (fgZf < 0) fgPz = -fgPz;
83 AliHLTFloat32_t AliHLTMUONCalculations::QBL()
85 // We have to convert back into Tesla metres.
86 return fgQBLScaled * 1e9 / 2.99792458e8;
90 void AliHLTMUONCalculations::QBL(AliHLTFloat32_t value)
92 // Note: 2.99792458e8/1e9 is the conversion factor for GeV.
93 // It is c/1e9, where c is the speed of light.
94 fgQBLScaled = value * 2.99792458e8 / 1e9;