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