]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
2aea926d | 3 | * * |
b0f5e3fc | 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 | **************************************************************************/ | |
48058160 | 15 | /* |
16 | $Id$ | |
17 | $Log$ | |
18 | */ | |
b0f5e3fc | 19 | |
1ca7869b | 20 | #include <TString.h> |
2aea926d | 21 | #include <TRandom.h> |
1ca7869b | 22 | |
b0f5e3fc | 23 | #include "AliITSresponseSDD.h" |
b0f5e3fc | 24 | |
50d05d7b | 25 | |
48058160 | 26 | //______________________________________________________________________ |
27 | ClassImp(AliITSresponseSDD) | |
50d05d7b | 28 | |
48058160 | 29 | AliITSresponseSDD::AliITSresponseSDD(){ |
50d05d7b | 30 | // default constructor |
31 | fGaus = 0; | |
32 | SetDeadChannels(); | |
33 | SetMaxAdc(); | |
34 | SetDiffCoeff(); | |
35 | SetDriftSpeed(); | |
36 | SetNSigmaIntegration(); | |
37 | SetNLookUp(); | |
38 | // SetClock(); | |
39 | SetNoiseParam(); | |
40 | SetNoiseAfterElectronics(); | |
48058160 | 41 | SetJitterError(); |
50d05d7b | 42 | SetElectronics(); |
43 | SetDynamicRange(); | |
44 | SetChargeLoss(); | |
45 | SetMinVal(); | |
46 | SetParamOptions(); | |
47 | SetTemperature(); | |
48 | SetZeroSupp(); | |
49 | SetDataType(); | |
50 | SetFilenames(); | |
51 | SetOutputOption(); | |
52 | SetDo10to8(); | |
53 | // set the default zero suppression parameters | |
54 | fCPar[0]=0; | |
55 | fCPar[1]=0; | |
48058160 | 56 | fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5); |
57 | fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5); | |
50d05d7b | 58 | fCPar[4]=0; |
59 | fCPar[5]=0; | |
60 | fCPar[6]=0; | |
61 | fCPar[7]=0; | |
9de0700b | 62 | } |
48058160 | 63 | //______________________________________________________________________ |
64 | AliITSresponseSDD::AliITSresponseSDD(const char *dataType){ | |
b0f5e3fc | 65 | // constructor |
50d05d7b | 66 | fGaus = 0; |
2aea926d | 67 | SetDeadChannels(); |
b0f5e3fc | 68 | SetMaxAdc(); |
69 | SetDiffCoeff(); | |
b0f5e3fc | 70 | SetDriftSpeed(); |
e8189707 | 71 | SetNSigmaIntegration(); |
50d05d7b | 72 | SetNLookUp(); |
b0f5e3fc | 73 | // SetClock(); |
74 | SetNoiseParam(); | |
7551c5b2 | 75 | SetNoiseAfterElectronics(); |
48058160 | 76 | SetJitterError(); |
7551c5b2 | 77 | SetElectronics(); |
78 | SetDynamicRange(); | |
79 | SetChargeLoss(); | |
b0f5e3fc | 80 | SetMinVal(); |
81 | SetParamOptions(); | |
50d05d7b | 82 | SetTemperature(); |
b0f5e3fc | 83 | SetZeroSupp(); |
9de0700b | 84 | SetDataType(dataType); |
b0f5e3fc | 85 | SetFilenames(); |
86 | SetOutputOption(); | |
fa1750f9 | 87 | SetDo10to8(); |
f49604ec | 88 | // set the default zero suppression parameters |
89 | fCPar[0]=0; | |
90 | fCPar[1]=0; | |
48058160 | 91 | fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5); |
92 | fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5); | |
f49604ec | 93 | fCPar[4]=0; |
94 | fCPar[5]=0; | |
95 | fCPar[6]=0; | |
96 | fCPar[7]=0; | |
b0f5e3fc | 97 | } |
48058160 | 98 | //______________________________________________________________________ |
03898a57 | 99 | AliITSresponseSDD::~AliITSresponseSDD() { |
b0f5e3fc | 100 | |
03898a57 | 101 | if(fGaus) delete fGaus; |
b0f5e3fc | 102 | } |
48058160 | 103 | //______________________________________________________________________ |
104 | void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){ | |
b0f5e3fc | 105 | // set compression param |
e8189707 | 106 | |
b0f5e3fc | 107 | Int_t i; |
e8189707 | 108 | for (i=0; i<8; i++) { |
50d05d7b | 109 | fCPar[i]=cp[i]; |
48058160 | 110 | //printf("\n CompressPar %d %d \n",i,fCPar[i]); |
111 | } // end for i | |
b0f5e3fc | 112 | } |
48058160 | 113 | //______________________________________________________________________ |
114 | void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]){ | |
b0f5e3fc | 115 | // give compression param |
e8189707 | 116 | |
b0f5e3fc | 117 | Int_t i; |
e8189707 | 118 | for (i=0; i<8; i++) { |
50d05d7b | 119 | cp[i]=fCPar[i]; |
48058160 | 120 | } // end for i |
b0f5e3fc | 121 | } |
48058160 | 122 | //______________________________________________________________________ |
123 | void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){ | |
50d05d7b | 124 | // Set fGain to zero to simulate a random distribution of |
125 | // dead modules, dead chips and single dead channels | |
2aea926d | 126 | |
50d05d7b | 127 | for( Int_t m=0; m<fModules; m++ ) |
128 | for( Int_t n=0; n<fChips; n++ ) | |
129 | for( Int_t p=0; p<fChannels; p++ ) | |
130 | fGain[m][n][p] = 1.; | |
131 | ||
132 | fDeadModules = nmod; | |
133 | fDeadChips = nchip; | |
134 | fDeadChannels = nchan; | |
135 | ||
136 | // nothing to do | |
137 | if( nmod == 0 && nchip == 0 && nchan == 0 ) return; | |
2aea926d | 138 | |
50d05d7b | 139 | if( nmod < 0 || nmod > fModules ) |
140 | { | |
141 | cout << "Wrong number of dead modules: " << nmod << endl; | |
142 | return; | |
143 | } | |
144 | Int_t nmax = (fModules-nmod)*fChips; | |
145 | if( nchip < 0 || nchip > nmax ) | |
146 | { | |
147 | cout << "Wrong number of dead chips: " << nchip << endl; | |
148 | return; | |
149 | } | |
150 | nmax = ((fModules - nmod)*fChips - nchip)*fChannels; | |
151 | if( nchan < 0 || nchan > nmax ) | |
152 | { | |
153 | cout << "Wrong number of dead channels: " << nchan << endl; | |
154 | return; | |
155 | } | |
2aea926d | 156 | |
50d05d7b | 157 | TRandom *gran = new TRandom(); |
2aea926d | 158 | |
50d05d7b | 159 | // cout << "modules" << endl; |
160 | Int_t * mod = new Int_t [nmod]; | |
161 | Int_t i; //loop variable | |
162 | for( i=0; i<nmod; i++ ) | |
163 | { | |
164 | mod[i] = (Int_t) (1.+fModules*gran->Uniform()); | |
165 | cout << i+1 << ": Dead module nr: " << mod[i] << endl; | |
166 | for(Int_t n=0; n<fChips; n++) | |
167 | for(Int_t p=0; p<fChannels; p++) | |
168 | fGain[mod[i]-1][n][p] = 0.; | |
169 | } | |
170 | ||
171 | // cout << "chips" << endl; | |
172 | Int_t * chip = new Int_t[nchip]; | |
173 | Int_t * chip_mod = new Int_t[nchip]; | |
174 | i = 0; | |
175 | while( i < nchip ) | |
176 | { | |
177 | Int_t module = (Int_t) (fModules*gran->Uniform() + 1.); | |
178 | if( module <=0 || module > fModules ) | |
179 | cout << "Wrong module: " << module << endl; | |
180 | Int_t flag_mod = 0; | |
181 | for( Int_t k=0; k<nmod; k++ ) | |
182 | if( module == mod[k] ) { flag_mod = 1; break; } | |
183 | if( flag_mod == 1 ) continue; | |
184 | ||
185 | Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.); | |
186 | if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl; | |
187 | i++; | |
188 | chip[i-1] = chi; | |
189 | chip_mod[i-1] = module; | |
190 | for( Int_t m=0; m<fChannels; m++ ) | |
191 | fGain[module-1][chi-1][m] = 0.; | |
48058160 | 192 | cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: " |
193 | << chip_mod[i-1] << endl; | |
50d05d7b | 194 | } |
195 | ||
196 | // cout << "channels" << endl; | |
197 | Int_t * channel = new Int_t[nchan]; | |
198 | Int_t * channel_chip = new Int_t[nchan]; | |
199 | Int_t * channel_mod = new Int_t[nchan]; | |
200 | i = 0; | |
201 | while( i < nchan ) | |
202 | { | |
203 | Int_t k; //loop variable | |
204 | Int_t module = (Int_t) (fModules*gran->Uniform() + 1.); | |
205 | if( module <=0 || module > fModules ) | |
206 | cout << "Wrong module: " << module << endl; | |
207 | Int_t flag_mod = 0; | |
208 | for( k=0; k<nmod; k++ ) | |
209 | if( module == mod[k] ) { flag_mod = 1; break; } | |
210 | if( flag_mod == 1 ) continue; | |
211 | Int_t chipp = (Int_t) (fChips*gran->Uniform() + 1.); | |
48058160 | 212 | if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<<endl; |
50d05d7b | 213 | Int_t flag_chip = 0; |
214 | for( k=0; k<nchip; k++) | |
48058160 | 215 | if( chipp == chip[k] && module == chip_mod[k] ) { |
216 | flag_chip = 1; break; } | |
50d05d7b | 217 | if( flag_chip == 1 ) continue; |
218 | i++; | |
219 | channel[i-1] = (Int_t) (fChannels*gran->Uniform() + 1.); | |
220 | if( channel[i-1] <=0 || channel[i-1] > fChannels ) | |
221 | cout << "Wrong channel: " << channel[i-1] << endl; | |
222 | channel_chip[i-1] = chipp; | |
223 | channel_mod[i-1] = module; | |
224 | fGain[module-1][chipp-1][channel[i-1]-1] = 0.; | |
48058160 | 225 | cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " |
226 | << channel_chip[i-1] << " in module nr: " << channel_mod[i-1] | |
227 | << endl; | |
50d05d7b | 228 | } |
229 | ||
230 | delete [] mod; | |
231 | delete [] chip; | |
232 | delete [] chip_mod; | |
233 | delete [] channel; | |
234 | delete [] channel_mod; | |
235 | delete [] channel_chip; | |
2aea926d | 236 | } |
48058160 | 237 | //______________________________________________________________________ |
238 | void AliITSresponseSDD::PrintGains(){ | |
239 | // | |
2aea926d | 240 | |
48058160 | 241 | if( GetDeadModules() == 0 && |
242 | GetDeadChips() == 0 && | |
243 | GetDeadChannels() == 0 ) | |
244 | return; | |
245 | ||
246 | // Print Electronics Gains | |
50d05d7b | 247 | cout << "**************************************************" << endl; |
248 | cout << " Print Electronics Gains " << endl; | |
249 | cout << "**************************************************" << endl; | |
250 | ||
2aea926d | 251 | // Print SDD electronic gains |
252 | for(Int_t t=0; t<fModules;t++) | |
253 | for(Int_t u=0; u<fChips;u++) | |
254 | for(Int_t v=0; v<fChannels;v++) | |
50d05d7b | 255 | { |
48058160 | 256 | if( fGain[t][u][v] != 1.0 ) |
257 | cout << "Gain for Module: " << t+1 << ", Chip " << u+1 << | |
258 | ", Channel " << v+1 << " = " << fGain[t][u][v] << endl; | |
50d05d7b | 259 | } |
2aea926d | 260 | } |
48058160 | 261 | //______________________________________________________________________ |
262 | void AliITSresponseSDD::Print(){ | |
7551c5b2 | 263 | // Print SDD response Parameters |
264 | ||
265 | cout << "**************************************************" << endl; | |
266 | cout << " Silicon Drift Detector Response Parameters " << endl; | |
267 | cout << "**************************************************" << endl; | |
48058160 | 268 | cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl; |
7551c5b2 | 269 | |
270 | cout << "Hardware compression parameters: " << endl; | |
48058160 | 271 | for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl; |
7551c5b2 | 272 | cout << "Noise before electronics (arbitrary units): " << fNoise << endl; |
273 | cout << "Baseline (ADC units): " << fBaseline << endl; | |
274 | cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl; | |
275 | ||
276 | cout << "Dynamic Range: " << fDynamicRange << endl; | |
277 | cout << "Charge Loss: " << fChargeLoss << endl; | |
278 | cout << "Temperature: " << fTemperature << endl; | |
279 | cout << "Drift Speed: " << fDriftSpeed << endl; | |
280 | cout << "Electronics (1=PASCAL, 2=OLA): " << fElectronics << endl; | |
281 | ||
282 | cout << "N. of Sigma for signal integration: " << fNsigmas << endl; | |
283 | cout << "N. of bins in lookup table: " << fNcomps << endl; | |
284 | ||
285 | cout << "Max. ADC Value: " << fMaxAdc << endl; | |
286 | cout << "Min. Value: " << fMinVal << endl; | |
287 | ||
2aea926d | 288 | PrintGains(); |
7551c5b2 | 289 | |
290 | } | |
291 | ||
292 | ||
293 |