#include "AliESDFMD.h" // ALIFMDESD_H
#include "AliLog.h" // ALILOG_H
#include "Riostream.h" // ROOT_Riostream
+#include <TMath.h>
//____________________________________________________________________
ClassImp(AliESDFMD)
#endif
+//____________________________________________________________________
+namespace {
+ // Private implementation of a AliFMDMap::ForOne to use in
+ // forwarding to AliESDFMD::ForOne
+ class ForMultiplicity : public AliFMDMap::ForOne
+ {
+ public:
+ ForMultiplicity(const AliESDFMD& o, AliESDFMD::ForOne& a)
+ : fObject(o), fAlgo(a)
+ {}
+ Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
+ Float_t m)
+ {
+ Float_t e = fObject.Eta(d, r, 0, t);
+ return fAlgo.operator()(d, r, s, t, m, e);
+ }
+ Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Int_t)
+ {
+ return kTRUE;
+ }
+ Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, UShort_t)
+ {
+ return kTRUE;
+ }
+ Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Bool_t)
+ {
+ return kTRUE;
+ }
+ protected:
+ const AliESDFMD& fObject;
+ AliESDFMD::ForOne& fAlgo;
+ };
+
+ // Private implementation of AliESDFMD::ForOne to print an
+ // object
+ class Printer : public AliESDFMD::ForOne
+ {
+ public:
+ Printer() : fOldD(0), fOldR('-'), fOldS(1024) {}
+ Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t,
+ Float_t m, Float_t e)
+ {
+ if (d != fOldD) {
+ if (fOldD != 0) printf("\n");
+ fOldD = d;
+ fOldR = '-';
+ printf("FMD%d", fOldD);
+ }
+ if (r != fOldR) {
+ fOldR = r;
+ fOldS = 1024;
+ printf("\n %s ring", (r == 'I' ? "Inner" : "Outer"));
+ }
+ if (s != fOldS) {
+ fOldS = s;
+ printf("\n Sector %d", fOldS);
+ }
+ if (t % 4 == 0) printf("\n %3d-%3d ", t, t+3);
+ if (m == AliESDFMD::kInvalidMult) printf("------/");
+ else printf("%6.3f/", m);
+ if (e == AliESDFMD::kInvalidEta) printf("------ ");
+ else printf("%6.3f ", e);
+
+ return kTRUE;
+ }
+ private:
+ UShort_t fOldD;
+ Char_t fOldR;
+ UShort_t fOldS;
+ };
+}
+
//____________________________________________________________________
AliESDFMD::AliESDFMD()
- : fMultiplicity(AliFMDFloatMap::kMaxDetectors,
- AliFMDFloatMap::kMaxRings,
- AliFMDFloatMap::kMaxSectors,
- AliFMDFloatMap::kMaxStrips),
+ : fMultiplicity(0, 0, 0, 0),
fEta(AliFMDFloatMap::kMaxDetectors,
AliFMDFloatMap::kMaxRings,
1,
return *this;
}
-void AliESDFMD::Copy(TObject &obj) const{
+//____________________________________________________________________
+void
+AliESDFMD::Copy(TObject &obj) const
+{
// this overwrites the virtual TOBject::Copy()
// to allow run time copying without casting
// in AliESDEvent
return fEta(detector, ring, 0, strip);
}
+//____________________________________________________________________
+Float_t
+AliESDFMD::Phi(UShort_t detector, Char_t ring, UShort_t sector, UShort_t) const
+{
+ // Return azimuthal angle (in degrees) of the strip
+ // FMD<detector><ring>[<sector>,<strip>].
+ //
+ Float_t baseAng = (detector == 1 ? 90 :
+ detector == 2 ? 0 : 180);
+ Float_t dAng = ((detector == 3 ? -1 : 1) * 360 /
+ (ring == 'I' || ring == 'i' ?
+ AliFMDMap::kNSectorInner :
+ AliFMDMap::kNSectorOuter));
+ Float_t ret = baseAng + dAng * (sector + .5);
+ if (ret > 360) ret -= 360;
+ if (ret < 0) ret += 360;
+ return ret;
+
+}
+
+//____________________________________________________________________
+Float_t
+AliESDFMD::Theta(UShort_t detector, Char_t ring, UShort_t, UShort_t strip) const
+{
+ // Return polar angle from beam line (in degrees) of the strip
+ // FMD<detector><ring>[<sector>,<strip>].
+ //
+ // This value is calculated from eta and therefor takes into account
+ // the Z position of the interaction point.
+ Float_t eta = Eta(detector, ring, 0, strip);
+ Float_t theta = TMath::ATan(2 * TMath::Exp(-eta));
+ if (theta < 0) theta += TMath::Pi();
+ theta *= 180. / TMath::Pi();
+ return theta;
+}
+
+//____________________________________________________________________
+Float_t
+AliESDFMD::R(UShort_t, Char_t ring, UShort_t, UShort_t strip) const
+{
+ // Return radial distance from beam line (in cm) of the strip
+ // FMD<detector><ring>[<sector>,<strip>].
+ //
+
+ // Numbers are from AliFMDRing
+ Float_t lR = (ring == 'I' || ring == 'i' ? 4.522 : 15.4);
+ Float_t hR = (ring == 'I' || ring == 'i' ? 17.2 : 28.0);
+ UShort_t nS = (ring == 'I' || ring == 'i' ?
+ AliFMDMap::kNStripInner :
+ AliFMDMap::kNStripOuter);
+ Float_t dR = (hR - lR) / nS;
+ Float_t ret = lR + dR * (strip + .5);
+ return ret;
+
+}
+
//____________________________________________________________________
void
AliESDFMD::SetMultiplicity(UShort_t detector, Char_t ring, UShort_t sector,
fEta(detector, ring, 0, strip) = eta;
}
+//____________________________________________________________________
+Bool_t
+AliESDFMD::ForEach(AliESDFMD::ForOne& a) const
+{
+ ForMultiplicity i(*this, a);
+ return fMultiplicity.ForEach(i);
+}
+
//____________________________________________________________________
void
AliESDFMD::Print(Option_t* /* option*/) const
{
// Print all information to standard output.
std::cout << "AliESDFMD:" << std::endl;
+ Printer p;
+ ForEach(p);
+ printf("\n");
+#if 0
for (UShort_t det = 1; det <= fMultiplicity.MaxDetectors(); det++) {
for (UShort_t ir = 0; ir < fMultiplicity.MaxRings(); ir++) {
Char_t ring = (ir == 0 ? 'I' : 'O');
}
}
}
+#endif
}