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