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