- coverity fixes
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalChamberStatus.cxx
CommitLineData
7754cd1f 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// TRD calibration class for status of chambers //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
6c1053a8 24#include "TH2D.h"
7754cd1f 25#include "AliTRDCalChamberStatus.h"
26
27ClassImp(AliTRDCalChamberStatus)
28
29//_____________________________________________________________________________
2745a409 30AliTRDCalChamberStatus::AliTRDCalChamberStatus()
31 :TNamed()
7754cd1f 32{
33 //
34 // AliTRDCalChamberStatus default constructor
35 //
36
37 for (Int_t idet = 0; idet < kNdet; idet++) {
38 fStatus[idet] = 0;
39 }
2745a409 40
7754cd1f 41}
42
43//_____________________________________________________________________________
44AliTRDCalChamberStatus::AliTRDCalChamberStatus(const Text_t *name, const Text_t *title)
2745a409 45 :TNamed(name,title)
7754cd1f 46{
47 //
48 // AliTRDCalChamberStatus constructor
49 //
50
51 for (Int_t idet = 0; idet < kNdet; idet++) {
52 fStatus[idet] = 0;
53 }
2745a409 54
7754cd1f 55}
6c1053a8 56//_____________________________________________________________________________
b2277aa2 57void AliTRDCalChamberStatus::SetStatus(Int_t det, Char_t status)
58{
59
60 //
61 // set the chamber status
62 //
63 //
64
65 switch(status)
66 {
67 case AliTRDCalChamberStatus::kGood:
68 SETBIT(fStatus[det], kGood);
69 CLRBIT(fStatus[det], kNoData);
70 CLRBIT(fStatus[det], kBadCalibrated);
71 break;
72 case AliTRDCalChamberStatus::kNoData:
73 CLRBIT(fStatus[det], kGood);
74 SETBIT(fStatus[det], kNoData);
75 SETBIT(fStatus[det], kNoDataHalfChamberSideA);
76 SETBIT(fStatus[det], kNoDataHalfChamberSideB);
77 // SETBIT(fStatus[det], kBadCalibrated);
78 break;
79 case AliTRDCalChamberStatus::kNoDataHalfChamberSideA:
80 SETBIT(fStatus[det], kNoDataHalfChamberSideA);
81 if(TESTBIT(fStatus[det], kNoDataHalfChamberSideB)){
82 SETBIT(fStatus[det], kNoData);
83 CLRBIT(fStatus[det], kGood);
84 }
85 break;
86 case AliTRDCalChamberStatus::kNoDataHalfChamberSideB:
87 SETBIT(fStatus[det], kNoDataHalfChamberSideB);
88 if(TESTBIT(fStatus[det], kNoDataHalfChamberSideA)) {
89 CLRBIT(fStatus[det], kGood);
90 SETBIT(fStatus[det], kNoData);
91 }
92 break;
93 case AliTRDCalChamberStatus::kBadCalibrated:
94 CLRBIT(fStatus[det], kGood);
95 SETBIT(fStatus[det], kBadCalibrated);
96 break;
97 default:
98 CLRBIT(fStatus[det], kGood);
99 CLRBIT(fStatus[det], kNoData);
100 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
101 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
102 CLRBIT(fStatus[det], kBadCalibrated);
103 }
104
105}
106//_____________________________________________________________________________
107void AliTRDCalChamberStatus::UnsetStatusBit(Int_t det, Char_t status)
108{
109
110 //
111 // unset the chamber status bit
112 //
113 //
114
115 switch(status)
116 {
117 case AliTRDCalChamberStatus::kGood:
118 CLRBIT(fStatus[det], kGood);
119 break;
120 case AliTRDCalChamberStatus::kNoData:
121 CLRBIT(fStatus[det], kNoData);
122 break;
123 case AliTRDCalChamberStatus::kNoDataHalfChamberSideA:
124 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
125 break;
126 case AliTRDCalChamberStatus::kNoDataHalfChamberSideB:
127 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
128 break;
129 case AliTRDCalChamberStatus::kBadCalibrated:
130 CLRBIT(fStatus[det], kBadCalibrated);
131 break;
132 default:
133 CLRBIT(fStatus[det], kGood);
134 CLRBIT(fStatus[det], kNoData);
135 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
136 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
137 CLRBIT(fStatus[det], kBadCalibrated);
138 }
139
140}
141//_____________________________________________________________________________
fd50bb14 142TH2D* AliTRDCalChamberStatus::Plot(Int_t sm, Int_t rphi)
143{
144 //
145 // Plot chamber status for supermodule and halfchamberside
146 // as a function of layer and stack
147 //
148
149 TH2D *h2 = new TH2D(Form("sm_%d_rphi_%d",sm,rphi),Form("sm_%d_rphi_%d",sm,rphi),5,0.0,5.0,6,0.0,6.0);
150
151 h2->SetXTitle("stack");
152 h2->SetYTitle("layer");
153
154 Int_t start = sm*30;
155 Int_t end = (sm+1)*30;
156
157 for(Int_t i=start; i<end; i++) {
158 Int_t layer = i%6;
b2277aa2 159 Int_t stackn = static_cast<int>((i-start)/6.);
fd50bb14 160 Int_t status = GetStatus(i);
b2277aa2 161 h2->Fill(stackn,layer,status);
162 if(rphi == 0) {
163 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,status);
164 }
165 else if(rphi == 1) {
166 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,status);
167 }
168 }
169
170 return h2;
171
172}
173//_____________________________________________________________________________
174TH2D* AliTRDCalChamberStatus::PlotNoData(Int_t sm, Int_t rphi)
175{
176 //
177 // Plot chamber data status for supermodule and halfchamberside
178 // as a function of layer and stack
179 //
180
181 TH2D *h2 = new TH2D(Form("sm_%d_rphi_%d_data",sm,rphi),Form("sm_%d_rphi_%d_data",sm,rphi),5,0.0,5.0,6,0.0,6.0);
182
183 h2->SetXTitle("stack");
184 h2->SetYTitle("layer");
185
186 Int_t start = sm*30;
187 Int_t end = (sm+1)*30;
188
189 for(Int_t i=start; i<end; i++) {
190 Int_t layer = i%6;
191 Int_t stackn = static_cast<int>((i-start)/6.);
192 if(rphi == 0) {
193 if(TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,1);
194 if(TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
195 }
196 else if(rphi == 1) {
197 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,1);
198 if(!TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
199 }
200 }
201
202 return h2;
203
204}
205//_____________________________________________________________________________
206TH2D* AliTRDCalChamberStatus::PlotBadCalibrated(Int_t sm, Int_t rphi)
207{
208 //
209 // Plot chamber calibration status for supermodule and halfchamberside
210 // as a function of layer and stack
211 //
212
213 TH2D *h2 = new TH2D(Form("sm_%d_rphi_%d_calib",sm,rphi),Form("sm_%d_rphi_%d_calib",sm,rphi),5,0.0,5.0,6,0.0,6.0);
214
215 h2->SetXTitle("stack");
216 h2->SetYTitle("layer");
217
218 Int_t start = sm*30;
219 Int_t end = (sm+1)*30;
220
221 for(Int_t i=start; i<end; i++) {
222 Int_t layer = i%6;
223 Int_t stackn = static_cast<int>((i-start)/6.);
fd50bb14 224 if(rphi == 0) {
b2277aa2 225 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
fd50bb14 226 }
227 else if(rphi == 1) {
b2277aa2 228 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
fd50bb14 229 }
fd50bb14 230 }
231
232 return h2;
233
234}
235//_____________________________________________________________________________
1a278748 236TH2D* AliTRDCalChamberStatus::Plot(Int_t sm)
6c1053a8 237{
238 //
239 // Plot chamber status for supermodule and halfchamberside
240 // as a function of layer and stack
241 //
242
1a278748 243 TH2D *h2 = new TH2D(Form("sm_%d",sm),Form("sm_%d",sm),5,0.0,5.0,6,0.0,6.0);
6c1053a8 244
245 h2->SetXTitle("stack");
246 h2->SetYTitle("layer");
247
248 Int_t start = sm*30;
249 Int_t end = (sm+1)*30;
250
251 for(Int_t i=start; i<end; i++) {
252 Int_t layer = i%6;
b2277aa2 253 Int_t stackn = static_cast<int>((i-start)/6.);
6c1053a8 254 Int_t status = GetStatus(i);
b2277aa2 255 h2->Fill(stackn,layer,status);
6c1053a8 256 }
257
258 return h2;
259
260}