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 **************************************************************************/
23 #include "AliITSresponseSDD.h"
26 //______________________________________________________________________
27 ClassImp(AliITSresponseSDD)
29 AliITSresponseSDD::AliITSresponseSDD(){
30 // default constructor
36 SetNSigmaIntegration();
40 SetNoiseAfterElectronics();
53 // set the default zero suppression parameters
56 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
57 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
63 //______________________________________________________________________
64 AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
71 SetNSigmaIntegration();
75 SetNoiseAfterElectronics();
84 SetDataType(dataType);
88 // set the default zero suppression parameters
91 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
92 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
98 //______________________________________________________________________
99 AliITSresponseSDD::~AliITSresponseSDD() {
101 if(fGaus) delete fGaus;
103 //______________________________________________________________________
104 void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){
105 // set compression param
108 for (i=0; i<8; i++) {
110 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
113 //______________________________________________________________________
114 void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]){
115 // give compression param
118 for (i=0; i<8; i++) {
122 //______________________________________________________________________
123 void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
124 // Set fGain to zero to simulate a random distribution of
125 // dead modules, dead chips and single dead channels
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++ )
134 fDeadChannels = nchan;
137 if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
139 if( nmod < 0 || nmod > fModules )
141 cout << "Wrong number of dead modules: " << nmod << endl;
144 Int_t nmax = (fModules-nmod)*fChips;
145 if( nchip < 0 || nchip > nmax )
147 cout << "Wrong number of dead chips: " << nchip << endl;
150 nmax = ((fModules - nmod)*fChips - nchip)*fChannels;
151 if( nchan < 0 || nchan > nmax )
153 cout << "Wrong number of dead channels: " << nchan << endl;
157 TRandom *gran = new TRandom();
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++ )
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.;
171 // cout << "chips" << endl;
172 Int_t * chip = new Int_t[nchip];
173 Int_t * chip_mod = new Int_t[nchip];
177 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
178 if( module <=0 || module > fModules )
179 cout << "Wrong module: " << module << endl;
181 for( Int_t k=0; k<nmod; k++ )
182 if( module == mod[k] ) { flag_mod = 1; break; }
183 if( flag_mod == 1 ) continue;
185 Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.);
186 if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl;
189 chip_mod[i-1] = module;
190 for( Int_t m=0; m<fChannels; m++ )
191 fGain[module-1][chi-1][m] = 0.;
192 cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
193 << chip_mod[i-1] << endl;
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];
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;
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.);
212 if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<<endl;
214 for( k=0; k<nchip; k++)
215 if( chipp == chip[k] && module == chip_mod[k] ) {
216 flag_chip = 1; break; }
217 if( flag_chip == 1 ) continue;
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.;
225 cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. "
226 << channel_chip[i-1] << " in module nr: " << channel_mod[i-1]
234 delete [] channel_mod;
235 delete [] channel_chip;
237 //______________________________________________________________________
238 void AliITSresponseSDD::PrintGains(){
241 if( GetDeadModules() == 0 &&
242 GetDeadChips() == 0 &&
243 GetDeadChannels() == 0 )
246 // Print Electronics Gains
247 cout << "**************************************************" << endl;
248 cout << " Print Electronics Gains " << endl;
249 cout << "**************************************************" << endl;
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++)
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;
261 //______________________________________________________________________
262 void AliITSresponseSDD::Print(){
263 // Print SDD response Parameters
265 cout << "**************************************************" << endl;
266 cout << " Silicon Drift Detector Response Parameters " << endl;
267 cout << "**************************************************" << endl;
268 cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl;
270 cout << "Hardware compression parameters: " << endl;
271 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
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;
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;
282 cout << "N. of Sigma for signal integration: " << fNsigmas << endl;
283 cout << "N. of bins in lookup table: " << fNcomps << endl;
285 cout << "Max. ADC Value: " << fMaxAdc << endl;
286 cout << "Min. Value: " << fMinVal << endl;