]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/Cal/AliTRDCalChamberStatus.cxx
coverity fix
[u/mrichter/AliRoot.git] / TRD / Cal / AliTRDCalChamberStatus.cxx
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
27 ClassImp(AliTRDCalChamberStatus)
28
29 //_____________________________________________________________________________
30 AliTRDCalChamberStatus::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 //_____________________________________________________________________________
44 AliTRDCalChamberStatus::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 //_____________________________________________________________________________
57 void 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 //_____________________________________________________________________________
107 void 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 //_____________________________________________________________________________
142 TH2D* 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;
159     Int_t stackn  = static_cast<int>((i-start)/6.);
160     Int_t status = GetStatus(i);
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 //_____________________________________________________________________________
174 TH2D* 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 //_____________________________________________________________________________
206 TH2D* 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.);
224     if(rphi == 0) {    
225       if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
226     }
227     else if(rphi == 1) {
228       if(TESTBIT(fStatus[i], kBadCalibrated)) h2->Fill(stackn,layer,1);
229     }
230   }
231
232   return h2;
233
234 }
235 //_____________________________________________________________________________
236 TH2D* AliTRDCalChamberStatus::Plot(Int_t sm) 
237 {
238   //
239   // Plot chamber status for supermodule and halfchamberside 
240   // as a function of layer and stack
241   //
242
243   TH2D *h2 = new TH2D(Form("sm_%d",sm),Form("sm_%d",sm),5,0.0,5.0,6,0.0,6.0);
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;
253     Int_t stackn  = static_cast<int>((i-start)/6.);
254     Int_t status = GetStatus(i);
255     h2->Fill(stackn,layer,status);
256   }
257
258   return h2;
259
260 }