1 #include <AliFMDESDRevertexer.h>
2 #include <AliFMDGeometry.h>
7 ClassImp(AliFMDESDRevertexer)
12 //____________________________________________________________________
13 AliFMDESDRevertexer::AliFMDESDRevertexer()
15 AliFMDGeometry* geom = AliFMDGeometry::Instance();
17 geom->InitTransformations();
20 //____________________________________________________________________
22 AliFMDESDRevertexer::Revertex(AliESDFMD* fmdEsd, Double_t vz) const
24 if (!fmdEsd) return kFALSE;
27 for (UShort_t det = 1; det <= 3; det++) {
28 UShort_t nrng = (det == 1 ? 1 : 2);
29 for (UShort_t ir = 0; ir < nrng; ir++) {
30 Char_t rng = (ir == 0 ? 'I' : 'O');
31 UShort_t nsec = (ir == 0 ? 20 : 40);
32 UShort_t nstr = (ir == 0 ? 512 : 256);
33 for (UShort_t str = 0; str < nstr; str++) {
34 Double_t phi, r, theta;
35 Double_t eta = AliESDFMD::kInvalidEta;
36 Double_t oldEta = fmdEsd->Eta(det, rng, 0, str);
37 if (oldEta == AliESDFMD::kInvalidEta) continue;
39 Double_t oldTheta = Eta2Theta(oldEta);
40 Bool_t ret1 = PhysicalCoordinates(det, rng, 0, str, vz,
42 fmdEsd->SetEta(det, rng, 0, str, eta);
45 // If the was an error, then there's no reason to go on with
46 // this strip-ring. Note, that the eta is correctly set to
47 // AliESDFMD::kInvalidMult.
48 AliWarning(Form("Failed to calculate eta, phi for "
49 "FMD%d%c[%02d,%03d] with v_z=%9.4f",
50 det, rng, 0, str, vz));
55 Double_t corr = TMath::Abs(TMath::Cos(theta));
56 if (fmdEsd->IsAngleCorrected())
57 corr /= TMath::Abs(TMath::Cos(oldTheta));
58 for (UShort_t sec = 0; sec < nsec; sec++) {
59 Double_t mult = fmdEsd->Multiplicity(det, rng, sec, str);
60 if (mult == AliESDFMD::kInvalidMult) continue;
61 fmdEsd->SetMultiplicity(det, rng, sec, str, corr * mult);
70 //____________________________________________________________________
72 AliFMDESDRevertexer::Eta2Theta(Double_t eta) const
74 return 2 * TMath::ATan(TMath::Exp(-eta));
78 //____________________________________________________________________
80 AliFMDESDRevertexer::PhysicalCoordinates(UShort_t det,
88 Double_t& theta) const
90 // Get the eta and phi of a digit
93 AliFMDGeometry* geom = AliFMDGeometry::Instance();
94 Double_t x=0, y=0, z=0;
95 geom->Detector2XYZ(det, rng, sec, str, x, y, z);
97 // Check that the conversion succeeded
98 if (x == 0 && y == 0 && z == 0) return kFALSE;
100 // Correct for vertex offset.
102 phi = TMath::ATan2(y, x);
103 r = TMath::Sqrt(y * y + x * x);
104 theta = TMath::ATan2(r, z);
105 eta = -TMath::Log(TMath::Tan(theta / 2));