1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // TRD calibration class for the single pad status //
22 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliTRDCalPadStatus.h"
30 #include "AliTRDgeometry.h"
31 #include "AliTRDpadPlane.h"
32 #include "AliTRDCalSingleChamberStatus.h" // test
34 ClassImp(AliTRDCalPadStatus)
36 //_____________________________________________________________________________
37 AliTRDCalPadStatus::AliTRDCalPadStatus()
41 // AliTRDCalPadStatus default constructor
44 for (Int_t idet = 0; idet < kNdet; idet++) {
50 //_____________________________________________________________________________
51 AliTRDCalPadStatus::AliTRDCalPadStatus(const Text_t *name, const Text_t *title)
55 // AliTRDCalPadStatus constructor
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);
69 //_____________________________________________________________________________
70 AliTRDCalPadStatus::AliTRDCalPadStatus(const AliTRDCalPadStatus &c)
74 // AliTRDCalPadStatus copy constructor
77 ((AliTRDCalPadStatus &) c).Copy(*this);
81 //_____________________________________________________________________________
82 AliTRDCalPadStatus::~AliTRDCalPadStatus()
85 // AliTRDCalPadStatus destructor
88 for (Int_t idet = 0; idet < kNdet; idet++) {
97 //_____________________________________________________________________________
98 AliTRDCalPadStatus &AliTRDCalPadStatus::operator=(const AliTRDCalPadStatus &c)
101 // Assignment operator
104 if (this != &c) ((AliTRDCalPadStatus &) c).Copy(*this);
109 //_____________________________________________________________________________
110 void AliTRDCalPadStatus::Copy(TObject &c) const
116 for (Int_t idet = 0; idet < kNdet; idet++) {
118 fROC[idet]->Copy(*((AliTRDCalPadStatus &) c).fROC[idet]);
126 //_____________________________________________________________________________
127 Bool_t AliTRDCalPadStatus::CheckStatus(Int_t d, Int_t col, Int_t row, Int_t bitMask) const
130 // Checks the pad status
133 AliTRDCalSingleChamberStatus *roc = GetCalROC(d);
138 return (roc->GetStatus(col, row) & bitMask) ? kTRUE : kFALSE;
143 //_____________________________________________________________________________
144 AliTRDCalSingleChamberStatus* AliTRDCalPadStatus::GetCalROC(Int_t p, Int_t c, Int_t s) const
147 // Returns the readout chamber of this pad
150 return fROC[AliTRDgeometry::GetDetector(p,c,s)];
154 //_____________________________________________________________________________
155 TH1F *AliTRDCalPadStatus::MakeHisto1D()
162 snprintf(name,1000,"%s Pad 1D",GetTitle());
163 TH1F * his = new TH1F(name,name,6, -0.5,5.5);
164 his->GetXaxis()->SetBinLabel(1,"Good");
165 his->GetXaxis()->SetBinLabel(2,"Masked");
166 his->GetXaxis()->SetBinLabel(3,"PadBridgedLeft");
167 his->GetXaxis()->SetBinLabel(4,"PadBridgedRight");
168 his->GetXaxis()->SetBinLabel(5,"ReadSecond");
169 his->GetXaxis()->SetBinLabel(6,"NotConnected");
171 for (Int_t idet = 0; idet < kNdet; idet++)
175 for (Int_t ichannel=0; ichannel<fROC[idet]->GetNchannels(); ichannel++)
177 Int_t status = (Int_t) fROC[idet]->GetStatus(ichannel);
178 if(status==2) status= 1;
179 if(status==4) status= 2;
180 if(status==8) status= 3;
181 if(status==16) status= 4;
182 if(status==32) status= 5;
192 //_____________________________________________________________________________
193 TH2F *AliTRDCalPadStatus::MakeHisto2DSmPl(Int_t sm, Int_t pl)
199 gStyle->SetPalette(1);
200 AliTRDgeometry *trdGeo = new AliTRDgeometry();
201 AliTRDpadPlane *padPlane0 = trdGeo->GetPadPlane(pl,0);
202 Double_t row0 = padPlane0->GetRow0();
203 Double_t col0 = padPlane0->GetCol0();
206 snprintf(name,1000,"%s Pad 2D sm %d pl %d",GetTitle(),sm,pl);
207 TH2F * his = new TH2F( name, name, 88,-TMath::Abs(row0),TMath::Abs(row0)
208 ,148,-TMath::Abs(col0),TMath::Abs(col0));
211 Int_t offsetsmpl = 30*sm+pl;
213 for (Int_t k = 0; k < kNcham; k++){
214 Int_t det = offsetsmpl+k*6;
216 AliTRDCalSingleChamberStatus * calRoc = fROC[det];
217 for (Int_t icol=0; icol<calRoc->GetNcols(); icol++){
218 for (Int_t irow=0; irow<calRoc->GetNrows(); irow++){
220 Int_t kb = kNcham-1-k;
221 Int_t krow = calRoc->GetNrows()-1-irow;
222 Int_t kcol = calRoc->GetNcols()-1-icol;
223 if(kb > 2) binz = 16*(kb-1)+12+krow+1+2*(kb+1);
224 else binz = 16*kb+krow+1+2*(kb+1);
225 Int_t biny = kcol+1+2;
226 Float_t value = calRoc->GetStatus(icol,irow);
227 his->SetBinContent(binz,biny,value);
230 for(Int_t icol = 1; icol < 147; icol++){
231 for(Int_t l = 0; l < 2; l++){
233 Int_t kb = kNcham-1-k;
234 if(kb > 2) binz = 16*(kb-1)+12+1+2*(kb+1)-(l+1);
235 else binz = 16*kb+1+2*(kb+1)-(l+1);
236 his->SetBinContent(binz,icol,50.0);
241 for(Int_t icol = 1; icol < 147; icol++){
242 his->SetBinContent(88,icol,50.0);
243 his->SetBinContent(87,icol,50.0);
245 for(Int_t irow = 1; irow < 89; irow++){
246 his->SetBinContent(irow,1,50.0);
247 his->SetBinContent(irow,2,50.0);
248 his->SetBinContent(irow,147,50.0);
249 his->SetBinContent(irow,148,50.0);
252 his->SetXTitle("z (cm)");
253 his->SetYTitle("y (cm)");
255 his->SetMinimum(0.0);
262 //_____________________________________________________________________________
263 void AliTRDCalPadStatus::PlotHistos2DSm(Int_t sm, const Char_t *name)
269 gStyle->SetPalette(1);
270 TCanvas *c1 = new TCanvas(name,name,50,50,600,800);
273 MakeHisto2DSmPl(sm,0)->Draw("colz");
275 MakeHisto2DSmPl(sm,1)->Draw("colz");
277 MakeHisto2DSmPl(sm,2)->Draw("colz");
279 MakeHisto2DSmPl(sm,3)->Draw("colz");
281 MakeHisto2DSmPl(sm,4)->Draw("colz");
283 MakeHisto2DSmPl(sm,5)->Draw("colz");