Line data Source code
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 the single pad status //
21 : // //
22 : ///////////////////////////////////////////////////////////////////////////////
23 :
24 : #include <TStyle.h>
25 : #include <TCanvas.h>
26 : #include <TH1F.h>
27 : #include <TH2F.h>
28 :
29 : #include "AliTRDCalPadStatus.h"
30 : #include "AliTRDgeometry.h"
31 : #include "AliTRDpadPlane.h"
32 : #include "AliTRDCalSingleChamberStatus.h" // test
33 :
34 48 : ClassImp(AliTRDCalPadStatus)
35 :
36 : //_____________________________________________________________________________
37 : AliTRDCalPadStatus::AliTRDCalPadStatus()
38 3 : :TNamed()
39 15 : {
40 : //
41 : // AliTRDCalPadStatus default constructor
42 : //
43 :
44 3246 : for (Int_t idet = 0; idet < kNdet; idet++) {
45 1620 : fROC[idet] = 0;
46 : }
47 :
48 6 : }
49 :
50 : //_____________________________________________________________________________
51 : AliTRDCalPadStatus::AliTRDCalPadStatus(const Text_t *name, const Text_t *title)
52 0 : :TNamed(name,title)
53 0 : {
54 : //
55 : // AliTRDCalPadStatus constructor
56 : //
57 :
58 0 : for (Int_t isec = 0; isec < kNsect; isec++) {
59 0 : for (Int_t ipla = 0; ipla < kNplan; ipla++) {
60 0 : for (Int_t icha = 0; icha < kNcham; icha++) {
61 0 : Int_t idet = AliTRDgeometry::GetDetector(ipla,icha,isec);
62 0 : fROC[idet] = new AliTRDCalSingleChamberStatus(ipla,icha,144);
63 : }
64 : }
65 : }
66 :
67 0 : }
68 :
69 : //_____________________________________________________________________________
70 : AliTRDCalPadStatus::AliTRDCalPadStatus(const AliTRDCalPadStatus &c)
71 0 : :TNamed(c)
72 0 : {
73 : //
74 : // AliTRDCalPadStatus copy constructor
75 : //
76 :
77 0 : ((AliTRDCalPadStatus &) c).Copy(*this);
78 :
79 0 : }
80 :
81 : //_____________________________________________________________________________
82 : AliTRDCalPadStatus::~AliTRDCalPadStatus()
83 0 : {
84 : //
85 : // AliTRDCalPadStatus destructor
86 : //
87 :
88 0 : for (Int_t idet = 0; idet < kNdet; idet++) {
89 0 : if (fROC[idet]) {
90 0 : delete fROC[idet];
91 0 : fROC[idet] = 0;
92 0 : }
93 : }
94 :
95 0 : }
96 :
97 : //_____________________________________________________________________________
98 : AliTRDCalPadStatus &AliTRDCalPadStatus::operator=(const AliTRDCalPadStatus &c)
99 : {
100 : //
101 : // Assignment operator
102 : //
103 :
104 0 : if (this != &c) ((AliTRDCalPadStatus &) c).Copy(*this);
105 0 : return *this;
106 :
107 : }
108 :
109 : //_____________________________________________________________________________
110 : void AliTRDCalPadStatus::Copy(TObject &c) const
111 : {
112 : //
113 : // Copy function
114 : //
115 :
116 0 : for (Int_t idet = 0; idet < kNdet; idet++) {
117 0 : if (fROC[idet]) {
118 0 : fROC[idet]->Copy(*((AliTRDCalPadStatus &) c).fROC[idet]);
119 0 : }
120 : }
121 :
122 0 : TObject::Copy(c);
123 :
124 0 : }
125 :
126 : //_____________________________________________________________________________
127 : Bool_t AliTRDCalPadStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const
128 : {
129 : //
130 : // Checks the pad status
131 : //
132 :
133 1497600 : AliTRDCalSingleChamberStatus *roc = GetCalROC(d);
134 748800 : if (!roc) {
135 0 : return kFALSE;
136 : }
137 : else {
138 748800 : return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE;
139 : }
140 :
141 748800 : }
142 :
143 : //_____________________________________________________________________________
144 : AliTRDCalSingleChamberStatus* AliTRDCalPadStatus::GetCalROC(Int_t p, Int_t c, Int_t s) const
145 : {
146 : //
147 : // Returns the readout chamber of this pad
148 : //
149 :
150 0 : return fROC[AliTRDgeometry::GetDetector(p,c,s)];
151 :
152 : }
153 :
154 : //_____________________________________________________________________________
155 : TH1F *AliTRDCalPadStatus::MakeHisto1D()
156 : {
157 : //
158 : // Make 1D histo
159 : //
160 :
161 0 : char name[1000];
162 0 : snprintf(name,1000,"%s Pad 1D",GetTitle());
163 0 : TH1F * his = new TH1F(name,name,6, -0.5,5.5);
164 0 : his->GetXaxis()->SetBinLabel(1,"Good");
165 0 : his->GetXaxis()->SetBinLabel(2,"Masked");
166 0 : his->GetXaxis()->SetBinLabel(3,"PadBridgedLeft");
167 0 : his->GetXaxis()->SetBinLabel(4,"PadBridgedRight");
168 0 : his->GetXaxis()->SetBinLabel(5,"ReadSecond");
169 0 : his->GetXaxis()->SetBinLabel(6,"NotConnected");
170 :
171 0 : for (Int_t idet = 0; idet < kNdet; idet++)
172 : {
173 0 : if (fROC[idet])
174 : {
175 0 : for (Int_t ichannel=0; ichannel<fROC[idet]->GetNchannels(); ichannel++)
176 : {
177 0 : Int_t status = (Int_t) fROC[idet]->GetStatus(ichannel);
178 0 : if(status==2) status= 1;
179 0 : if(status==4) status= 2;
180 0 : if(status==8) status= 3;
181 0 : if(status==16) status= 4;
182 0 : if(status==32) status= 5;
183 0 : his->Fill(status);
184 : }
185 0 : }
186 : }
187 :
188 0 : return his;
189 :
190 0 : }
191 :
192 : //_____________________________________________________________________________
193 : TH2F *AliTRDCalPadStatus::MakeHisto2DSmPl(Int_t sm, Int_t pl)
194 : {
195 : //
196 : // Make 2D graph
197 : //
198 :
199 0 : gStyle->SetPalette(1);
200 0 : AliTRDgeometry *trdGeo = new AliTRDgeometry();
201 0 : AliTRDpadPlane *padPlane0 = trdGeo->GetPadPlane(pl,0);
202 0 : Double_t row0 = padPlane0->GetRow0();
203 0 : Double_t col0 = padPlane0->GetCol0();
204 :
205 0 : char name[1000];
206 0 : snprintf(name,1000,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl);
207 0 : TH2F * his = new TH2F( name, name, 88,-TMath::Abs(row0),TMath::Abs(row0)
208 0 : ,148,-TMath::Abs(col0),TMath::Abs(col0));
209 :
210 : // Where we begin
211 0 : Int_t offsetsmpl = 30*sm+pl;
212 :
213 0 : for (Int_t k = 0; k < kNcham; k++){
214 0 : Int_t det = offsetsmpl+k*6;
215 0 : if (fROC[det]){
216 : AliTRDCalSingleChamberStatus * calRoc = fROC[det];
217 0 : for (Int_t icol=0; icol<calRoc->GetNcols(); icol++){
218 0 : for (Int_t irow=0; irow<calRoc->GetNrows(); irow++){
219 : Int_t binz = 0;
220 0 : Int_t kb = kNcham-1-k;
221 0 : Int_t krow = calRoc->GetNrows()-1-irow;
222 0 : Int_t kcol = calRoc->GetNcols()-1-icol;
223 0 : if(kb > 2) binz = 16*(kb-1)+12+krow+1+2*(kb+1);
224 0 : else binz = 16*kb+krow+1+2*(kb+1);
225 0 : Int_t biny = kcol+1+2;
226 0 : Float_t value = calRoc->GetStatus(icol,irow);
227 0 : his->SetBinContent(binz,biny,value);
228 : }
229 : }
230 0 : for(Int_t icol = 1; icol < 147; icol++){
231 0 : for(Int_t l = 0; l < 2; l++){
232 : Int_t binz = 0;
233 0 : Int_t kb = kNcham-1-k;
234 0 : if(kb > 2) binz = 16*(kb-1)+12+1+2*(kb+1)-(l+1);
235 0 : else binz = 16*kb+1+2*(kb+1)-(l+1);
236 0 : his->SetBinContent(binz,icol,50.0);
237 : }
238 : }
239 0 : }
240 : }
241 0 : for(Int_t icol = 1; icol < 147; icol++){
242 0 : his->SetBinContent(88,icol,50.0);
243 0 : his->SetBinContent(87,icol,50.0);
244 : }
245 0 : for(Int_t irow = 1; irow < 89; irow++){
246 0 : his->SetBinContent(irow,1,50.0);
247 0 : his->SetBinContent(irow,2,50.0);
248 0 : his->SetBinContent(irow,147,50.0);
249 0 : his->SetBinContent(irow,148,50.0);
250 : }
251 :
252 0 : his->SetXTitle("z (cm)");
253 0 : his->SetYTitle("y (cm)");
254 0 : his->SetMaximum(50);
255 0 : his->SetMinimum(0.0);
256 0 : his->SetStats(0);
257 :
258 0 : return his;
259 :
260 0 : }
261 :
262 : //_____________________________________________________________________________
263 : void AliTRDCalPadStatus::PlotHistos2DSm(Int_t sm, const Char_t *name)
264 : {
265 : //
266 : // Make 2D graph
267 : //
268 :
269 0 : gStyle->SetPalette(1);
270 0 : TCanvas *c1 = new TCanvas(name,name,50,50,600,800);
271 0 : c1->Divide(3,2);
272 0 : c1->cd(1);
273 0 : MakeHisto2DSmPl(sm,0)->Draw("colz");
274 0 : c1->cd(2);
275 0 : MakeHisto2DSmPl(sm,1)->Draw("colz");
276 0 : c1->cd(3);
277 0 : MakeHisto2DSmPl(sm,2)->Draw("colz");
278 0 : c1->cd(4);
279 0 : MakeHisto2DSmPl(sm,3)->Draw("colz");
280 0 : c1->cd(5);
281 0 : MakeHisto2DSmPl(sm,4)->Draw("colz");
282 0 : c1->cd(6);
283 0 : MakeHisto2DSmPl(sm,5)->Draw("colz");
284 :
285 0 : }
|