1 /**************************************************************************
2 * Copyright(c) 2007-2009, 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 // Implementation of the class for bad channel treatment in the tracker //
21 // Stores 1 status bit for each SPD pixel and SDD anode: //
23 // 1 = good channel //
24 // Dead and noisy channels are read from AliITSCalibration objects //
25 // Origin: F.Prino, Torino, prino@to.infn.it //
27 //////////////////////////////////////////////////////////////////////////
29 #include "AliITSChannelStatus.h"
30 #include "AliITSCalibrationSPD.h"
31 #include "AliITSCalibrationSDD.h"
32 #include "AliCDBEntry.h"
35 ClassImp(AliITSChannelStatus)
38 //______________________________________________________________________
39 AliITSChannelStatus::AliITSChannelStatus():
44 // default constructor
45 UInt_t nSPDchan=kSPDModules*kSPDNpxPerModule*kSPDNpzPerModule;
46 fSPDChannelStatus=new TBits(nSPDchan);
47 UInt_t nSDDchan=kSDDModules*kSDDAnodesPerModule;
48 fSDDChannelStatus=new TBits(nSDDchan);
51 //______________________________________________________________________
52 AliITSChannelStatus::AliITSChannelStatus(AliCDBManager *cdb):
57 AliCDBEntry* spdEntryD = cdb->Get("ITS/Calib/SPDDead");
58 if (!spdEntryD) AliFatal("Cannot get CDB entry for SPDDead");
59 TObjArray* deadArrSPD = (TObjArray*)spdEntryD->GetObject();
60 if (!deadArrSPD) AliFatal("No object found in SPDDead file");
62 AliCDBEntry* spdEntryN = cdb->Get("ITS/Calib/SPDNoisy");
63 if (!spdEntryN) AliFatal("Cannot get CDB entry for SPDNoisy");
64 TObjArray* noisArrSPD = (TObjArray*)spdEntryN->GetObject();
65 if (!noisArrSPD) AliFatal("No object found in SPDNoisy file");
67 AliCDBEntry* sddEntry = cdb->Get("ITS/Calib/CalibSDD");
68 if (!sddEntry) AliFatal("Cannot get CDB entry for CalibSDD");
69 TObjArray* calArrSDD = (TObjArray*)sddEntry->GetObject();
70 if (!calArrSDD) AliFatal("No object found in CalibSDD file");
72 UInt_t nSPDchan=kSPDModules*kSPDNpxPerModule*kSPDNpzPerModule;
73 fSPDChannelStatus=new TBits(nSPDchan);
74 UInt_t nSDDchan=kSDDModules*kSDDAnodesPerModule;
75 fSDDChannelStatus=new TBits(nSDDchan);
76 InitFromOCDB(deadArrSPD,noisArrSPD,calArrSDD);
78 //______________________________________________________________________
79 void AliITSChannelStatus::InitDefaults(){
80 // fill bitmaps setting all channels as good
81 for(Int_t imod=0; imod<kSPDModules; imod++){
82 for(Int_t ix=0; ix<kSPDNpxPerModule; ix++){
83 for(Int_t iz=0; iz<kSPDNpzPerModule; iz++){
84 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
85 fSPDChannelStatus->SetBitNumber(index,kTRUE);
89 for(Int_t imod=0; imod<kSDDModules; imod++){
90 for(Int_t ian=0; ian<kSDDAnodesPerModule; ian++){
91 Int_t index=imod*kSDDAnodesPerModule+ian;
92 fSDDChannelStatus->SetBitNumber(index,kTRUE);
96 //______________________________________________________________________
97 void AliITSChannelStatus::InitFromOCDB(TObjArray* deadArrSPD, TObjArray* noisArrSPD, TObjArray* calArrSDD){
98 // fills bitmaps from arrays of AliITSCalibrationSXD objects
101 for(Int_t imod=0; imod<kSPDModules; imod++){
102 for(Int_t ix=0; ix<kSPDNpxPerModule; ix++){
103 for(Int_t iz=0; iz<kSPDNpzPerModule; iz++){
104 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
105 fSPDChannelStatus->SetBitNumber(index,kTRUE);
110 // Mask SPD dead pixels
111 AliITSCalibrationSPD* deadspd=(AliITSCalibrationSPD*)deadArrSPD->At(imod);
112 for(Int_t ipix=0; ipix<deadspd->GetNrBad();ipix++){
113 deadspd->GetBadPixel(ipix,ix,iz);
114 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
115 fSPDChannelStatus->SetBitNumber(index,kFALSE);
118 // Mask SPD noisy pixels
119 AliITSCalibrationSPD* noisspd=(AliITSCalibrationSPD*)noisArrSPD->At(imod);
120 for(Int_t ipix=0; ipix<noisspd->GetNrBad();ipix++){
121 noisspd->GetBadPixel(ipix,ix,iz);
122 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
123 fSPDChannelStatus->SetBitNumber(index,kFALSE);
128 for(Int_t imod=0; imod<kSDDModules; imod++){
129 AliITSCalibrationSDD* calsdd=(AliITSCalibrationSDD*)calArrSDD->At(imod);
130 for(Int_t ian=0; ian<kSDDAnodesPerModule; ian++){
131 Bool_t cstatus=kTRUE;
132 if(calsdd->IsBadChannel(ian)) cstatus=kFALSE;
133 Int_t index=imod*kSDDAnodesPerModule+ian;
134 fSDDChannelStatus->SetBitNumber(index,cstatus);
138 //______________________________________________________________________
139 AliITSChannelStatus::AliITSChannelStatus(const AliITSChannelStatus& cstatus):
141 fSPDChannelStatus(cstatus.fSPDChannelStatus),
142 fSDDChannelStatus(cstatus.fSDDChannelStatus)
146 //______________________________________________________________________
147 AliITSChannelStatus& AliITSChannelStatus::operator=(const AliITSChannelStatus& cstatus)
149 // assignment operator
150 this->~AliITSChannelStatus();
151 new(this) AliITSChannelStatus(cstatus);
155 //______________________________________________________________________
156 AliITSChannelStatus::~AliITSChannelStatus(){
158 if(fSPDChannelStatus) delete fSPDChannelStatus;
159 if(fSDDChannelStatus) delete fSDDChannelStatus;
162 //______________________________________________________________________
163 Bool_t AliITSChannelStatus::CheckBounds(Int_t imod, Int_t iz, Int_t ix) const {
164 // check for out of bounds
165 if(imod<0 || imod>=kSPDModules+kSDDModules){
166 AliError(Form("Module number out of range 0-%d",kSPDModules+kSDDModules));
169 if(imod<kSPDModules){
170 if(ix<0 || ix>=kSPDNpxPerModule || iz<0 || iz>=kSPDNpzPerModule){
171 AliError("SPD: Pixel number out of range");
175 if(iz<0 || iz>=kSDDAnodesPerModule){
176 AliError("SDD: anode number out of range");
182 //______________________________________________________________________
183 Bool_t AliITSChannelStatus::GetChannelStatus(Int_t imod, Int_t iz, Int_t ix) const {
184 // return status of inquired channel
185 if(CheckBounds(imod,iz,ix)==kFALSE) return kFALSE;
186 if(imod<kSPDModules){
187 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
188 return fSPDChannelStatus->TestBitNumber(index);
191 Int_t index=imod*kSDDAnodesPerModule+iz;
192 return fSDDChannelStatus->TestBitNumber(index);
195 //______________________________________________________________________
196 void AliITSChannelStatus::SetChannelStatus(Bool_t cstatus, Int_t imod, Int_t iz, Int_t ix){
197 // set status for given channel
198 if(CheckBounds(imod,iz,ix)==kFALSE) return;
199 if(imod<kSPDModules){
200 Int_t index=imod*kSPDNpxPerModule*kSPDNpzPerModule+ix*kSPDNpzPerModule+iz;
201 fSPDChannelStatus->SetBitNumber(index,cstatus);
204 Int_t index=imod*kSDDAnodesPerModule+iz;
205 fSDDChannelStatus->SetBitNumber(index,cstatus);