X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=STEER%2FAliESDFMD.cxx;h=3d092a0c80bd0407cd6c42e4289f804741ab0e07;hb=8fa875cbcdc9ecc2c31edb6cb8be77941903b10c;hp=49f49a2c5c9b6d5422c54d014bc4fa5a4dce5310;hpb=6169f936bbf9b2270d92661a7936ca90c4d1ae7e;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliESDFMD.cxx b/STEER/AliESDFMD.cxx index 49f49a2c5c9..3d092a0c80b 100755 --- a/STEER/AliESDFMD.cxx +++ b/STEER/AliESDFMD.cxx @@ -26,6 +26,7 @@ #include "AliESDFMD.h" // ALIFMDESD_H #include "AliLog.h" // ALILOG_H #include "Riostream.h" // ROOT_Riostream +#include //____________________________________________________________________ ClassImp(AliESDFMD) @@ -34,16 +35,87 @@ 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, - AliFMDFloatMap::kMaxStrips) + AliFMDFloatMap::kMaxStrips), + fNoiseFactor(0), + fAngleCorrected(kFALSE) { // Default CTOR } @@ -52,7 +124,9 @@ AliESDFMD::AliESDFMD() AliESDFMD::AliESDFMD(const AliESDFMD& other) : TObject(other), fMultiplicity(other.fMultiplicity), - fEta(other.fEta) + fEta(other.fEta), + fNoiseFactor(other.fNoiseFactor), + fAngleCorrected(other.fAngleCorrected) { // Default CTOR } @@ -62,11 +136,36 @@ AliESDFMD& AliESDFMD::operator=(const AliESDFMD& other) { // Default CTOR - fMultiplicity = other.fMultiplicity; - fEta = other.fEta; + if(this!=&other){ + TObject::operator=(other); + fMultiplicity = other.fMultiplicity; + fEta = other.fEta; + } return *this; } +//____________________________________________________________________ +void +AliESDFMD::Copy(TObject &obj) const +{ + // this overwrites the virtual TOBject::Copy() + // to allow run time copying without casting + // in AliESDEvent + + if(this==&obj)return; + AliESDFMD *robj = dynamic_cast(&obj); + if(!robj)return; // not an AliESDFMD + *robj = *this; +} + +//____________________________________________________________________ +void +AliESDFMD::CheckNeedUShort(TFile* file) +{ + fMultiplicity.CheckNeedUShort(file); + fEta.CheckNeedUShort(file); +} + //____________________________________________________________________ void AliESDFMD::Clear(Option_t* ) @@ -103,6 +202,62 @@ AliESDFMD::Eta(UShort_t detector, Char_t ring, UShort_t /* sector */, 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[,]. + // + 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[,]. + // + // 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[,]. + // + + // 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, @@ -130,19 +285,31 @@ AliESDFMD::SetEta(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; - for (size_t det = 1; det <= fMultiplicity.MaxDetectors(); det++) { - for (size_t ir = 0; ir < fMultiplicity.MaxRings(); ir++) { + 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'); std::cout << "FMD" << det << ring << ":" << std::endl; - for (size_t sec = 0; sec < fMultiplicity.MaxSectors(); sec++) { + for (UShort_t sec = 0; sec < fMultiplicity.MaxSectors(); sec++) { std::cout << " Sector # " << sec << ":" << std::flush; - for (size_t str = 0; str < fMultiplicity.MaxStrips(); str++) { + for (UShort_t str = 0; str < fMultiplicity.MaxStrips(); str++) { if (str % 6 == 0) std::cout << "\n " << std::flush; Float_t m = fMultiplicity(det, ring, sec, str); Float_t e = fEta(det, ring, 0, str); @@ -158,6 +325,7 @@ AliESDFMD::Print(Option_t* /* option*/) const } } } +#endif }