Line data Source code
1 : #include <AliFMDESDRevertexer.h>
2 : #include <AliFMDGeometry.h>
3 : #include <AliESDFMD.h>
4 : #include <TMath.h>
5 : #include <AliLog.h>
6 :
7 12 : ClassImp(AliFMDESDRevertexer)
8 : #if 0 // for emacs
9 : ;
10 : #endif
11 :
12 : //____________________________________________________________________
13 8 : AliFMDESDRevertexer::AliFMDESDRevertexer()
14 40 : {
15 8 : AliFMDGeometry* geom = AliFMDGeometry::Instance();
16 8 : geom->Init();
17 8 : geom->InitTransformations();
18 16 : }
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 16 : if (!fmdEsd) return kFALSE;
36 :
37 : Bool_t ret = kTRUE;
38 64 : for (UShort_t det = 1; det <= 3; det++) {
39 24 : UShort_t nrng = (det == 1 ? 1 : 2);
40 128 : for (UShort_t ir = 0; ir < nrng; ir++) {
41 40 : Char_t rng = (ir == 0 ? 'I' : 'O');
42 40 : UShort_t nsec = (ir == 0 ? 20 : 40);
43 40 : UShort_t nstr = (ir == 0 ? 512 : 256);
44 32848 : for (UShort_t str = 0; str < nstr; str++) {
45 16384 : Double_t phi, r, theta;
46 16384 : Double_t eta = AliESDFMD::kInvalidEta;
47 16384 : Double_t oldEta = fmdEsd->Eta(det, rng, 0, str);
48 : // if (oldEta == AliESDFMD::kInvalidEta) continue;
49 :
50 16384 : Double_t oldTheta = Eta2Theta(oldEta);
51 16384 : Bool_t ret1 = PhysicalCoordinates(det, rng, 0, str, vz,
52 : eta, phi, r, theta);
53 16384 : fmdEsd->SetEta(det, rng, 0, str, eta);
54 :
55 16384 : 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 0 : 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 0 : continue;
64 : }
65 :
66 16384 : Double_t corr = TMath::Abs(TMath::Cos(theta));
67 16384 : if (fmdEsd->IsAngleCorrected()) {
68 16384 : if (oldEta != AliESDFMD::kInvalidMult)
69 16384 : corr /= TMath::Abs(TMath::Cos(oldTheta));
70 851968 : for (UShort_t sec = 0; sec < nsec; sec++) {
71 409600 : Double_t mult = fmdEsd->Multiplicity(det, rng, sec, str);
72 409600 : if (mult == AliESDFMD::kInvalidMult) continue;
73 409600 : fmdEsd->SetMultiplicity(det, rng, sec, str, corr * mult);
74 409600 : }
75 16384 : }
76 32768 : }
77 : }
78 : }
79 :
80 8 : return ret;
81 8 : }
82 :
83 : //____________________________________________________________________
84 : Double_t
85 : AliFMDESDRevertexer::Eta2Theta(Double_t eta) const
86 : {
87 32768 : if (eta == AliESDFMD::kInvalidEta) return 0;
88 16384 : return 2 * TMath::ATan(TMath::Exp(-eta));
89 16384 : }
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 32768 : AliFMDGeometry* geom = AliFMDGeometry::Instance();
108 16384 : Double_t x=0, y=0, z=0;
109 16384 : geom->Detector2XYZ(det, rng, sec, str, x, y, z);
110 :
111 32768 : return AliFMDGeometry::XYZ2REtaPhiTheta(x, y, z-vz, r, eta, phi, theta);
112 16384 : }
113 :
114 :
|