]>
Commit | Line | Data |
---|---|---|
4a60ccc4 | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2009, 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 | // Implementation of the class for bad channel treatment in the tracker // | |
21 | // Stores 1 status bit for each SPD pixel and SDD anode: // | |
22 | // 0 = bad channel // | |
23 | // 1 = good channel // | |
24 | // Dead and noisy channels are read from AliITSCalibration objects // | |
25 | // Origin: F.Prino, Torino, prino@to.infn.it // | |
26 | // // | |
27 | ////////////////////////////////////////////////////////////////////////// | |
28 | ||
29 | #include "AliITSChannelStatus.h" | |
30 | #include "AliITSCalibrationSPD.h" | |
31 | #include "AliITSCalibrationSDD.h" | |
32 | #include "AliCDBEntry.h" | |
33 | #include "AliLog.h" | |
34 | ||
35 | ClassImp(AliITSChannelStatus) | |
36 | ||
37 | ||
38 | //______________________________________________________________________ | |
39 | AliITSChannelStatus::AliITSChannelStatus(): | |
40 | TObject(), | |
41 | fSPDChannelStatus(0), | |
42 | fSDDChannelStatus(0) | |
43 | { | |
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); | |
49 | InitDefaults(); | |
50 | } | |
51 | //______________________________________________________________________ | |
52 | AliITSChannelStatus::AliITSChannelStatus(AliCDBManager *cdb): | |
53 | TObject(), | |
54 | fSPDChannelStatus(0), | |
55 | fSDDChannelStatus(0) | |
56 | { | |
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"); | |
61 | ||
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"); | |
66 | ||
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"); | |
71 | ||
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); | |
77 | } | |
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); | |
86 | } | |
87 | } | |
88 | } | |
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); | |
93 | } | |
94 | } | |
95 | } | |
96 | //______________________________________________________________________ | |
97 | void AliITSChannelStatus::InitFromOCDB(TObjArray* deadArrSPD, TObjArray* noisArrSPD, TObjArray* calArrSDD){ | |
98 | // fills bitmaps from arrays of AliITSCalibrationSXD objects | |
99 | ||
100 | // SPD modules | |
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); | |
106 | } | |
107 | } | |
108 | Int_t ix,iz; | |
109 | ||
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); | |
116 | } | |
117 | ||
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); | |
124 | } | |
125 | } | |
126 | ||
127 | // SDD modules | |
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); | |
135 | } | |
136 | } | |
137 | } | |
138 | //______________________________________________________________________ | |
139 | AliITSChannelStatus::AliITSChannelStatus(const AliITSChannelStatus& cstatus): | |
140 | TObject(), | |
141 | fSPDChannelStatus(cstatus.fSPDChannelStatus), | |
142 | fSDDChannelStatus(cstatus.fSDDChannelStatus) | |
143 | { | |
144 | // copy constructor | |
145 | } | |
146 | //______________________________________________________________________ | |
147 | AliITSChannelStatus& AliITSChannelStatus::operator=(const AliITSChannelStatus& cstatus) | |
148 | { | |
149 | // assignment operator | |
150 | this->~AliITSChannelStatus(); | |
151 | new(this) AliITSChannelStatus(cstatus); | |
152 | return *this; | |
153 | } | |
154 | ||
155 | //______________________________________________________________________ | |
156 | AliITSChannelStatus::~AliITSChannelStatus(){ | |
157 | // destructor | |
158 | if(fSPDChannelStatus) delete fSPDChannelStatus; | |
159 | if(fSDDChannelStatus) delete fSDDChannelStatus; | |
160 | } | |
161 | ||
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)); | |
167 | return kFALSE; | |
168 | } | |
169 | if(imod<kSPDModules){ | |
170 | if(ix<0 || ix>=kSPDNpxPerModule || iz<0 || iz>=kSPDNpzPerModule){ | |
171 | AliError("SPD: Pixel number out of range"); | |
172 | return kFALSE; | |
173 | } | |
174 | }else{ | |
175 | if(iz<0 || iz>=kSDDAnodesPerModule){ | |
176 | AliError("SDD: anode number out of range"); | |
177 | return kFALSE; | |
178 | } | |
179 | } | |
180 | return kTRUE; | |
181 | } | |
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); | |
189 | }else{ | |
190 | imod-=kSPDModules; | |
191 | Int_t index=imod*kSDDAnodesPerModule+iz; | |
192 | return fSDDChannelStatus->TestBitNumber(index); | |
193 | } | |
194 | } | |
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); | |
202 | }else{ | |
203 | imod-=kSPDModules; | |
204 | Int_t index=imod*kSDDAnodesPerModule+iz; | |
205 | fSDDChannelStatus->SetBitNumber(index,cstatus); | |
206 | } | |
207 | } |