Masking of not calibrated chambers
[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;
67abca5c 97 case AliTRDCalChamberStatus::kNotCalibrated:
98 SETBIT(fStatus[det], kNotCalibrated);
99 //CLRBIT(fStatus[det], kBadCalibrated);
100 break;
b2277aa2 101 default:
102 CLRBIT(fStatus[det], kGood);
103 CLRBIT(fStatus[det], kNoData);
104 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
105 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
106 CLRBIT(fStatus[det], kBadCalibrated);
67abca5c 107 CLRBIT(fStatus[det], kNotCalibrated);
b2277aa2 108 }
109
110}
111//_____________________________________________________________________________
112void AliTRDCalChamberStatus::UnsetStatusBit(Int_t det, Char_t status)
113{
114
115 //
116 // unset the chamber status bit
117 //
118 //
119
120 switch(status)
121 {
122 case AliTRDCalChamberStatus::kGood:
123 CLRBIT(fStatus[det], kGood);
124 break;
125 case AliTRDCalChamberStatus::kNoData:
126 CLRBIT(fStatus[det], kNoData);
127 break;
128 case AliTRDCalChamberStatus::kNoDataHalfChamberSideA:
129 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
130 break;
131 case AliTRDCalChamberStatus::kNoDataHalfChamberSideB:
132 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
133 break;
134 case AliTRDCalChamberStatus::kBadCalibrated:
135 CLRBIT(fStatus[det], kBadCalibrated);
136 break;
67abca5c 137 case AliTRDCalChamberStatus::kNotCalibrated:
138 CLRBIT(fStatus[det], kNotCalibrated);
139 break;
b2277aa2 140 default:
141 CLRBIT(fStatus[det], kGood);
142 CLRBIT(fStatus[det], kNoData);
143 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
144 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
145 CLRBIT(fStatus[det], kBadCalibrated);
67abca5c 146 CLRBIT(fStatus[det], kNotCalibrated);
b2277aa2 147 }
148
149}
150//_____________________________________________________________________________
fd50bb14 151TH2D* AliTRDCalChamberStatus::Plot(Int_t sm, Int_t rphi)
152{
153 //
154 // Plot chamber status for supermodule and halfchamberside
155 // as a function of layer and stack
156 //
157
158 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);
159
160 h2->SetXTitle("stack");
161 h2->SetYTitle("layer");
162
163 Int_t start = sm*30;
164 Int_t end = (sm+1)*30;
165
166 for(Int_t i=start; i<end; i++) {
167 Int_t layer = i%6;
b2277aa2 168 Int_t stackn = static_cast<int>((i-start)/6.);
fd50bb14 169 Int_t status = GetStatus(i);
b2277aa2 170 h2->Fill(stackn,layer,status);
171 if(rphi == 0) {
172 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,status);
173 }
174 else if(rphi == 1) {
175 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,status);
176 }
177 }
178
179 return h2;
180
181}
182//_____________________________________________________________________________
183TH2D* AliTRDCalChamberStatus::PlotNoData(Int_t sm, Int_t rphi)
184{
185 //
186 // Plot chamber data status for supermodule and halfchamberside
187 // as a function of layer and stack
188 //
189
190 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);
191
192 h2->SetXTitle("stack");
193 h2->SetYTitle("layer");
194
195 Int_t start = sm*30;
196 Int_t end = (sm+1)*30;
197
198 for(Int_t i=start; i<end; i++) {
199 Int_t layer = i%6;
200 Int_t stackn = static_cast<int>((i-start)/6.);
201 if(rphi == 0) {
202 if(TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,1);
203 if(TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
204 }
205 else if(rphi == 1) {
206 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,1);
207 if(!TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
208 }
209 }
210
211 return h2;
212
213}
214//_____________________________________________________________________________
215TH2D* AliTRDCalChamberStatus::PlotBadCalibrated(Int_t sm, Int_t rphi)
216{
217 //
218 // Plot chamber calibration status for supermodule and halfchamberside
219 // as a function of layer and stack
220 //
221
222 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);
223
224 h2->SetXTitle("stack");
225 h2->SetYTitle("layer");
226
227 Int_t start = sm*30;
228 Int_t end = (sm+1)*30;
229
230 for(Int_t i=start; i<end; i++) {
231 Int_t layer = i%6;
232 Int_t stackn = static_cast<int>((i-start)/6.);
fd50bb14 233 if(rphi == 0) {
b2277aa2 234 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
fd50bb14 235 }
236 else if(rphi == 1) {
b2277aa2 237 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
fd50bb14 238 }
fd50bb14 239 }
240
241 return h2;
242
243}
244//_____________________________________________________________________________
1a278748 245TH2D* AliTRDCalChamberStatus::Plot(Int_t sm)
6c1053a8 246{
247 //
248 // Plot chamber status for supermodule and halfchamberside
249 // as a function of layer and stack
250 //
251
1a278748 252 TH2D *h2 = new TH2D(Form("sm_%d",sm),Form("sm_%d",sm),5,0.0,5.0,6,0.0,6.0);
6c1053a8 253
254 h2->SetXTitle("stack");
255 h2->SetYTitle("layer");
256
257 Int_t start = sm*30;
258 Int_t end = (sm+1)*30;
259
260 for(Int_t i=start; i<end; i++) {
261 Int_t layer = i%6;
b2277aa2 262 Int_t stackn = static_cast<int>((i-start)/6.);
6c1053a8 263 Int_t status = GetStatus(i);
b2277aa2 264 h2->Fill(stackn,layer,status);
6c1053a8 265 }
266
267 return h2;
268
269}