1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
21 #include "AliITSresponseSDD.h"
24 //______________________________________________________________________
25 ClassImp(AliITSresponseSDD)
27 AliITSresponseSDD::AliITSresponseSDD(){
28 // default constructor
34 SetNSigmaIntegration();
38 SetNoiseAfterElectronics();
51 // set the default zero suppression parameters
54 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
55 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
61 //______________________________________________________________________
62 AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
69 SetNSigmaIntegration();
73 SetNoiseAfterElectronics();
82 SetDataType(dataType);
86 // set the default zero suppression parameters
89 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
90 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
96 //______________________________________________________________________
97 AliITSresponseSDD::~AliITSresponseSDD() {
99 if(fGaus) delete fGaus;
101 //______________________________________________________________________
102 void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){
103 // set compression param
106 for (i=0; i<8; i++) {
108 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
111 //______________________________________________________________________
112 void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]){
113 // give compression param
116 for (i=0; i<8; i++) {
120 //______________________________________________________________________
121 void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
122 // Set fGain to zero to simulate a random distribution of
123 // dead modules, dead chips and single dead channels
125 for( Int_t m=0; m<fModules; m++ )
126 for( Int_t n=0; n<fChips; n++ )
127 for( Int_t p=0; p<fChannels; p++ )
132 fDeadChannels = nchan;
135 if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
137 if( nmod < 0 || nmod > fModules )
139 cout << "Wrong number of dead modules: " << nmod << endl;
142 Int_t nmax = (fModules-nmod)*fChips;
143 if( nchip < 0 || nchip > nmax )
145 cout << "Wrong number of dead chips: " << nchip << endl;
148 nmax = ((fModules - nmod)*fChips - nchip)*fChannels;
149 if( nchan < 0 || nchan > nmax )
151 cout << "Wrong number of dead channels: " << nchan << endl;
155 TRandom *gran = new TRandom();
157 // cout << "modules" << endl;
158 Int_t * mod = new Int_t [nmod];
159 Int_t i; //loop variable
160 for( i=0; i<nmod; i++ )
162 mod[i] = (Int_t) (1.+fModules*gran->Uniform());
163 cout << i+1 << ": Dead module nr: " << mod[i] << endl;
164 for(Int_t n=0; n<fChips; n++)
165 for(Int_t p=0; p<fChannels; p++)
166 fGain[mod[i]-1][n][p] = 0.;
169 // cout << "chips" << endl;
170 Int_t * chip = new Int_t[nchip];
171 Int_t * chip_mod = new Int_t[nchip];
175 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
176 if( module <=0 || module > fModules )
177 cout << "Wrong module: " << module << endl;
179 for( Int_t k=0; k<nmod; k++ )
180 if( module == mod[k] ) { flag_mod = 1; break; }
181 if( flag_mod == 1 ) continue;
183 Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.);
184 if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl;
187 chip_mod[i-1] = module;
188 for( Int_t m=0; m<fChannels; m++ )
189 fGain[module-1][chi-1][m] = 0.;
190 cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
191 << chip_mod[i-1] << endl;
194 // cout << "channels" << endl;
195 Int_t * channel = new Int_t[nchan];
196 Int_t * channel_chip = new Int_t[nchan];
197 Int_t * channel_mod = new Int_t[nchan];
201 Int_t k; //loop variable
202 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
203 if( module <=0 || module > fModules )
204 cout << "Wrong module: " << module << endl;
206 for( k=0; k<nmod; k++ )
207 if( module == mod[k] ) { flag_mod = 1; break; }
208 if( flag_mod == 1 ) continue;
209 Int_t chipp = (Int_t) (fChips*gran->Uniform() + 1.);
210 if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<<endl;
212 for( k=0; k<nchip; k++)
213 if( chipp == chip[k] && module == chip_mod[k] ) {
214 flag_chip = 1; break; }
215 if( flag_chip == 1 ) continue;
217 channel[i-1] = (Int_t) (fChannels*gran->Uniform() + 1.);
218 if( channel[i-1] <=0 || channel[i-1] > fChannels )
219 cout << "Wrong channel: " << channel[i-1] << endl;
220 channel_chip[i-1] = chipp;
221 channel_mod[i-1] = module;
222 fGain[module-1][chipp-1][channel[i-1]-1] = 0.;
223 cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. "
224 << channel_chip[i-1] << " in module nr: " << channel_mod[i-1]
232 delete [] channel_mod;
233 delete [] channel_chip;
235 //______________________________________________________________________
236 void AliITSresponseSDD::PrintGains(){
239 if( GetDeadModules() == 0 &&
240 GetDeadChips() == 0 &&
241 GetDeadChannels() == 0 )
244 // Print Electronics Gains
245 cout << "**************************************************" << endl;
246 cout << " Print Electronics Gains " << endl;
247 cout << "**************************************************" << endl;
249 // Print SDD electronic gains
250 for(Int_t t=0; t<fModules;t++)
251 for(Int_t u=0; u<fChips;u++)
252 for(Int_t v=0; v<fChannels;v++)
254 if( fGain[t][u][v] != 1.0 )
255 cout << "Gain for Module: " << t+1 << ", Chip " << u+1 <<
256 ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
259 //______________________________________________________________________
260 void AliITSresponseSDD::Print(){
261 // Print SDD response Parameters
263 cout << "**************************************************" << endl;
264 cout << " Silicon Drift Detector Response Parameters " << endl;
265 cout << "**************************************************" << endl;
266 cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl;
268 cout << "Hardware compression parameters: " << endl;
269 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
270 cout << "Noise before electronics (arbitrary units): " << fNoise << endl;
271 cout << "Baseline (ADC units): " << fBaseline << endl;
272 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl;
274 cout << "Dynamic Range: " << fDynamicRange << endl;
275 cout << "Charge Loss: " << fChargeLoss << endl;
276 cout << "Temperature: " << fTemperature << endl;
277 cout << "Drift Speed: " << fDriftSpeed << endl;
278 cout << "Electronics (1=PASCAL, 2=OLA): " << fElectronics << endl;
280 cout << "N. of Sigma for signal integration: " << fNsigmas << endl;
281 cout << "N. of bins in lookup table: " << fNcomps << endl;
283 cout << "Max. ADC Value: " << fMaxAdc << endl;
284 cout << "Min. Value: " << fMinVal << endl;