]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDESDRevertexer.h
Getting rid of obsolete objects.
[u/mrichter/AliRoot.git] / FMD / AliFMDESDRevertexer.h
CommitLineData
50b9d194 1#ifndef ALIFMDESDREVERTEXER_H
2#define ALIFMDESDREVERTEXER_H
3# include <Rtypes.h>
4class ::AliESDFMD;
5
6//
7// Class to recaculate quantities in an AliESDFMD object based on new
8// a value for the z-coordinate of the primary interaction point.
9//
10// This allows us, in case we get a better determination of the
11// z-coordinate of the primary interaction, to recalibrate the signals
12// in the FMD ESD object, without having to redo the reconstruction.
13//
14class AliFMDESDRevertexer
15{
16public:
17 /**
18 * Constructor
19 *
20 */
21 AliFMDESDRevertexer();
22 /**
23 * Destructor
24 *
25 */
26 virtual ~AliFMDESDRevertexer() {}
27 /**
28 * Revertex the passed ESD. The passed ESD object will be modified
29 * directly.
30 *
31 * @param fmdEsd ESD object to revertex.
32 * @param vz New Z coordinate of primary vertex.
33 *
34 * @return @c true on success, @c false failure.
35 */
36 Bool_t Revertex(AliESDFMD* fmdEsd, Double_t vz) const;
37
38 /**
39 * Calculate the physical coordinates (@a eta, @a phi) corresponding
40 * to the detector coordinates (@a det, @a rng, @a sec, @a str).
41 *
42 * @param det The detector identifier
43 * @param rng The ring identifier
44 * @param sec The sector identifier
45 * @param str The strip identifier
46 * @param vz The z coordinate of the current primary interation vertex
47 * @param eta On return, the psuedo-rapidity
48 * @param phi On return, the azimuthal angle
49 * @param r On return, the radius
50 * @param theta On return, the polar angle
51 */
52 Bool_t PhysicalCoordinates(UShort_t det,
53 Char_t rng,
54 UShort_t sec,
55 UShort_t str,
56 Double_t vz,
57 Double_t& eta,
58 Double_t& phi,
59 Double_t& r,
60 Double_t& theta) const;
61
62 /**
63 * Calculate the polar angle @f$ \theta@f$ corresponding to the
64 * psuedo-rapidity @f$ \eta@f$
65 *
66 * @param eta Psuedo rapidity @f$ \eta=-\log[\tan(\theta/2)]@f$
67 *
e5571b63 68 * @return Polar angle @f$ \theta=2\tan^{-1}[\exp(-\eta)]@f$
50b9d194 69 */
70 Double_t Eta2Theta(Double_t eta) const;
71protected:
72};
73
74# ifndef __CINT__
75# ifndef ALIFMDGEOMETRY_H
76# include <AliFMDGeometry.h>
77# endif
78# ifndef ALIESDFMD_H
79# include <AliESDFMD.h>
80# endif
81
82//____________________________________________________________________
83inline
84AliFMDESDRevertexer::AliFMDESDRevertexer()
85{
86 // Constructor
87 AliFMDGeometry* geom = AliFMDGeometry::Instance();
88 geom->Init();
89 geom->InitTransformations();
90}
91
92//____________________________________________________________________
93inline Bool_t
94AliFMDESDRevertexer::Revertex(AliESDFMD* fmdEsd, Double_t vz) const
95{
96 // Revertex the passed ESD. The passed ESD object will be modified
97 // directly.
98 //
99 // Parameters:
100 // fmdEsd ESD object to revertex.
101 // vz New Z coordinate of primary vertex.
102 //
103 // Return:
104 // kTRUE on success, kFALSE failure.
105 if (!fmdEsd) return kFALSE;
106
107 Bool_t ret = kTRUE;
108 const UShort_t sec0 = 0;
109 for (UShort_t det = 1; det <= 3; det++) {
110 UShort_t nrng = (det == 1 ? 1 : 2);
111 for (UShort_t ir = 0; ir < nrng; ir++) {
112 Char_t rng = (ir == 0 ? 'I' : 'O');
113 UShort_t nsec = (ir == 0 ? 20 : 40);
114 UShort_t nstr = (ir == 0 ? 512 : 256);
115 for (UShort_t str = 0; str < nstr; str++) {
116 Double_t phi, r, theta;
117 Double_t eta = AliESDFMD::kInvalidEta;
118 Double_t oldEta = fmdEsd->Eta(det, rng, 0u, str);
119 Double_t oldTheta = Eta2Theta(oldEta);
120 Bool_t ret1 = PhysicalCoordinates(det, rng, sec0, str, vz,
121 eta, phi, r, theta);
122 fmdEsd->SetEta(det, rng, sec0, str, eta);
123
124 if (!ret1) {
125 // If the was an error, then there's no reason to go on with
126 // this strip-ring. Note, that the eta is correctly set to
127 // AliESDFMD::kInvalidMult.
128 ret = kFALSE;
129 continue;
130 }
131
f70f588a 132 Double_t corr = 1;
50b9d194 133 if (fmdEsd->IsAngleCorrected())
f70f588a 134 corr = TMath::Abs(TMath::Cos(theta) / TMath::Cos(oldTheta));
50b9d194 135 for (UShort_t sec = 0; sec < nsec; sec++) {
136 Double_t mult = fmdEsd->Multiplicity(det, rng, sec, str);
137 fmdEsd->SetMultiplicity(det, rng, sec, str, corr * mult);
138 }
139 }
140 }
141 }
142
143 return ret;
144}
145
146//____________________________________________________________________
147inline Double_t
148AliFMDESDRevertexer::Eta2Theta(Double_t eta) const
149{
150 // Calculate the polar angle @f$ \theta@f$ corresponding to the
151 // psuedo-rapidity @f$ \eta@f$
152 //
153 // Parameters:
154 // eta Psuedo rapidity @f$ \eta=-\log[\tan(\theta/2)]@f$
155 // Return:
e5571b63 156 // Polar angle @f$ \theta=2\atan[\exp(-\eta)]@f$
50b9d194 157 return 2 * TMath::ATan(TMath::Exp(-eta));
158}
159
160
161//____________________________________________________________________
162inline Bool_t
163AliFMDESDRevertexer::PhysicalCoordinates(UShort_t det,
164 Char_t rng,
165 UShort_t sec,
166 UShort_t str,
167 Double_t vz,
168 Double_t& eta,
169 Double_t& phi,
170 Double_t& r,
171 Double_t& theta) const
172{
173 // Calculate the physical coordinates (@a eta, @a phi) corresponding
174 // to the detector coordinates (@a det, @a rng, @a sec, @a str).
175 //
176 // Parameters:
177 // det The detector identifier
178 // rng The ring identifier
179 // sec The sector identifier
180 // str The strip identifier
181 // vz The z coordinate of the current primary interation vertex
182 // eta On return, the psuedo-rapidity
183 // phi On return, the azimuthal angle
184 // r On return, the radius
185 // phi On return, the polar angle
186 AliFMDGeometry* geom = AliFMDGeometry::Instance();
187 Double_t x=0, y=0, z=0;
188 geom->Detector2XYZ(det, rng, sec, str, x, y, z);
189
190 // Check that the conversion succeeded
191 if (x == 0 && y == 0 && z == 0) return kFALSE;
192
193 // Correct for vertex offset.
8161c5f7 194 z -= vz;
50b9d194 195 phi = TMath::ATan2(y, x);
196 r = TMath::Sqrt(y * y + x * x);
197 theta = TMath::ATan2(r, z);
198 eta = -TMath::Log(TMath::Tan(theta / 2));
199
200 return kTRUE;
201}
202# endif // __CINT__
203#endif
204//
205// Local Variables:
206// mode: C++
207// End:
208//
209
210
211