]>
Commit | Line | Data |
---|---|---|
b15de2d2 | 1 | #ifndef ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H |
2 | #define ALI_ITS_ONLINECALIBRATIONSPDHANDLER_H | |
3 | ||
53ae21ce | 4 | ////////////////////////////////////////////////////////////////////////// |
5 | // Author: Henrik Tydesjo // | |
6 | // Class that simplifies the managing of dead and noisy pixels. // | |
7 | // Has interface to the AliITSOnlineCalibrationSPD container objects // | |
8 | // through reading and writing to TFile. // | |
9 | ////////////////////////////////////////////////////////////////////////// | |
b15de2d2 | 10 | |
11 | ||
53ae21ce | 12 | #include "AliITSRawStreamSPD.h" |
13 | #include <TString.h> | |
b15de2d2 | 14 | |
15 | class TArrayI; | |
53ae21ce | 16 | class AliITSIntMap; |
b15de2d2 | 17 | |
18 | class AliITSOnlineCalibrationSPDhandler { | |
19 | ||
20 | public: | |
21 | AliITSOnlineCalibrationSPDhandler(); | |
b15de2d2 | 22 | AliITSOnlineCalibrationSPDhandler(const AliITSOnlineCalibrationSPDhandler& handle); |
23 | virtual ~AliITSOnlineCalibrationSPDhandler(); | |
24 | AliITSOnlineCalibrationSPDhandler& operator=(const AliITSOnlineCalibrationSPDhandler& handle); | |
53ae21ce | 25 | |
26 | void SetFileLocation(const Char_t* loc) {fFileLocation = loc;} | |
27 | TString GetFileLocation() const {return fFileLocation;} | |
28 | ||
b15de2d2 | 29 | void ClearMaps(); |
30 | ||
53ae21ce | 31 | Bool_t ReadFromFiles(); |
32 | Bool_t ReadDeadFromFiles(); | |
33 | Bool_t ReadNoisyFromFiles(); | |
34 | Bool_t ReadFromFile(UInt_t module); | |
35 | Bool_t ReadDeadFromFile(UInt_t module); | |
36 | Bool_t ReadNoisyFromFile(UInt_t module); | |
37 | Bool_t ReadFromFileName(const char *fileName); | |
38 | Bool_t ReadDeadFromFileName(const char *fileName); | |
39 | Bool_t ReadNoisyFromFileName(const char *fileName); | |
40 | ||
41 | void WriteToFiles(); | |
42 | void WriteDeadToFiles(); | |
43 | void WriteNoisyToFiles(); | |
44 | void WriteToFile(UInt_t module); | |
45 | void WriteDeadToFile(UInt_t module); | |
46 | void WriteNoisyToFile(UInt_t module); | |
47 | ||
48 | #ifndef SPD_DA_OFF | |
49 | Bool_t ReadModuleFromDB(UInt_t module, Int_t runNr); | |
50 | Bool_t ReadFromDB(Int_t runNr); | |
51 | Bool_t WriteToDB(Int_t runNrStart, Int_t runNrEnd); | |
52 | #endif | |
53 | UInt_t ReadNoisyFromText(const char *fileName); | |
54 | UInt_t ReadDeadFromText(const char *fileName); | |
55 | void GenerateDCSConfigFile(const Char_t* fileName); | |
56 | ||
57 | TArrayI GetDeadArray(UInt_t module); | |
58 | TArrayI GetNoisyArray(UInt_t module); | |
b15de2d2 | 59 | |
60 | void ResetDead(); | |
53ae21ce | 61 | void ResetDeadForChip(UInt_t eqId, UInt_t hs, UInt_t chip); |
62 | Bool_t SetDeadPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row); | |
63 | Bool_t SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row); | |
64 | Bool_t IsPixelDead(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const; | |
65 | Bool_t IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row); | |
66 | ||
67 | UInt_t GetNrDead(UInt_t module) const; | |
68 | UInt_t GetDeadEqIdAt(UInt_t module,UInt_t index); | |
69 | UInt_t GetDeadHSAt(UInt_t module,UInt_t index); | |
70 | UInt_t GetDeadChipAt(UInt_t module,UInt_t index); | |
71 | UInt_t GetDeadColAt(UInt_t module,UInt_t index); | |
72 | UInt_t GetDeadRowAt(UInt_t module,UInt_t index); | |
73 | ||
b15de2d2 | 74 | void ResetNoisy(); |
53ae21ce | 75 | void ResetNoisyForChip(UInt_t eqId, UInt_t hs, UInt_t chip); |
76 | Bool_t SetNoisyPixel(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row); | |
77 | Bool_t SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row); | |
78 | Bool_t IsPixelNoisy(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const; | |
79 | Bool_t IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row); | |
b15de2d2 | 80 | |
53ae21ce | 81 | UInt_t GetNrNoisy(UInt_t module) const; |
82 | UInt_t GetNoisyEqIdAt(UInt_t module, UInt_t index); | |
83 | UInt_t GetNoisyHSAt(UInt_t module, UInt_t index); | |
84 | UInt_t GetNoisyChipAt(UInt_t module, UInt_t index); | |
85 | UInt_t GetNoisyColAt(UInt_t module, UInt_t index); | |
86 | UInt_t GetNoisyRowAt(UInt_t module, UInt_t index); | |
87 | ||
88 | UInt_t GetNrDead() const; | |
89 | UInt_t GetNrNoisy() const; | |
b15de2d2 | 90 | void PrintDead() const; |
91 | void PrintNoisy() const; | |
92 | ||
53ae21ce | 93 | UInt_t GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const; |
94 | UInt_t GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const; | |
95 | UInt_t GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const; | |
96 | AliITSOnlineCalibrationSPDhandler* GetDiff(AliITSOnlineCalibrationSPDhandler* other) const; | |
97 | AliITSOnlineCalibrationSPDhandler* GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const; | |
98 | AliITSOnlineCalibrationSPDhandler* GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const; | |
99 | ||
100 | ||
b15de2d2 | 101 | private: |
53ae21ce | 102 | TString fFileLocation; // location (dir) of files to read and write from |
103 | AliITSIntMap* fDeadPixelMap[240]; // lists of dead pixels for each module | |
104 | AliITSIntMap* fNoisyPixelMap[240]; // lists of noisy pixels for each module | |
105 | UInt_t fNrDead[240]; // nr of dead pixels for each module | |
106 | UInt_t fNrNoisy[240]; // nr of noisy pixels for each module | |
107 | ||
108 | Bool_t fModuleMapInited; // flag to know if arrays below are filled | |
109 | UInt_t fiDDL[240]; // iDDL value for each module (inited when used, fModuleMapInited flag) | |
110 | UInt_t fiModule[240]; // iModule value for each module (inited when used, fModuleMapInited flag) | |
111 | ||
112 | Int_t GetKey(UInt_t eqId, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const | |
113 | {return eqId*6*10*32*256 + hs*10*32*256 + chip*32*256 + col*256 + row;} | |
114 | ||
115 | UInt_t GetEqIdFromKey(Int_t key) const | |
116 | {return key/(6*10*32*256);} | |
117 | UInt_t GetHSFromKey(Int_t key) const | |
118 | {return (key%(6*10*32*256))/(10*32*256);} | |
119 | UInt_t GetChipFromKey(Int_t key) const | |
120 | {return ((key%(6*10*32*256))%(10*32*256))/(32*256);} | |
121 | UInt_t GetColFromKey(Int_t key) const | |
122 | {return (((key%(6*10*32*256))%(10*32*256))%(32*256))/256;} | |
123 | UInt_t GetRowFromKey(Int_t key) const | |
124 | {return (((key%(6*10*32*256))%(10*32*256))%(32*256))%256;} | |
125 | UInt_t GetModuleFromKey(Int_t key) const | |
126 | {return AliITSRawStreamSPD::GetModuleNumber(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key));} | |
127 | UInt_t GetColMFromKey(Int_t key) const | |
128 | {return GetColFromKey(key) + 32 * (GetChipFromKey(key) % 5);} | |
129 | ||
130 | void InitModuleMaps(); | |
131 | UInt_t GetEqIdFromOffline(UInt_t module); | |
132 | UInt_t GetHSFromOffline(UInt_t module); | |
133 | UInt_t GetChipFromOffline(UInt_t module, UInt_t colM); | |
134 | UInt_t GetColFromOffline(UInt_t colM) const; | |
135 | ||
136 | Bool_t IsPixelDeadKey(Int_t key) const; | |
137 | Bool_t IsPixelDeadMKey(UInt_t module, Int_t key) const; | |
138 | Bool_t IsPixelNoisyKey(Int_t key) const; | |
139 | Bool_t IsPixelNoisyMKey(UInt_t module, Int_t key) const; | |
b15de2d2 | 140 | |
141 | }; | |
142 | ||
143 | #endif |