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"
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 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++) {
166 for (Int_t ichannel=0; ichannel<fROC[idet]->GetNchannels(); ichannel++){
167 his->Fill((Float_t)fROC[idet]->GetStatus(ichannel));
176 //_____________________________________________________________________________
177 TH2F *AliTRDCalPadStatus::MakeHisto2DSmPl(Int_t sm, Int_t pl)
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();
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));
195 Int_t offsetsmpl = 30*sm+pl;
197 for (Int_t k = 0; k < kNcham; k++){
198 Int_t det = offsetsmpl+k*6;
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++){
204 Int_t kb = kNcham-1-k;
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;
210 Float_t value = calRoc->GetStatus(icol,irow);
211 his->SetBinContent(binz,biny,value);
214 for(Int_t icol = 1; icol < 147; icol++){
215 for(Int_t l = 0; l < 2; l++){
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);
220 his->SetBinContent(binz,icol,50.0);
225 for(Int_t icol = 1; icol < 147; icol++){
226 his->SetBinContent(88,icol,50.0);
227 his->SetBinContent(87,icol,50.0);
229 for(Int_t irow = 1; irow < 89; irow++){
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);
236 his->SetXTitle("z (cm)");
237 his->SetYTitle("y (cm)");
239 his->SetMinimum(0.0);
246 //_____________________________________________________________________________
247 void AliTRDCalPadStatus::PlotHistos2DSm(Int_t sm, const Char_t *name)
253 gStyle->SetPalette(1);
254 TCanvas *c1 = new TCanvas(name,name,50,50,600,800);
257 MakeHisto2DSmPl(sm,0)->Draw("colz");
259 MakeHisto2DSmPl(sm,1)->Draw("colz");
261 MakeHisto2DSmPl(sm,2)->Draw("colz");
263 MakeHisto2DSmPl(sm,3)->Draw("colz");
265 MakeHisto2DSmPl(sm,4)->Draw("colz");
267 MakeHisto2DSmPl(sm,5)->Draw("colz");