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 **************************************************************************/
18 Revision 1.18.4.1 2002/06/10 17:51:15 hristov
21 Revision 1.19 2002/04/24 22:02:31 nilsen
22 New SDigits and Digits routines, and related changes, (including new
30 #include "AliITSresponseSDD.h"
33 //______________________________________________________________________
34 ClassImp(AliITSresponseSDD)
36 AliITSresponseSDD::AliITSresponseSDD(){
37 // default constructor
43 SetNSigmaIntegration();
47 SetNoiseAfterElectronics();
60 // set the default zero suppression parameters
63 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
64 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
70 //______________________________________________________________________
71 AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
78 SetNSigmaIntegration();
82 SetNoiseAfterElectronics();
91 SetDataType(dataType);
95 // set the default zero suppression parameters
98 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
99 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
105 //______________________________________________________________________
106 AliITSresponseSDD::~AliITSresponseSDD() {
108 if(fGaus) delete fGaus;
110 //______________________________________________________________________
111 void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){
112 // set compression param
115 for (i=0; i<8; i++) {
117 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
120 //______________________________________________________________________
121 void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]){
122 // give compression param
125 for (i=0; i<8; i++) {
129 //______________________________________________________________________
130 void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
131 // Set fGain to zero to simulate a random distribution of
132 // dead modules, dead chips and single dead channels
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++ )
141 fDeadChannels = nchan;
144 if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
146 if( nmod < 0 || nmod > fModules )
148 cout << "Wrong number of dead modules: " << nmod << endl;
151 Int_t nmax = (fModules-nmod)*fChips;
152 if( nchip < 0 || nchip > nmax )
154 cout << "Wrong number of dead chips: " << nchip << endl;
157 nmax = ((fModules - nmod)*fChips - nchip)*fChannels;
158 if( nchan < 0 || nchan > nmax )
160 cout << "Wrong number of dead channels: " << nchan << endl;
164 TRandom *gran = new TRandom();
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++ )
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.;
178 // cout << "chips" << endl;
179 Int_t * chip = new Int_t[nchip];
180 Int_t * chip_mod = new Int_t[nchip];
184 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
185 if( module <=0 || module > fModules )
186 cout << "Wrong module: " << module << endl;
188 for( Int_t k=0; k<nmod; k++ )
189 if( module == mod[k] ) { flag_mod = 1; break; }
190 if( flag_mod == 1 ) continue;
192 Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.);
193 if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl;
196 chip_mod[i-1] = module;
197 for( Int_t m=0; m<fChannels; m++ )
198 fGain[module-1][chi-1][m] = 0.;
199 cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
200 << chip_mod[i-1] << endl;
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];
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;
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.);
219 if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<<endl;
221 for( k=0; k<nchip; k++)
222 if( chipp == chip[k] && module == chip_mod[k] ) {
223 flag_chip = 1; break; }
224 if( flag_chip == 1 ) continue;
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.;
232 cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. "
233 << channel_chip[i-1] << " in module nr: " << channel_mod[i-1]
241 delete [] channel_mod;
242 delete [] channel_chip;
244 //______________________________________________________________________
245 void AliITSresponseSDD::PrintGains(){
248 if( GetDeadModules() == 0 &&
249 GetDeadChips() == 0 &&
250 GetDeadChannels() == 0 )
253 // Print Electronics Gains
254 cout << "**************************************************" << endl;
255 cout << " Print Electronics Gains " << endl;
256 cout << "**************************************************" << endl;
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++)
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;
268 //______________________________________________________________________
269 void AliITSresponseSDD::Print(){
270 // Print SDD response Parameters
272 cout << "**************************************************" << endl;
273 cout << " Silicon Drift Detector Response Parameters " << endl;
274 cout << "**************************************************" << endl;
275 cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl;
277 cout << "Hardware compression parameters: " << endl;
278 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
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;
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;
289 cout << "N. of Sigma for signal integration: " << fNsigmas << endl;
290 cout << "N. of bins in lookup table: " << fNcomps << endl;
292 cout << "Max. ADC Value: " << fMaxAdc << endl;
293 cout << "Min. Value: " << fMinVal << endl;