#ifndef ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H
#define ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H
-//////////////////////////////////////////////////////////////////////
-// Author: Henrik Tydesjo //
-// Class that simplifies the managing of dead and noisy pixels. //
-// Interface to the AliITSOnlineCalibrationSPD container object //
-// through reading and writing to TFile. //
-//////////////////////////////////////////////////////////////////////
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+/* $Id$ */
-#include "AliITSIntMap.h"
+//////////////////////////////////////////////////////////////////////////
+// Author: Henrik Tydesjo //
+// Class that simplifies the managing of dead and noisy pixels. //
+// Has interface to the AliITSOnlineCalibrationSPD container objects //
+// through reading and writing to TFile. //
+//////////////////////////////////////////////////////////////////////////
+
+
+#include "AliITSRawStreamSPD.h"
+#include <TString.h>
class TArrayI;
+class AliITSIntMap;
class AliITSOnlineCalibrationSPDhandler {
public:
AliITSOnlineCalibrationSPDhandler();
- AliITSOnlineCalibrationSPDhandler(UInt_t module);
AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle);
virtual ~AliITSOnlineCalibrationSPDhandler();
AliITSOnlineCalibrationSPDhandler& operator=(const AliITSOnlineCalibrationSPDhandler& handle);
+
+ void SetFileLocation(const Char_t* loc) {fFileLocation = loc;}
+ TString GetFileLocation() const {return fFileLocation;}
+
void ClearMaps();
- void WriteToFile();
- void WriteToFile(Char_t* fileName);
- Bool_t ReadFromFile();
- Bool_t ReadDeadFromFile();
- Bool_t ReadNoisyFromFile();
- Bool_t ReadFromFile(Char_t* fileName);
- Bool_t ReadDeadFromFile(Char_t* fileName);
- Bool_t ReadNoisyFromFile(Char_t* fileName);
- void SetModuleNr(UInt_t mod) {fModuleNr=mod;}
- UInt_t GetModuleNr() const {return fModuleNr;}
- void SetFileLocation(Char_t* loc) {sprintf(fFileLocation,"%s",loc);}
- UInt_t GetNrDead() const {return fDeadPixelMap.GetNrEntries();}
- UInt_t GetNrNoisy() const {return fNoisyPixelMap.GetNrEntries();}
- TArrayI GetDeadArray();
- TArrayI GetNoisyArray();
+ Bool_t ReadFromFiles();
+ Bool_t ReadDeadFromFiles();
+ Bool_t ReadNoisyFromFiles();
+ Bool_t ReadFromFile(UInt_t module);
+ Bool_t ReadDeadFromFile(UInt_t module);
+ Bool_t ReadNoisyFromFile(UInt_t module);
+ Bool_t ReadFromFileName(const char *fileName);
+ Bool_t ReadDeadFromFileName(const char *fileName);
+ Bool_t ReadNoisyFromFileName(const char *fileName);
+
+ void WriteToFilesAlways();
+ void WriteToFiles();
+ void WriteDeadToFiles();
+ void WriteNoisyToFiles();
+ void WriteToFile(UInt_t module);
+ void WriteDeadToFile(UInt_t module);
+ void WriteNoisyToFile(UInt_t module);
+
+#ifndef SPD_DA_OFF
+ Bool_t ReadModuleFromDB(UInt_t module, Int_t runNr);
+ Bool_t ReadFromDB(Int_t runNr);
+ Bool_t WriteToDB(Int_t runNrStart, Int_t runNrEnd);
+#endif
+ UInt_t ReadNoisyFromText(const char *fileName);
+ UInt_t ReadDeadFromText(const char *fileName);
+ void GenerateDCSConfigFile(const Char_t* fileName);
+
+ TArrayI GetDeadArray(UInt_t module);
+ TArrayI GetNoisyArray(UInt_t module);
void ResetDead();
- Bool_t SetDeadPixel(Int_t col, Int_t row);
- Int_t GetDeadColAt(UInt_t index) const;
- Int_t GetDeadRowAt(UInt_t index) const;
- Bool_t IsPixelDead(Int_t col, Int_t row) const;
+ void ResetDeadForChip(UInt_t eqId, UInt_t hs, UInt_t chip);
+ Bool_t SetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
+ Bool_t UnSetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
+ Bool_t IsPixelDead(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
+ Bool_t IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row);
+
+ UInt_t GetNrDead(UInt_t module) const;
+ UInt_t GetDeadEqIdAt(UInt_t module,UInt_t index);
+ UInt_t GetDeadHSAt(UInt_t module,UInt_t index);
+ UInt_t GetDeadChipAt(UInt_t module,UInt_t index);
+ UInt_t GetDeadColAt(UInt_t module,UInt_t index);
+ UInt_t GetDeadRowAt(UInt_t module,UInt_t index);
+
void ResetNoisy();
- Bool_t SetNoisyPixel(Int_t col, Int_t row);
- Int_t GetNoisyColAt(UInt_t index) const;
- Int_t GetNoisyRowAt(UInt_t index) const;
- Bool_t IsPixelNoisy(Int_t col, Int_t row) const;
+ void ResetNoisyForChip(UInt_t eqId, UInt_t hs, UInt_t chip);
+ Bool_t SetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
+ Bool_t UnSetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
+ Bool_t UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
+ Bool_t IsPixelNoisy(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
+ Bool_t IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row);
+
+ UInt_t GetNrNoisy(UInt_t module) const;
+ UInt_t GetNoisyEqIdAt(UInt_t module, UInt_t index);
+ UInt_t GetNoisyHSAt(UInt_t module, UInt_t index);
+ UInt_t GetNoisyChipAt(UInt_t module, UInt_t index);
+ UInt_t GetNoisyColAt(UInt_t module, UInt_t index);
+ UInt_t GetNoisyRowAt(UInt_t module, UInt_t index);
+ UInt_t GetNrDead() const;
+ UInt_t GetNrNoisy() const;
void PrintDead() const;
void PrintNoisy() const;
+ UInt_t GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+ UInt_t GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+ UInt_t GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+ AliITSOnlineCalibrationSPDhandler* GetDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+ AliITSOnlineCalibrationSPDhandler* GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+ AliITSOnlineCalibrationSPDhandler* GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const;
+
+
private:
- UInt_t fModuleNr; // module nr
- AliITSIntMap fDeadPixelMap; // list of dead pixels
- AliITSIntMap fNoisyPixelMap; // list of noisy pixels
- Char_t fFileLocation[200]; // location (dir) of file to read and write from
-
- Int_t GetKey(Int_t col, Int_t row) const {return col*256 + row;}
- Int_t GetColFromKey(Int_t key) const {return key/256;}
- Int_t GetRowFromKey(Int_t key) const {return key%256;}
+ TString fFileLocation; // location (dir) of files to read and write from
+ AliITSIntMap* fDeadPixelMap[240]; // lists of dead pixels for each module
+ AliITSIntMap* fNoisyPixelMap[240]; // lists of noisy pixels for each module
+ UInt_t fNrDead[240]; // nr of dead pixels for each module
+ UInt_t fNrNoisy[240]; // nr of noisy pixels for each module
+
+ Bool_t fModuleMapInited; // flag to know if arrays below are filled
+ UInt_t fiDDL[240]; // iDDL value for each module (inited when used, fModuleMapInited flag)
+ UInt_t fiModule[240]; // iModule value for each module (inited when used, fModuleMapInited flag)
+
+ Int_t GetKey(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const
+ {return eqId*6*10*32*256 + hs*10*32*256 + chip*32*256 + col*256 + row;}
+
+ UInt_t GetEqIdFromKey(Int_t key) const
+ {return key/(6*10*32*256);}
+ UInt_t GetHSFromKey(Int_t key) const
+ {return (key%(6*10*32*256))/(10*32*256);}
+ UInt_t GetChipFromKey(Int_t key) const
+ {return ((key%(6*10*32*256))%(10*32*256))/(32*256);}
+ UInt_t GetColFromKey(Int_t key) const
+ {return (((key%(6*10*32*256))%(10*32*256))%(32*256))/256;}
+ UInt_t GetRowFromKey(Int_t key) const
+ {return (((key%(6*10*32*256))%(10*32*256))%(32*256))%256;}
+ UInt_t GetModuleFromKey(Int_t key) const
+ {return AliITSRawStreamSPD::GetModuleNumber(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key));}
+ UInt_t GetColMFromKey(Int_t key) const
+ {return GetColFromKey(key) + 32 * (GetChipFromKey(key) % 5);}
+
+ void InitModuleMaps();
+ UInt_t GetEqIdFromOffline(UInt_t module);
+ UInt_t GetHSFromOffline(UInt_t module);
+ UInt_t GetChipFromOffline(UInt_t module, UInt_t colM);
+ UInt_t GetColFromOffline(UInt_t colM) const;
+
+ Bool_t IsPixelDeadKey(Int_t key) const;
+ Bool_t IsPixelDeadMKey(UInt_t module, Int_t key) const;
+ Bool_t IsPixelNoisyKey(Int_t key) const;
+ Bool_t IsPixelNoisyMKey(UInt_t module, Int_t key) const;
};