]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSOnlineCalibrationSPD.cxx
fixing Coverity defects
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineCalibrationSPD.cxx
1 #include "AliITSOnlineCalibrationSPD.h"
2
3 ///////////////////////////////////////////////////////////////////////
4 // Author: Henrik Tydesjo                                            //
5 // Implementation of the online container for dead and noisy pixels. //
6 //                                                                   //
7 ///////////////////////////////////////////////////////////////////////
8
9 ClassImp(AliITSOnlineCalibrationSPD)    
10
11 AliITSOnlineCalibrationSPD::AliITSOnlineCalibrationSPD():
12 fEqNr(0),
13 fNrBad(0),
14 fBadChannels(0),
15 fActiveEq(kTRUE),
16 fDeadEq(kFALSE)
17 {
18   ActivateALL();
19   UnSetDeadALL();
20 }
21 //____________________________________________________________________________
22 Int_t AliITSOnlineCalibrationSPD::GetKeyAt(UInt_t index) const {
23   // Get key of index-th bad pixel
24   if (index<fNrBad) {
25     return fBadChannels.At(index);
26   }
27   return -1;
28 }
29 //____________________________________________________________________________
30 void AliITSOnlineCalibrationSPD::ActivateALL() {
31   // activate eq, all hs, all chips
32   ActivateEq();
33   for (UInt_t hs=0; hs<6; hs++) {
34     ActivateHS(hs);
35     for (UInt_t chip=0; chip<10; chip++) {
36       ActivateChip(hs,chip);
37     }
38   }
39 }
40 //____________________________________________________________________________
41 void AliITSOnlineCalibrationSPD::ActivateEq(Bool_t setval) {
42   // activate this eq
43   fActiveEq = setval;
44 }
45 //____________________________________________________________________________
46 void AliITSOnlineCalibrationSPD::ActivateHS(UInt_t hs, Bool_t setval) {
47   // activate hs on this eq
48   if (hs>=6) {
49     Error("AliITSOnlineCalibrationSPD::ActivateHS", "hs (%d) out of bounds.",hs);
50     return;
51   }
52   fActiveHS[hs] = setval;
53 }
54 //____________________________________________________________________________
55 void AliITSOnlineCalibrationSPD::ActivateChip(UInt_t hs, UInt_t chip, Bool_t setval) {
56   // activate chip on this eq
57   if (hs>=6 || chip>=10) {
58     Error("AliITSOnlineCalibrationSPD::ActivateChip", "hs,chip (%d,%d) out of bounds.",hs,chip);
59     return;
60   }
61   fActiveChip[hs*10+chip] = setval;
62 }
63 //____________________________________________________________________________
64 Bool_t AliITSOnlineCalibrationSPD::IsActiveEq() const {
65   // is this eq active?
66   return fActiveEq;
67 }
68 //____________________________________________________________________________
69 Bool_t AliITSOnlineCalibrationSPD::IsActiveHS(UInt_t hs) const {
70   // is this hs active?
71   if (hs>=6) {
72     Error("AliITSOnlineCalibrationSPD::IsActiveHS", "hs (%d) out of bounds.",hs);
73     return kFALSE;
74   }
75   return fActiveHS[hs];
76 }
77 //____________________________________________________________________________
78 Bool_t AliITSOnlineCalibrationSPD::IsActiveChip(UInt_t hs, UInt_t chip) const {
79   // is this chip active?
80   if (hs>=6 || chip>=10) {
81     Error("AliITSOnlineCalibrationSPD::IsActiveChip", "hs,chip (%d,%d) out of bounds.",hs,chip);
82     return kFALSE;
83   }
84   return fActiveChip[hs*10+chip];
85 }
86 //____________________________________________________________________________
87 void AliITSOnlineCalibrationSPD::UnSetDeadALL() {
88   // activate eq, all hs, all chips
89   SetDeadEq(kFALSE);
90   for (UInt_t hs=0; hs<6; hs++) {
91     SetDeadHS(hs,kFALSE);
92     for (UInt_t chip=0; chip<10; chip++) {
93       SetDeadChip(hs,chip,kFALSE);
94     }
95   }
96 }
97 //____________________________________________________________________________
98 void AliITSOnlineCalibrationSPD::SetDeadEq(Bool_t setval) {
99   // set this eq dead
100   fDeadEq = setval;
101 }
102 //____________________________________________________________________________
103 void AliITSOnlineCalibrationSPD::SetDeadHS(UInt_t hs, Bool_t setval) {
104   // set dead hs on this eq
105   if (hs>=6) {
106     Error("AliITSOnlineCalibrationSPD::SetDeadHS", "hs (%d) out of bounds.",hs);
107     return;
108   }
109   fDeadHS[hs] = setval;
110 }
111 //____________________________________________________________________________
112 void AliITSOnlineCalibrationSPD::SetDeadChip(UInt_t hs, UInt_t chip, Bool_t setval) {
113   // set dead chip on this eq
114   if (hs>=6 || chip>=10) {
115     Error("AliITSOnlineCalibrationSPD::SetDeadChip", "hs,chip (%d,%d) out of bounds.",hs,chip);
116     return;
117   }
118   fDeadChip[hs*10+chip] = setval;
119 }
120 //____________________________________________________________________________
121 Bool_t AliITSOnlineCalibrationSPD::IsDeadEq() const {
122   // is this eq dead?
123   return fDeadEq;
124 }
125 //____________________________________________________________________________
126 Bool_t AliITSOnlineCalibrationSPD::IsDeadHS(UInt_t hs) const {
127   // is this hs dead?
128   if (hs>=6) {
129     Error("AliITSOnlineCalibrationSPD::IsDeadHS", "hs (%d) out of bounds.",hs);
130     return kFALSE;
131   }
132   return fDeadHS[hs];
133 }
134 //____________________________________________________________________________
135 Bool_t AliITSOnlineCalibrationSPD::IsDeadChip(UInt_t hs, UInt_t chip) const {
136   // is this chip dead?
137   if (hs>=6 || chip>=10) {
138     Error("AliITSOnlineCalibrationSPD::IsDeadChip", "hs,chip (%d,%d) out of bounds.",hs,chip);
139     return kFALSE;
140   }
141   return fDeadChip[hs*10+chip];
142 }