X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDCalibGain.cxx;h=72ac806bd7f9c7cca6620a4fd0909d971e739def;hb=f0465e68ed0e6cef2ac66ad03502329dc63580bd;hp=509c2f677dbaf24d1d6ab54a57c67c6c62f96389;hpb=e064ab4a83279327e11ee30ca4f4d84e33087d6f;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDCalibGain.cxx b/FMD/AliFMDCalibGain.cxx index 509c2f677db..72ac806bd7f 100644 --- a/FMD/AliFMDCalibGain.cxx +++ b/FMD/AliFMDCalibGain.cxx @@ -30,6 +30,10 @@ #include #include #include +#include "AliFMDDebug.h" + +#include "AliFMDBoolMap.h" + //____________________________________________________________________ ClassImp(AliFMDCalibGain) @@ -61,6 +65,7 @@ AliFMDCalibGain& AliFMDCalibGain::operator=(const AliFMDCalibGain& o) { // Assignment operator + if (&o == this) return *this; fValue = o.fValue; fThreshold = o.fThreshold; return (*this); @@ -85,6 +90,67 @@ AliFMDCalibGain::Value(UShort_t det, Char_t ring, UShort_t sec, return fValue(det, ring, sec, str); } +//____________________________________________________________________ +namespace { + struct MakeDead : public AliFMDMap::ForOne + { + MakeDead(AliFMDBoolMap* dead, Float_t min, Float_t max) + : fDead(dead), fMin(min), fMax(max), fCount(0) + {} + MakeDead(const MakeDead& other) + : AliFMDMap::ForOne(other), + fDead(other.fDead), fMin(other.fMin), fMax(other.fMax), + fCount(other.fCount) + {} + MakeDead& operator=(const MakeDead& other) + { + if (&other == this) return *this; + fDead = other.fDead; + fMin = other.fMin; + fMax = other.fMax; + fCount = other.fCount; + return *this; + } + Bool_t operator()(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t v) + { + AliDebugGeneral("AliFMDCalibGain::MakeDeadMap", 100, + Form("Checking if gain of FMD%d%c[%2d,%3d]=%f " + "is out of range [%f,%f]", + d, r, s, t, v, fMin, fMax)); + if (v > fMax || v < fMin) { + fDead->operator()(d,r,s,t) = kTRUE; + fCount++; + } + return kTRUE; + } + Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Int_t) + { return kFALSE; } + Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, UShort_t) + { return kFALSE; } + Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Bool_t) + { return kFALSE; } + AliFMDBoolMap* fDead; + Float_t fMin; + Float_t fMax; + Int_t fCount; + }; +} + +//____________________________________________________________________ +AliFMDBoolMap* +AliFMDCalibGain::MakeDeadMap(Float_t min, Float_t max, + AliFMDBoolMap* dead) const +{ + if (!dead) { + dead = new AliFMDBoolMap(0,0,0,0); + dead->Reset(kFALSE); + } + MakeDead dm(dead, min, max); + fValue.ForEach(dm); + AliFMDDebug(1, ("Found a total of %d dead channels", dm.fCount)); + return dead; +} + //____________________________________________________________________ Bool_t AliFMDCalibGain::ReadFromFile(std::istream& in)