1 #ifndef ALIFMDESDREVERTEXER_H
2 #define ALIFMDESDREVERTEXER_H
7 // Class to recaculate quantities in an AliESDFMD object based on new
8 // a value for the z-coordinate of the primary interaction point.
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.
14 class AliFMDESDRevertexer
21 AliFMDESDRevertexer();
26 virtual ~AliFMDESDRevertexer() {}
28 * Revertex the passed ESD. The passed ESD object will be modified
31 * @param fmdEsd ESD object to revertex.
32 * @param vz New Z coordinate of primary vertex.
34 * @return @c true on success, @c false failure.
36 Bool_t Revertex(AliESDFMD* fmdEsd, Double_t vz) const;
39 * Calculate the physical coordinates (@a eta, @a phi) corresponding
40 * to the detector coordinates (@a det, @a rng, @a sec, @a str).
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
52 Bool_t PhysicalCoordinates(UShort_t det,
60 Double_t& theta) const;
63 * Calculate the polar angle @f$ \theta@f$ corresponding to the
64 * psuedo-rapidity @f$ \eta@f$
66 * @param eta Psuedo rapidity @f$ \eta=-\log[\tan(\theta/2)]@f$
68 * @return Polar angle @f$ \theta=2\atan[\exp(-\eta)]@f$
70 Double_t Eta2Theta(Double_t eta) const;
75 # ifndef ALIFMDGEOMETRY_H
76 # include <AliFMDGeometry.h>
79 # include <AliESDFMD.h>
82 //____________________________________________________________________
84 AliFMDESDRevertexer::AliFMDESDRevertexer()
87 AliFMDGeometry* geom = AliFMDGeometry::Instance();
89 geom->InitTransformations();
92 //____________________________________________________________________
94 AliFMDESDRevertexer::Revertex(AliESDFMD* fmdEsd, Double_t vz) const
96 // Revertex the passed ESD. The passed ESD object will be modified
100 // fmdEsd ESD object to revertex.
101 // vz New Z coordinate of primary vertex.
104 // kTRUE on success, kFALSE failure.
105 if (!fmdEsd) return kFALSE;
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,
122 fmdEsd->SetEta(det, rng, sec0, str, eta);
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.
133 if (fmdEsd->IsAngleCorrected())
134 corr = TMath::Abs(TMath::Cos(theta) / TMath::Cos(oldTheta));
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);
146 //____________________________________________________________________
148 AliFMDESDRevertexer::Eta2Theta(Double_t eta) const
150 // Calculate the polar angle @f$ \theta@f$ corresponding to the
151 // psuedo-rapidity @f$ \eta@f$
154 // eta Psuedo rapidity @f$ \eta=-\log[\tan(\theta/2)]@f$
156 // Polar angle @f$ \theta=2\atan[\exp(-\eta)]@f$
157 return 2 * TMath::ATan(TMath::Exp(-eta));
161 //____________________________________________________________________
163 AliFMDESDRevertexer::PhysicalCoordinates(UShort_t det,
171 Double_t& theta) const
173 // Calculate the physical coordinates (@a eta, @a phi) corresponding
174 // to the detector coordinates (@a det, @a rng, @a sec, @a str).
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);
190 // Check that the conversion succeeded
191 if (x == 0 && y == 0 && z == 0) return kFALSE;
193 // Correct for vertex offset.
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));