]>
Commit | Line | Data |
---|---|---|
1 | #include <AliFMDESDRevertexer.h> | |
2 | #include <AliFMDGeometry.h> | |
3 | #include <AliESDFMD.h> | |
4 | #include <TMath.h> | |
5 | #include <AliLog.h> | |
6 | ||
7 | ClassImp(AliFMDESDRevertexer) | |
8 | #if 0 // for emacs | |
9 | ; | |
10 | #endif | |
11 | ||
12 | //____________________________________________________________________ | |
13 | AliFMDESDRevertexer::AliFMDESDRevertexer() | |
14 | { | |
15 | AliFMDGeometry* geom = AliFMDGeometry::Instance(); | |
16 | geom->Init(); | |
17 | geom->InitTransformations(); | |
18 | } | |
19 | ||
20 | //____________________________________________________________________ | |
21 | Bool_t | |
22 | AliFMDESDRevertexer::Revertex(AliESDFMD* fmdEsd, Double_t vz) const | |
23 | { | |
24 | // Recalculate the various quantities based on updated | |
25 | // primary vertex position. | |
26 | // | |
27 | // Parameters: | |
28 | // fmdEsd FMD ESD object | |
29 | // vz New vertex location (along the z-axis) | |
30 | // | |
31 | // Return: | |
32 | // true on success, false if there was an error during the | |
33 | // recalculations. Please inspect log output for details. | |
34 | // | |
35 | if (!fmdEsd) return kFALSE; | |
36 | ||
37 | Bool_t ret = kTRUE; | |
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; | |
49 | ||
50 | Double_t oldTheta = Eta2Theta(oldEta); | |
51 | Bool_t ret1 = PhysicalCoordinates(det, rng, 0, str, vz, | |
52 | eta, phi, r, theta); | |
53 | fmdEsd->SetEta(det, rng, 0, str, eta); | |
54 | ||
55 | if (!ret1) { | |
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)); | |
62 | ret = kFALSE; | |
63 | continue; | |
64 | } | |
65 | ||
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); | |
74 | } | |
75 | } | |
76 | } | |
77 | } | |
78 | } | |
79 | ||
80 | return ret; | |
81 | } | |
82 | ||
83 | //____________________________________________________________________ | |
84 | Double_t | |
85 | AliFMDESDRevertexer::Eta2Theta(Double_t eta) const | |
86 | { | |
87 | if (eta == AliESDFMD::kInvalidEta) return 0; | |
88 | return 2 * TMath::ATan(TMath::Exp(-eta)); | |
89 | } | |
90 | ||
91 | ||
92 | //____________________________________________________________________ | |
93 | Bool_t | |
94 | AliFMDESDRevertexer::PhysicalCoordinates(UShort_t det, | |
95 | Char_t rng, | |
96 | UShort_t sec, | |
97 | UShort_t str, | |
98 | Double_t vz, | |
99 | Double_t& eta, | |
100 | Double_t& phi, | |
101 | Double_t& r, | |
102 | Double_t& theta) const | |
103 | { | |
104 | // Get the eta and phi of a digit | |
105 | // | |
106 | // Get geometry. | |
107 | AliFMDGeometry* geom = AliFMDGeometry::Instance(); | |
108 | Double_t x=0, y=0, z=0; | |
109 | geom->Detector2XYZ(det, rng, sec, str, x, y, z); | |
110 | ||
111 | return AliFMDGeometry::XYZ2REtaPhiTheta(x, y, z-vz, r, eta, phi, theta); | |
112 | } | |
113 | ||
114 |