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 // Recalculate the various quantities based on updated
25 // primary vertex position.
28 // fmdEsd FMD ESD object
29 // vz New vertex location (along the z-axis)
32 // true on success, false if there was an error during the
33 // recalculations. Please inspect log output for details.
35 if (!fmdEsd) return kFALSE;
38 for (UShort_t det = 1; det <= 3; det++) {
39 UShort_t nrng = (det == 1 ? 1 : 2);
40 for (UShort_t ir = 0; ir < nrng; ir++) {
41 Char_t rng = (ir == 0 ? 'I' : 'O');
42 UShort_t nsec = (ir == 0 ? 20 : 40);
43 UShort_t nstr = (ir == 0 ? 512 : 256);
44 for (UShort_t str = 0; str < nstr; str++) {
45 Double_t phi, r, theta;
46 Double_t eta = AliESDFMD::kInvalidEta;
47 Double_t oldEta = fmdEsd->Eta(det, rng, 0, str);
48 // if (oldEta == AliESDFMD::kInvalidEta) continue;
50 Double_t oldTheta = Eta2Theta(oldEta);
51 Bool_t ret1 = PhysicalCoordinates(det, rng, 0, str, vz,
53 fmdEsd->SetEta(det, rng, 0, str, eta);
56 // If the was an error, then there's no reason to go on with
57 // this strip-ring. Note, that the eta is correctly set to
58 // AliESDFMD::kInvalidMult.
59 AliWarning(Form("Failed to calculate eta, phi for "
60 "FMD%d%c[%02d,%03d] with v_z=%9.4f",
61 det, rng, 0, str, vz));
66 Double_t corr = TMath::Abs(TMath::Cos(theta));
67 if (fmdEsd->IsAngleCorrected()) {
68 if (oldEta != AliESDFMD::kInvalidMult)
69 corr /= TMath::Abs(TMath::Cos(oldTheta));
70 for (UShort_t sec = 0; sec < nsec; sec++) {
71 Double_t mult = fmdEsd->Multiplicity(det, rng, sec, str);
72 if (mult == AliESDFMD::kInvalidMult) continue;
73 fmdEsd->SetMultiplicity(det, rng, sec, str, corr * mult);
83 //____________________________________________________________________
85 AliFMDESDRevertexer::Eta2Theta(Double_t eta) const
87 if (eta == AliESDFMD::kInvalidEta) return 0;
88 return 2 * TMath::ATan(TMath::Exp(-eta));
92 //____________________________________________________________________
94 AliFMDESDRevertexer::PhysicalCoordinates(UShort_t det,
102 Double_t& theta) const
104 // Get the eta and phi of a digit
107 AliFMDGeometry* geom = AliFMDGeometry::Instance();
108 Double_t x=0, y=0, z=0;
109 geom->Detector2XYZ(det, rng, sec, str, x, y, z);
111 return AliFMDGeometry::XYZ2REtaPhiTheta(x, y, z-vz, r, eta, phi, theta);