Line data Source code
1 : #ifndef ALIHLTMUONCALCULATIONS_H
2 : #define ALIHLTMUONCALCULATIONS_H
3 : /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : // $Id$
7 :
8 : ////////////////////////////////////////////////////////////////////////////////
9 : //
10 : // Author: Artur Szostak
11 : // Email: artur@alice.phy.uct.ac.za | artursz@iafrica.com
12 : //
13 : ////////////////////////////////////////////////////////////////////////////////
14 :
15 : #include "AliHLTMUONDataTypes.h"
16 :
17 : extern "C" struct AliHLTMUONTriggerRecordStruct;
18 :
19 : /*
20 : * Note: this class uses static global variables so thread protection must be
21 : * explicit in any multi-threaded usage. Or the class should be rewritten.
22 : */
23 : class AliHLTMUONCalculations
24 : {
25 : public:
26 :
27 : /// Calculates the momentum estimate given two track points behind the
28 : /// dipole magnet and assuming origin is the interaction point.
29 : static bool ComputeMomentum(
30 : AliHLTFloat32_t x1,
31 : AliHLTFloat32_t y1, AliHLTFloat32_t y2,
32 : AliHLTFloat32_t z1, AliHLTFloat32_t z2
33 : );
34 :
35 0 : static AliHLTFloat32_t Zf() { return fgZf; }
36 0 : static void Zf(AliHLTFloat32_t value) { fgZf = value; }
37 : static AliHLTFloat32_t QBL();
38 : static void QBL(AliHLTFloat32_t value);
39 :
40 0 : static AliHLTMUONParticleSign Sign() { return fgSign; }
41 0 : static AliHLTFloat32_t Px() { return fgPx; }
42 0 : static AliHLTFloat32_t Py() { return fgPy; }
43 0 : static AliHLTFloat32_t Pz() { return fgPz; }
44 :
45 : /// Calculates the invariant mass for a pair of particles.
46 : static AliHLTFloat32_t ComputeMass(
47 : AliHLTFloat32_t massA,
48 : AliHLTFloat32_t pxA,
49 : AliHLTFloat32_t pyA,
50 : AliHLTFloat32_t pzA,
51 : AliHLTFloat32_t massB,
52 : AliHLTFloat32_t pxB,
53 : AliHLTFloat32_t pyB,
54 : AliHLTFloat32_t pzB
55 : );
56 :
57 : static bool FitLineToTriggerRecord(const AliHLTMUONTriggerRecordStruct& trigger);
58 :
59 : static bool FitLineToTriggerRecord(
60 : const AliHLTMUONTriggerRecordStruct& trigger,
61 : const bool hitset[4]
62 : );
63 :
64 : static bool FitLine(
65 : const AliHLTMUONTriggerRecordStruct& trigger,
66 : const bool hitset[4]
67 : );
68 :
69 0 : static AliHLTFloat32_t IdealZ1() { return fgIdealZ1; }
70 0 : static void IdealZ1(AliHLTFloat32_t value) { fgIdealZ1 = value; }
71 0 : static AliHLTFloat32_t IdealZ2() { return fgIdealZ2; }
72 0 : static void IdealZ2(AliHLTFloat32_t value) { fgIdealZ2 = value; }
73 :
74 0 : static AliHLTFloat32_t IdealX1() { return fgIdealX1; }
75 0 : static AliHLTFloat32_t IdealY1() { return fgIdealY1; }
76 0 : static AliHLTFloat32_t IdealX2() { return fgIdealX2; }
77 0 : static AliHLTFloat32_t IdealY2() { return fgIdealY2; }
78 :
79 : static bool FitLineToData(
80 : const AliHLTFloat32_t* x, const AliHLTFloat32_t* y,
81 : const AliHLTFloat32_t* z, AliHLTUInt32_t n
82 : );
83 :
84 : static bool FitLineToData(
85 : const AliHLTFloat32_t* x, const AliHLTFloat32_t* z,
86 : AliHLTUInt32_t n
87 : );
88 :
89 0 : static AliHLTFloat32_t Mzx() { return fgMzx; }
90 : static AliHLTFloat32_t Mzy() { return fgMzy; }
91 0 : static AliHLTFloat32_t Czx() { return fgCzx; }
92 : static AliHLTFloat32_t Czy() { return fgCzy; }
93 :
94 : static AliHLTFloat32_t ComputeChi2(
95 : const AliHLTFloat32_t* x, const AliHLTFloat32_t* y,
96 : const AliHLTFloat32_t* z, AliHLTUInt32_t n
97 : );
98 :
99 : static AliHLTFloat32_t ComputeChi2(
100 : const AliHLTMUONTriggerRecordStruct& trigger,
101 : const bool hitset[4]
102 : );
103 :
104 : static AliHLTFloat32_t SigmaX2() { return fgSigmaX2; }
105 0 : static void SigmaX2(AliHLTFloat32_t value) { fgSigmaX2 = (value != 0 ? value : 1.); }
106 : static AliHLTFloat32_t SigmaY2() { return fgSigmaY2; }
107 0 : static void SigmaY2(AliHLTFloat32_t value) { fgSigmaY2 = (value != 0 ? value : 1.); }
108 :
109 : private:
110 :
111 : // Prevent destroying or creating of this object.
112 : AliHLTMUONCalculations();
113 : ~AliHLTMUONCalculations();
114 :
115 : static AliHLTFloat32_t fgZf; /// The Z coordinate of the middle of the dipole magnetic field.
116 : static AliHLTFloat32_t fgQBLScaled; /// The integrated field strength times units of charge (T.m.*c/1e9)
117 :
118 : static AliHLTMUONParticleSign fgSign; /// The calculated sign.
119 : static AliHLTFloat32_t fgPx; /// The calculated X momentum (GeV/c).
120 : static AliHLTFloat32_t fgPy; /// The calculated Y momentum (GeV/c).
121 : static AliHLTFloat32_t fgPz; /// The calculated Z momentum (GeV/c).
122 :
123 : static AliHLTFloat32_t fgSigmaX2; /// The sigma squared value for the variance / uncertainty in X coordinates.
124 : static AliHLTFloat32_t fgSigmaY2; /// The sigma squared value for the variance / uncertainty in Y coordinates.
125 :
126 : static AliHLTFloat32_t fgMzx; /// Calculated slope of the line fitted to the ZX plane. (x = fgMzx * z + fgCzx)
127 : static AliHLTFloat32_t fgMzy; /// Calculated slope of the line fitted to the ZY plane. (y = fgMzy * z + fgCzy)
128 : static AliHLTFloat32_t fgCzx; /// Calculated coefficient of the line fitted to the ZX plane. (x = fgMzx * z + fgCzx)
129 : static AliHLTFloat32_t fgCzy; /// Calculated coefficient of the line fitted to the ZY plane. (y = fgMzy * z + fgCzy)
130 :
131 : static AliHLTFloat32_t fgIdealX1; /// Ideal X coordinate of the point on MT1
132 : static AliHLTFloat32_t fgIdealY1; /// Ideal Y coordinate of the point on MT1
133 : static AliHLTFloat32_t fgIdealZ1; /// Ideal Z coordinate of the point on MT1
134 : static AliHLTFloat32_t fgIdealX2; /// Ideal X coordinate of the point on MT2
135 : static AliHLTFloat32_t fgIdealY2; /// Ideal Y coordinate of the point on MT2
136 : static AliHLTFloat32_t fgIdealZ2; /// Ideal Z coordinate of the point on MT2
137 : };
138 :
139 : #endif // ALIHLTMUONCALCULATIONS_H
|