AliRoot Core  3dc7879 (3dc7879)
AliFMDESDRevertexer.cxx
Go to the documentation of this file.
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 //____________________________________________________________________
14 {
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
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.
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 
Geometry mananger for the FMD.
virtual void InitTransformations(Bool_t force=kFALSE)
Bool_t IsAngleCorrected() const
Definition: AliESDFMD.h:219
TVectorD vz
Definition: driftITSTPC.C:87
#define AliWarning(message)
Definition: AliLog.h:541
void SetMultiplicity(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Float_t mult)
Definition: AliESDFMD.cxx:268
void SetEta(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Float_t eta)
Definition: AliESDFMD.cxx:281
Singleton object of FMD geometry descriptions and parameters. This class is a singleton that handles ...
Float_t Multiplicity(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
Definition: AliESDFMD.cxx:185
Float_t Eta(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip) const
Definition: AliESDFMD.cxx:198
Double_t Eta2Theta(Double_t eta) const
void Detector2XYZ(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip, Double_t &x, Double_t &y, Double_t &z) const
Event Summary Data for the Forward Multiplicity Detector.This stores the psuedo-multiplicity and -rap...
Definition: AliESDFMD.h:30
virtual void Init()
Bool_t PhysicalCoordinates(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, Double_t vz, Double_t &eta, Double_t &phi, Double_t &r, Double_t &theta) const
static Bool_t XYZ2REtaPhiTheta(Double_t x, Double_t y, Double_t z, Double_t &r, Double_t &eta, Double_t &phi, Double_t &theta)
Bool_t Revertex(AliESDFMD *fmdEsd, Double_t vz) const
TEveGeoShape * geom
Definition: tpc_tracks.C:10
static AliFMDGeometry * Instance()