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