]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSOnlineCalibrationSPDhandler.h
A new method DrawPMDModule is added
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineCalibrationSPDhandler.h
CommitLineData
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
53ae21ce 11#include "AliITSRawStreamSPD.h"
12#include <TString.h>
b15de2d2 13
14class TArrayI;
53ae21ce 15class AliITSIntMap;
6727e2db 16class AliITSCalibrationSPD;
b15de2d2 17
18class 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();
6727e2db 30 void ResetDead();
31 void ResetNoisy();
32 void ResetDeadForChip(UInt_t eq, UInt_t hs, UInt_t chip);
33 void ResetNoisyForChip(UInt_t eq, UInt_t hs, UInt_t chip);
34 void ResetDeadForEq(UInt_t eq);
35 void ResetNoisyForEq(UInt_t eq);
b15de2d2 36
53ae21ce 37 Bool_t ReadFromFiles();
38 Bool_t ReadDeadFromFiles();
39 Bool_t ReadNoisyFromFiles();
6727e2db 40 Bool_t ReadDeadFromFile(UInt_t eq);
41 Bool_t ReadNoisyFromFile(UInt_t eq);
53ae21ce 42 Bool_t ReadDeadFromFileName(const char *fileName);
43 Bool_t ReadNoisyFromFileName(const char *fileName);
6727e2db 44 UInt_t ReadDeadFromText(const char *fileName, UInt_t module);
45 UInt_t ReadNoisyFromText(const char *fileName, UInt_t module);
53ae21ce 46
3479cee3 47 void WriteToFilesAlways();
6727e2db 48 UInt_t WriteToFiles();
49 void WriteDeadToFilesAlways();
50 void WriteNoisyToFilesAlways();
51 UInt_t WriteDeadToFiles();
52 UInt_t WriteNoisyToFiles();
53 void WriteDeadToFile(UInt_t eq);
54 void WriteNoisyToFile(UInt_t eq);
53ae21ce 55
56#ifndef SPD_DA_OFF
6727e2db 57 Bool_t ReadDeadModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial=kFALSE);
58 Bool_t ReadNoisyModuleFromDB(UInt_t module, Int_t runNr, Bool_t treeSerial=kFALSE);
59 Bool_t ReadFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
60 Bool_t ReadDeadFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
61 Bool_t ReadNoisyFromDB(Int_t runNr, Bool_t treeSerial=kFALSE);
62 Bool_t ReadDeadFromCalibObj(TObjArray* calObj);
63 Bool_t ReadNoisyFromCalibObj(TObjArray* calObj);
53ae21ce 64 Bool_t WriteToDB(Int_t runNrStart, Int_t runNrEnd);
6727e2db 65 Bool_t WriteDeadToDB(Int_t runNrStart, Int_t runNrEnd);
66 Bool_t WriteNoisyToDB(Int_t runNrStart, Int_t runNrEnd);
53ae21ce 67#endif
53ae21ce 68
6727e2db 69 void GenerateDCSConfigFile(const Char_t* fileName);
b15de2d2 70
6727e2db 71 TArrayI GetDeadArray(UInt_t module, Bool_t treeSerial=kFALSE);
72 TArrayI GetNoisyArray(UInt_t module, Bool_t treeSerial=kFALSE);
73 TArrayI GetDeadArrayOnline(UInt_t eq);
74 TArrayI GetNoisyArrayOnline(UInt_t eq);
53ae21ce 75
6727e2db 76 void PrintEqSummary();
77 void PrintDead() const;
78 void PrintNoisy() const;
53ae21ce 79
6727e2db 80 Bool_t SetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
81 Bool_t SetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
82 Bool_t SetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
53ae21ce 83 Bool_t SetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
6727e2db 84 Bool_t UnSetDeadPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
85 Bool_t UnSetNoisyPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row);
86 Bool_t UnSetDeadPixelM(UInt_t module, UInt_t colM, UInt_t row);
3479cee3 87 Bool_t UnSetNoisyPixelM(UInt_t module, UInt_t colM, UInt_t row);
6727e2db 88 UInt_t SetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip);
89 UInt_t SetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip);
90 Bool_t UnSetDeadChip(UInt_t eq, UInt_t hs, UInt_t chip);
91 Bool_t UnSetNoisyChip(UInt_t eq, UInt_t hs, UInt_t chip);
92
93 Bool_t IsPixelDead(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
94 Bool_t IsPixelNoisy(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const;
95 Bool_t IsPixelDeadM(UInt_t module, UInt_t colM, UInt_t row) const;
96 Bool_t IsPixelNoisyM(UInt_t module, UInt_t colM, UInt_t row) const;
97 Bool_t IsPixelDeadKey(Int_t key) const;
98 Bool_t IsPixelNoisyKey(Int_t key) const;
b15de2d2 99
6727e2db 100 UInt_t GetNrDead() const;
101 UInt_t GetNrNoisy() const;
102 UInt_t GetDeadEqIdAt(UInt_t index);
103 UInt_t GetNoisyEqIdAt(UInt_t index);
104 UInt_t GetDeadHSAt(UInt_t index);
105 UInt_t GetNoisyHSAt(UInt_t index);
106 UInt_t GetDeadChipAt(UInt_t index);
107 UInt_t GetNoisyChipAt(UInt_t index);
108 UInt_t GetDeadColAt(UInt_t index);
109 UInt_t GetNoisyColAt(UInt_t index);
110 UInt_t GetDeadRowAt(UInt_t index);
111 UInt_t GetNoisyRowAt(UInt_t index);
112
113 UInt_t GetNrDead(UInt_t module) const;
53ae21ce 114 UInt_t GetNrNoisy(UInt_t module) const;
6727e2db 115 UInt_t GetDeadEqIdAt(UInt_t module,UInt_t index);
53ae21ce 116 UInt_t GetNoisyEqIdAt(UInt_t module, UInt_t index);
6727e2db 117 UInt_t GetDeadHSAt(UInt_t module,UInt_t index);
53ae21ce 118 UInt_t GetNoisyHSAt(UInt_t module, UInt_t index);
6727e2db 119 UInt_t GetDeadChipAt(UInt_t module,UInt_t index);
53ae21ce 120 UInt_t GetNoisyChipAt(UInt_t module, UInt_t index);
6727e2db 121 UInt_t GetDeadColAt(UInt_t module,UInt_t index);
53ae21ce 122 UInt_t GetNoisyColAt(UInt_t module, UInt_t index);
6727e2db 123 UInt_t GetDeadRowAt(UInt_t module,UInt_t index);
53ae21ce 124 UInt_t GetNoisyRowAt(UInt_t module, UInt_t index);
125
6727e2db 126 UInt_t GetNrDeadEq(UInt_t eq) const;
127 UInt_t GetNrNoisyEq(UInt_t eq) const;
128 UInt_t GetDeadEqIdAtEq(UInt_t eq, UInt_t index) const;
129 UInt_t GetNoisyEqIdAtEq(UInt_t eq, UInt_t index) const;
130 UInt_t GetDeadHSAtEq(UInt_t eq, UInt_t index);
131 UInt_t GetNoisyHSAtEq(UInt_t eq, UInt_t index);
132 UInt_t GetDeadChipAtEq(UInt_t eq, UInt_t index);
133 UInt_t GetNoisyChipAtEq(UInt_t eq, UInt_t index);
134 UInt_t GetDeadColAtEq(UInt_t eq, UInt_t index);
135 UInt_t GetNoisyColAtEq(UInt_t eq, UInt_t index);
136 UInt_t GetDeadRowAtEq(UInt_t eq, UInt_t index);
137 UInt_t GetNoisyRowAtEq(UInt_t eq, UInt_t index);
138
139 UInt_t GetNrDeadC(UInt_t eq, UInt_t hs, UInt_t chip) const;
140 UInt_t GetNrNoisyC(UInt_t eq, UInt_t hs, UInt_t chip) const;
141 UInt_t GetDeadEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
142 UInt_t GetNoisyEqIdAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
143 UInt_t GetDeadHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
144 UInt_t GetNoisyHSAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
145 UInt_t GetDeadChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
146 UInt_t GetNoisyChipAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
147 UInt_t GetDeadColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
148 UInt_t GetNoisyColAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
149 UInt_t GetDeadRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
150 UInt_t GetNoisyRowAtC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
151
152 const Char_t* GetDeadPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
153 const Char_t* GetNoisyPixelAsTextC(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t index) const;
154
155 UInt_t AddDeadFrom(AliITSOnlineCalibrationSPDhandler* other);
156 UInt_t AddNoisyFrom(AliITSOnlineCalibrationSPDhandler* other);
b15de2d2 157
53ae21ce 158 UInt_t GetNrDiff(AliITSOnlineCalibrationSPDhandler* other) const;
159 UInt_t GetNrDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const;
160 UInt_t GetNrNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const;
161 AliITSOnlineCalibrationSPDhandler* GetDiff(AliITSOnlineCalibrationSPDhandler* other) const;
162 AliITSOnlineCalibrationSPDhandler* GetDeadDiff(AliITSOnlineCalibrationSPDhandler* other) const;
163 AliITSOnlineCalibrationSPDhandler* GetNoisyDiff(AliITSOnlineCalibrationSPDhandler* other) const;
164
165
b15de2d2 166 private:
6727e2db 167 TString fFileLocation; // location (dir) of files to read and write from
168 AliITSIntMap* fDeadPixelMap[1200]; // lists of dead pixels for each chip
169 AliITSIntMap* fNoisyPixelMap[1200]; // lists of noisy pixels for each chip
170 UInt_t fNrDead[1200]; // nr of dead pixels for each chip
171 UInt_t fNrNoisy[1200]; // nr of noisy pixels for each chip
53ae21ce 172
6727e2db 173 Int_t GetKey(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) const
174 {return eq*6*10*32*256 + hs*10*32*256 + chip*32*256 + col*256 + row;}
53ae21ce 175 UInt_t GetEqIdFromKey(Int_t key) const
176 {return key/(6*10*32*256);}
177 UInt_t GetHSFromKey(Int_t key) const
178 {return (key%(6*10*32*256))/(10*32*256);}
179 UInt_t GetChipFromKey(Int_t key) const
180 {return ((key%(6*10*32*256))%(10*32*256))/(32*256);}
181 UInt_t GetColFromKey(Int_t key) const
182 {return (((key%(6*10*32*256))%(10*32*256))%(32*256))/256;}
183 UInt_t GetRowFromKey(Int_t key) const
184 {return (((key%(6*10*32*256))%(10*32*256))%(32*256))%256;}
185 UInt_t GetModuleFromKey(Int_t key) const
6727e2db 186 {return AliITSRawStreamSPD::GetOfflineModuleFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key));}
53ae21ce 187 UInt_t GetColMFromKey(Int_t key) const
6727e2db 188 {return AliITSRawStreamSPD::GetOfflineColFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key),GetColFromKey(key));}
189 UInt_t GetRowMFromKey(Int_t key) const
190 {return AliITSRawStreamSPD::GetOfflineRowFromOnline(GetEqIdFromKey(key),GetHSFromKey(key),GetChipFromKey(key),GetRowFromKey(key));}
191
192 UInt_t GetGloChip(UInt_t eq, UInt_t hs, UInt_t chip) const
193 {return eq*6*10 + hs*10 + chip;}
194
195 void GetChipAndIndexDead(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
196 void GetChipAndIndexNoisy(UInt_t module, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
197 void GetChipAndIndexEqDead(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
198 void GetChipAndIndexEqNoisy(UInt_t eq, UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
199 void GetChipAndIndexTotDead(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
200 void GetChipAndIndexTotNoisy(UInt_t index, UInt_t& gloChip, UInt_t& chipIndex);
201
202 UInt_t GetEqIdFromOffline(UInt_t module) const;
203 UInt_t GetHSFromOffline(UInt_t module) const;
204 UInt_t GetChipFromOffline(UInt_t module, UInt_t colM) const;
205 UInt_t GetColFromOffline(UInt_t module, UInt_t colM) const;
206 UInt_t GetRowFromOffline(UInt_t module, UInt_t rowM) const;
207
208 void RecursiveInsertDead(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd);
209 void RecursiveInsertNoisy(AliITSCalibrationSPD* calibSPD, UInt_t module, Int_t lowInd, Int_t highInd);
210
211 UInt_t GetNrDeadC2(UInt_t gloChip) const;
212 UInt_t GetNrNoisyC2(UInt_t gloChip) const;
213 UInt_t GetDeadEqIdAtC2(UInt_t gloChip, UInt_t index) const;
214 UInt_t GetNoisyEqIdAtC2(UInt_t gloChip, UInt_t index) const;
215 UInt_t GetDeadHSAtC2(UInt_t gloChip, UInt_t index) const;
216 UInt_t GetNoisyHSAtC2(UInt_t gloChip, UInt_t index) const;
217 UInt_t GetDeadChipAtC2(UInt_t gloChip, UInt_t index) const;
218 UInt_t GetNoisyChipAtC2(UInt_t gloChip, UInt_t index) const;
219 UInt_t GetDeadColAtC2(UInt_t gloChip, UInt_t index) const;
220 UInt_t GetNoisyColAtC2(UInt_t gloChip, UInt_t index) const;
221 UInt_t GetDeadRowAtC2(UInt_t gloChip, UInt_t index) const;
222 UInt_t GetNoisyRowAtC2(UInt_t gloChip, UInt_t index) const;
b15de2d2 223
224};
225
226#endif