Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / TRD / TRDbase / AliTRDCalChamberStatus.cxx
... / ...
CommitLineData
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
24#include "TH2D.h"
25#include "AliTRDCalChamberStatus.h"
26
27ClassImp(AliTRDCalChamberStatus)
28
29//_____________________________________________________________________________
30AliTRDCalChamberStatus::AliTRDCalChamberStatus()
31 :TNamed()
32{
33 //
34 // AliTRDCalChamberStatus default constructor
35 //
36
37 for (Int_t idet = 0; idet < kNdet; idet++) {
38 fStatus[idet] = 0;
39 }
40
41}
42
43//_____________________________________________________________________________
44AliTRDCalChamberStatus::AliTRDCalChamberStatus(const Text_t *name, const Text_t *title)
45 :TNamed(name,title)
46{
47 //
48 // AliTRDCalChamberStatus constructor
49 //
50
51 for (Int_t idet = 0; idet < kNdet; idet++) {
52 fStatus[idet] = 0;
53 }
54
55}
56//_____________________________________________________________________________
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 case AliTRDCalChamberStatus::kNotCalibrated:
98 CLRBIT(fStatus[det], kGood);
99 SETBIT(fStatus[det], kNotCalibrated);
100 //CLRBIT(fStatus[det], kBadCalibrated);
101 break;
102 default:
103 CLRBIT(fStatus[det], kGood);
104 CLRBIT(fStatus[det], kNoData);
105 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
106 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
107 CLRBIT(fStatus[det], kBadCalibrated);
108 CLRBIT(fStatus[det], kNotCalibrated);
109 }
110
111}
112//_____________________________________________________________________________
113void AliTRDCalChamberStatus::UnsetStatusBit(Int_t det, Char_t status)
114{
115
116 //
117 // unset the chamber status bit
118 //
119 //
120
121 switch(status)
122 {
123 case AliTRDCalChamberStatus::kGood:
124 CLRBIT(fStatus[det], kGood);
125 break;
126 case AliTRDCalChamberStatus::kNoData:
127 CLRBIT(fStatus[det], kNoData);
128 break;
129 case AliTRDCalChamberStatus::kNoDataHalfChamberSideA:
130 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
131 break;
132 case AliTRDCalChamberStatus::kNoDataHalfChamberSideB:
133 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
134 break;
135 case AliTRDCalChamberStatus::kBadCalibrated:
136 CLRBIT(fStatus[det], kBadCalibrated);
137 break;
138 case AliTRDCalChamberStatus::kNotCalibrated:
139 CLRBIT(fStatus[det], kNotCalibrated);
140 break;
141 default:
142 CLRBIT(fStatus[det], kGood);
143 CLRBIT(fStatus[det], kNoData);
144 CLRBIT(fStatus[det], kNoDataHalfChamberSideA);
145 CLRBIT(fStatus[det], kNoDataHalfChamberSideB);
146 CLRBIT(fStatus[det], kBadCalibrated);
147 CLRBIT(fStatus[det], kNotCalibrated);
148 }
149
150}
151//_____________________________________________________________________________
152TH2D* AliTRDCalChamberStatus::Plot(Int_t sm, Int_t rphi)
153{
154 //
155 // Plot chamber status for supermodule and halfchamberside
156 // as a function of layer and stack
157 //
158
159 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);
160
161 h2->SetXTitle("stack");
162 h2->SetYTitle("layer");
163
164 Int_t start = sm*30;
165 Int_t end = (sm+1)*30;
166
167 for(Int_t i=start; i<end; i++) {
168 Int_t layer = i%6;
169 Int_t stackn = static_cast<int>((i-start)/6.);
170 Int_t status = GetStatus(i);
171 h2->Fill(stackn,layer,status);
172 if(rphi == 0) {
173 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,status);
174 }
175 else if(rphi == 1) {
176 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,status);
177 }
178 }
179
180 return h2;
181
182}
183//_____________________________________________________________________________
184TH2D* AliTRDCalChamberStatus::PlotNoData(Int_t sm, Int_t rphi)
185{
186 //
187 // Plot chamber data status for supermodule and halfchamberside
188 // as a function of layer and stack
189 //
190
191 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);
192
193 h2->SetXTitle("stack");
194 h2->SetYTitle("layer");
195
196 Int_t start = sm*30;
197 Int_t end = (sm+1)*30;
198
199 for(Int_t i=start; i<end; i++) {
200 Int_t layer = i%6;
201 Int_t stackn = static_cast<int>((i-start)/6.);
202 if(rphi == 0) {
203 if(TESTBIT(fStatus[i], kNoDataHalfChamberSideB)) h2->Fill(stackn,layer,1);
204 if(TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
205 }
206 else if(rphi == 1) {
207 if(!TESTBIT(fStatus[i], kNoDataHalfChamberSideA)) h2->Fill(stackn,layer,1);
208 if(!TESTBIT(fStatus[i], kNoData)) h2->Fill(stackn,layer,1);
209 }
210 }
211
212 return h2;
213
214}
215//_____________________________________________________________________________
216TH2D* AliTRDCalChamberStatus::PlotBadCalibrated(Int_t sm, Int_t rphi)
217{
218 //
219 // Plot chamber calibration status for supermodule and halfchamberside
220 // as a function of layer and stack
221 //
222
223 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);
224
225 h2->SetXTitle("stack");
226 h2->SetYTitle("layer");
227
228 Int_t start = sm*30;
229 Int_t end = (sm+1)*30;
230
231 for(Int_t i=start; i<end; i++) {
232 Int_t layer = i%6;
233 Int_t stackn = static_cast<int>((i-start)/6.);
234 if(rphi == 0) {
235 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
236 }
237 else if(rphi == 1) {
238 if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
239 }
240 }
241
242 return h2;
243
244}
245//_____________________________________________________________________________
246TH2D* AliTRDCalChamberStatus::Plot(Int_t sm)
247{
248 //
249 // Plot chamber status for supermodule and halfchamberside
250 // as a function of layer and stack
251 //
252
253 TH2D *h2 = new TH2D(Form("sm_%d",sm),Form("sm_%d",sm),5,0.0,5.0,6,0.0,6.0);
254
255 h2->SetXTitle("stack");
256 h2->SetYTitle("layer");
257
258 Int_t start = sm*30;
259 Int_t end = (sm+1)*30;
260
261 for(Int_t i=start; i<end; i++) {
262 Int_t layer = i%6;
263 Int_t stackn = static_cast<int>((i-start)/6.);
264 Int_t status = GetStatus(i);
265 h2->Fill(stackn,layer,status);
266 }
267
268 return h2;
269
270}