]>
Commit | Line | Data |
---|---|---|
fcf95fc7 | 1 | /************************************************************************** |
c2bd28b6 | 2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. * |
fcf95fc7 | 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 | ||
c2bd28b6 | 16 | /* $Id$ */ |
fcf95fc7 | 17 | |
18 | #include <Riostream.h> | |
19 | #include <TRandom.h> | |
20 | #include "AliITSCalibrationSDD.h" | |
f45f6658 | 21 | #include "AliLog.h" |
fcf95fc7 | 22 | |
23 | ////////////////////////////////////////////////////// | |
24 | // Calibration class for set:ITS // | |
25 | // Specific subdetector implementation // | |
26 | // for silicon drift detectors // | |
27 | // // | |
28 | // // | |
29 | ////////////////////////////////////////////////////// | |
30 | ||
4bfbde86 | 31 | const Float_t AliITSCalibrationSDD::fgkTemperatureDefault = 296.; |
32 | const Float_t AliITSCalibrationSDD::fgkNoiseDefault = 10.; | |
33 | const Float_t AliITSCalibrationSDD::fgkGainDefault = 1.; | |
34 | const Float_t AliITSCalibrationSDD::fgkBaselineDefault = 20.; | |
35 | const Float_t AliITSCalibrationSDD::fgkMinValDefault = 4; | |
fcf95fc7 | 36 | //______________________________________________________________________ |
37 | ClassImp(AliITSCalibrationSDD) | |
38 | ||
4bfbde86 | 39 | AliITSCalibrationSDD::AliITSCalibrationSDD(): |
40 | AliITSCalibration(), | |
41 | fDeadChips(0), | |
42 | fDeadChannels(0), | |
43 | fMinVal(fgkMinValDefault), | |
44 | fIsDead(kFALSE), | |
028a3709 | 45 | fBadChannels(), |
46 | fMapAW0(0), | |
47 | fMapAW1(0), | |
48 | fMapTW0(0), | |
18da6e54 | 49 | fMapTW1(0), |
50 | fDrSpeed0(0), | |
51 | fDrSpeed1(0) | |
4bfbde86 | 52 | { |
fcf95fc7 | 53 | // default constructor |
54 | ||
55 | SetDeadChannels(); | |
f45f6658 | 56 | for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){ |
57 | fBaseline[ian]=fgkBaselineDefault; | |
58 | fNoise[ian]=fgkNoiseDefault; | |
59 | SetNoiseAfterElectronics(ian); | |
60 | } | |
61 | for(Int_t iw=0;iw<fgkWings;iw++){ | |
62 | for(Int_t icp=0;icp<fgkChips;icp++){ | |
63 | for(Int_t ich=0;ich<fgkChannels;ich++) | |
64 | fGain[iw][icp][ich]=1.; | |
65 | } | |
66 | } | |
fcf95fc7 | 67 | SetThresholds(fgkMinValDefault,0.); |
68 | SetTemperature(fgkTemperatureDefault); | |
69 | SetDataType(); | |
fcf95fc7 | 70 | } |
71 | //______________________________________________________________________ | |
4bfbde86 | 72 | AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType): |
73 | AliITSCalibration(), | |
74 | fDeadChips(0), | |
75 | fDeadChannels(0), | |
76 | fMinVal(fgkMinValDefault), | |
77 | fIsDead(kFALSE), | |
028a3709 | 78 | fBadChannels(), |
79 | fMapAW0(0), | |
80 | fMapAW1(0), | |
81 | fMapTW0(0), | |
18da6e54 | 82 | fMapTW1(0), |
83 | fDrSpeed0(0), | |
84 | fDrSpeed1(0) | |
85 | { | |
fcf95fc7 | 86 | // constructor |
87 | ||
88 | SetDeadChannels(); | |
f45f6658 | 89 | for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){ |
90 | fBaseline[ian]=fgkBaselineDefault; | |
91 | fNoise[ian]=fgkNoiseDefault; | |
92 | SetNoiseAfterElectronics(ian); | |
93 | } | |
94 | for(Int_t iw=0;iw<fgkWings;iw++){ | |
95 | for(Int_t icp=0;icp<fgkChips;icp++){ | |
96 | for(Int_t ich=0;ich<fgkChannels;ich++) | |
97 | fGain[iw][icp][ich]=1.; | |
98 | } | |
99 | } | |
fcf95fc7 | 100 | |
fcf95fc7 | 101 | SetThresholds(fgkMinValDefault,0.); |
102 | SetTemperature(fgkTemperatureDefault); | |
103 | SetDataType(dataType); | |
fcf95fc7 | 104 | } |
028a3709 | 105 | //_____________________________________________________________________ |
106 | AliITSCalibrationSDD::~AliITSCalibrationSDD(){ | |
fcf95fc7 | 107 | |
028a3709 | 108 | //destructor |
109 | if(fMapAW0) delete fMapAW0; | |
110 | if(fMapAW1) delete fMapAW1; | |
111 | if(fMapTW0) delete fMapTW0; | |
112 | if(fMapTW1) delete fMapTW1; | |
18da6e54 | 113 | if(fDrSpeed0) delete fDrSpeed0; |
114 | if(fDrSpeed1) delete fDrSpeed1; | |
028a3709 | 115 | } |
fcf95fc7 | 116 | |
117 | //______________________________________________________________________ | |
f45f6658 | 118 | void AliITSCalibrationSDD::GiveCompressParam(Int_t cp[8],Int_t ian) const { |
fcf95fc7 | 119 | // give compression param |
120 | ||
f45f6658 | 121 | cp[0]=(Int_t) fBaseline[ian]; |
122 | cp[1]=(Int_t) fBaseline[ian]; | |
123 | cp[2]=(Int_t)(2.*fNoiseAfterEl[ian] + 0.5); | |
124 | cp[3]=(Int_t)(2.*fNoiseAfterEl[ian] + 0.5); | |
125 | cp[4]=0; | |
126 | cp[5]=0; | |
127 | cp[6]=0; | |
128 | cp[7]=0; | |
fcf95fc7 | 129 | } |
f45f6658 | 130 | //_____________________________________________________________________ |
131 | void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){ | |
132 | //Set bad anode (set gain=0 for these channels); | |
fcf95fc7 | 133 | |
f45f6658 | 134 | if(anode<0 || anode >fgkChannels*fgkChips*fgkWings-1)AliError("Wrong anode number"); |
135 | Int_t wing=0; | |
136 | Int_t chip,channel; | |
137 | chip=anode/fgkChannels; | |
138 | channel=anode-(chip*fgkChannels); | |
139 | if(anode>=fgkChips*fgkChannels) wing=1; | |
140 | if(wing==1)chip-=fgkChips; | |
141 | fBadChannels[i]=anode; | |
142 | fGain[wing][chip][channel]=0; | |
143 | } | |
4952f440 | 144 | //______________________________________________________________________ |
145 | Float_t AliITSCalibrationSDD::GetChannelGain(Int_t anode) const{ | |
146 | // returns gain for givenanode | |
147 | Int_t iWing=GetWing(anode); | |
148 | Int_t iChip=GetChip(anode); | |
149 | Int_t iChan=GetChipChannel(anode); | |
150 | return fGain[iWing][iChip][iChan]; | |
151 | } | |
f45f6658 | 152 | /* |
fcf95fc7 | 153 | //______________________________________________________________________ |
154 | void AliITSCalibrationSDD::SetDeadChannels(Int_t nchip, Int_t nchan){ | |
155 | // Set fGain to zero to simulate a random distribution of | |
156 | // dead modules, dead chips and single dead channels | |
157 | ||
158 | for( Int_t m=0; m<fgkWings; m++ ) | |
159 | for( Int_t n=0; n<fgkChips; n++ ) | |
160 | for( Int_t p=0; p<fgkChannels; p++ ) | |
161 | fGain[m][n][p] = 1.; | |
162 | ||
163 | //fDeadModules = nmod; | |
164 | fDeadChips = nchip; | |
165 | fDeadChannels = nchan; | |
f45f6658 | 166 | fBadChannels.Set(fDeadChannels); |
fcf95fc7 | 167 | // nothing to do |
168 | //if( nmod == 0 && nchip == 0 && nchan == 0 ) return; | |
169 | ||
170 | if( nchip == 0 && nchan == 0 ) return; | |
171 | // if( nmod < 0 || nmod > fgkModules ) | |
172 | // { | |
173 | // cout << "Wrong number of dead modules: " << nmod << endl; | |
174 | // return; | |
175 | // } | |
176 | ||
177 | Int_t nmax = fgkWings*fgkChips; | |
178 | if( nchip < 0 || nchip > nmax ) | |
179 | { | |
180 | cout << "Wrong number of dead chips: " << nchip << endl; | |
181 | return; | |
182 | } | |
183 | nmax = (fgkWings*fgkChips - nchip)*fgkChannels; | |
184 | if( nchan < 0 || nchan > nmax ) | |
185 | { | |
186 | cout << "Wrong number of dead channels: " << nchan << endl; | |
187 | return; | |
188 | } | |
189 | ||
190 | TRandom *gran = new TRandom(); | |
fcf95fc7 | 191 | // cout << "chips" << endl; |
192 | Int_t * chip = new Int_t[nchip]; | |
193 | Int_t i = 0; | |
194 | while( i < nchip ) | |
195 | { | |
196 | Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.); | |
197 | if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing"); | |
198 | ||
199 | Int_t chi = (Int_t) (fgkChips*gran->Uniform() + 1.); | |
200 | if( chi <=0 || chi > fgkChips ) Error("SetDeadChannels","Wrong chip:%d\n",chi); | |
201 | i++; | |
202 | chip[i-1] = chi; | |
203 | for( Int_t m=0; m<fgkChannels; m++ ) | |
204 | fGain[wing-1][chi-1][m] = 0.; | |
205 | } | |
206 | ||
207 | Int_t * channel = new Int_t[nchan]; | |
208 | Int_t * channelChip = new Int_t[nchan]; | |
209 | i = 0; | |
210 | while( i < nchan ) | |
211 | { | |
212 | Int_t k; //loop variable | |
213 | Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.); | |
214 | if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing:%d\n",wing); | |
215 | Int_t chipp = (Int_t) (fgkChips*gran->Uniform() + 1.); | |
216 | if( chipp <=0 || chipp > fgkChips ) Error("SetDeadChannels","Wrong chip:%d",chipp); | |
217 | Int_t flagChip = 0; | |
218 | for( k=0; k<nchip; k++) | |
219 | if( chipp == chip[k] ) { | |
220 | flagChip = 1; break; } | |
221 | if( flagChip == 1 ) continue; | |
222 | i++; | |
223 | channel[i-1] = (Int_t) (fgkChannels*gran->Uniform() + 1.); | |
224 | if( channel[i-1] <=0 || channel[i-1] > fgkChannels ) | |
225 | Error("SetDeadChannels","Wrong channel:%d\n",channel[i-1]); | |
226 | channelChip[i-1] = chipp; | |
227 | fGain[wing-1][chipp-1][channel[i-1]-1] = 0.; | |
228 | } | |
229 | ||
230 | delete [] chip; | |
231 | delete [] channel; | |
232 | delete [] channelChip; | |
233 | } | |
f45f6658 | 234 | */ |
4952f440 | 235 | |
236 | ||
fcf95fc7 | 237 | //______________________________________________________________________ |
238 | void AliITSCalibrationSDD::PrintGains() const{ | |
239 | // | |
240 | ||
241 | if( GetDeadChips() == 0 && | |
242 | GetDeadChannels() == 0 ) | |
243 | return; | |
244 | ||
245 | // Print Electronics Gains | |
246 | cout << "**************************************************" << endl; | |
247 | cout << " Print Electronics Gains " << endl; | |
248 | cout << "**************************************************" << endl; | |
249 | ||
250 | // Print SDD electronic gains | |
251 | for(Int_t t=0; t<fgkWings;t++) | |
252 | for(Int_t u=0; u<fgkChips;u++) | |
253 | for(Int_t v=0; v<fgkChannels;v++) | |
254 | { | |
255 | if( fGain[t][u][v] != 1.0 ) | |
256 | cout << "Gain for wing: " << t+1 << ", Chip " << u+1 << | |
257 | ", Channel " << v+1 << " = " << fGain[t][u][v] << endl; | |
258 | } | |
259 | } | |
e56160b8 | 260 | |
fcf95fc7 | 261 | //______________________________________________________________________ |
262 | void AliITSCalibrationSDD::Print(){ | |
263 | // Print SDD response Parameters | |
264 | ||
265 | cout << "**************************************************" << endl; | |
266 | cout << " Silicon Drift Detector Response Parameters " << endl; | |
267 | cout << "**************************************************" << endl; | |
268 | cout << "Hardware compression parameters: " << endl; | |
f45f6658 | 269 | cout << "Noise before electronics (arbitrary units): " << fNoise[0] << endl; |
270 | cout << "Baseline (ADC units): " << fBaseline[0] << endl; | |
271 | cout << "Noise after electronics (ADC units): " << fNoiseAfterEl[0] << endl; | |
fcf95fc7 | 272 | cout << "Temperature: " << Temperature() << " K " << endl; |
273 | cout << "Min. Value: " << fMinVal << endl; | |
274 | PrintGains(); | |
275 | ||
5bfe44ce | 276 | } |