]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSresponseSDD.cxx
Removing warnings (icc), adding more detailed description
[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 **************************************************************************/
b9d0a01d 15
88cb7938 16/* $Id$ */
b0f5e3fc 17
703a4e51 18#include <Riostream.h>
2aea926d 19#include <TRandom.h>
1ca7869b 20
b0f5e3fc 21#include "AliITSresponseSDD.h"
b0f5e3fc 22
703a4e51 23//////////////////////////////////////////////////
24// Response class for set:ITS //
25// Specific subdetector implementation //
26// for silicon drift detectors //
27// //
28// //
29//////////////////////////////////////////////////////
50d05d7b 30
703a4e51 31const Int_t AliITSresponseSDD::fgkModules;
32const Int_t AliITSresponseSDD::fgkChips;
33const Int_t AliITSresponseSDD::fgkChannels;
34const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024;
35const Float_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.;
36const Float_t AliITSresponseSDD::fgkfChargeLossDefault = 0;
37const Float_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23;
38const Float_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.;
39const Float_t AliITSresponseSDD::fgkTemperatureDefault = 296.;
40const TString AliITSresponseSDD::fgkParam1Default = "same";
41const TString AliITSresponseSDD::fgkParam2Default = "same";
42const Float_t AliITSresponseSDD::fgkNoiseDefault = 10.;
43const Float_t AliITSresponseSDD::fgkBaselineDefault = 20.;
44const TString AliITSresponseSDD::fgkOptionDefault = "1D";
45const Float_t AliITSresponseSDD::fgkMinValDefault = 4;
46const Float_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3;
47const Float_t AliITSresponseSDD::fgkNsigmasDefault = 3.;
48const Int_t AliITSresponseSDD::fgkNcompsDefault = 121;
48058160 49//______________________________________________________________________
50ClassImp(AliITSresponseSDD)
50d05d7b 51
48058160 52AliITSresponseSDD::AliITSresponseSDD(){
50d05d7b 53 // default constructor
54 fGaus = 0;
55 SetDeadChannels();
703a4e51 56 SetMaxAdc(fgkMaxAdcDefault);
57 SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
58 SetDriftSpeed(fgkDriftSpeedDefault);
59 SetNSigmaIntegration(fgkNsigmasDefault);
60 SetNLookUp(fgkNcompsDefault);
50d05d7b 61 // SetClock();
703a4e51 62 SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault);
50d05d7b 63 SetNoiseAfterElectronics();
48058160 64 SetJitterError();
50d05d7b 65 SetElectronics();
703a4e51 66 SetDynamicRange(fgkDynamicRangeDefault);
67 SetChargeLoss(fgkfChargeLossDefault);
68 SetThresholds(fgkMinValDefault,0.);
69 SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
70 SetTemperature(fgkTemperatureDefault);
71 SetZeroSupp(fgkOptionDefault);
50d05d7b 72 SetDataType();
73 SetFilenames();
74 SetOutputOption();
75 SetDo10to8();
76 // set the default zero suppression parameters
77 fCPar[0]=0;
78 fCPar[1]=0;
48058160 79 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
80 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
50d05d7b 81 fCPar[4]=0;
82 fCPar[5]=0;
83 fCPar[6]=0;
84 fCPar[7]=0;
9de0700b 85}
48058160 86//______________________________________________________________________
87AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
b0f5e3fc 88 // constructor
50d05d7b 89 fGaus = 0;
2aea926d 90 SetDeadChannels();
703a4e51 91 SetMaxAdc(fgkMaxAdcDefault);
92 SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default);
93 SetDriftSpeed(fgkDriftSpeedDefault);
94 SetNSigmaIntegration(fgkNsigmasDefault);
95 SetNLookUp(fgkNcompsDefault);
b0f5e3fc 96 // SetClock();
703a4e51 97 SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault);
7551c5b2 98 SetNoiseAfterElectronics();
48058160 99 SetJitterError();
7551c5b2 100 SetElectronics();
703a4e51 101 SetDynamicRange(fgkDynamicRangeDefault);
102 SetChargeLoss(fgkfChargeLossDefault);
103 SetThresholds(fgkMinValDefault,0.);
104 SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data());
105 SetTemperature(fgkTemperatureDefault);
106 SetZeroSupp(fgkOptionDefault);
9de0700b 107 SetDataType(dataType);
b0f5e3fc 108 SetFilenames();
109 SetOutputOption();
fa1750f9 110 SetDo10to8();
f49604ec 111 // set the default zero suppression parameters
112 fCPar[0]=0;
113 fCPar[1]=0;
48058160 114 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
115 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
f49604ec 116 fCPar[4]=0;
117 fCPar[5]=0;
118 fCPar[6]=0;
119 fCPar[7]=0;
b0f5e3fc 120}
703a4e51 121//______________________________________________________________________
122AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &ob) : AliITSresponse(ob) {
123 // Copy constructor
124 // Copies are not allowed. The method is protected to avoid misuse.
125 Error("AliITSresponseSDD","Copy constructor not allowed\n");
126}
127
128//______________________________________________________________________
129AliITSresponseSDD& AliITSresponseSDD::operator=(const AliITSresponseSDD& /* ob */){
130 // Assignment operator
131 // Assignment is not allowed. The method is protected to avoid misuse.
132 Error("= operator","Assignment operator not allowed\n");
133 return *this;
134}
135
48058160 136//______________________________________________________________________
03898a57 137AliITSresponseSDD::~AliITSresponseSDD() {
b0f5e3fc 138
03898a57 139 if(fGaus) delete fGaus;
b0f5e3fc 140}
48058160 141//______________________________________________________________________
142void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){
b0f5e3fc 143 // set compression param
e8189707 144
b0f5e3fc 145 Int_t i;
e8189707 146 for (i=0; i<8; i++) {
50d05d7b 147 fCPar[i]=cp[i];
48058160 148 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
149 } // end for i
b0f5e3fc 150}
48058160 151//______________________________________________________________________
703a4e51 152void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]) const {
b0f5e3fc 153 // give compression param
e8189707 154
b0f5e3fc 155 Int_t i;
e8189707 156 for (i=0; i<8; i++) {
50d05d7b 157 cp[i]=fCPar[i];
48058160 158 } // end for i
b0f5e3fc 159}
48058160 160//______________________________________________________________________
703a4e51 161void AliITSresponseSDD::SetNLookUp(Int_t p1){
162 // Set number of sigmas over which cluster disintegration is performed
163 fNcomps=p1;
164 fGaus = new TArrayF(fNcomps+1);
165 for(Int_t i=0; i<=fNcomps; i++) {
166 Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
167 (*fGaus)[i] = exp(-((x*x)/2));
168 // cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
169 }
170}
171//______________________________________________________________________
48058160 172void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
50d05d7b 173 // Set fGain to zero to simulate a random distribution of
174 // dead modules, dead chips and single dead channels
2aea926d 175
703a4e51 176 for( Int_t m=0; m<fgkModules; m++ )
177 for( Int_t n=0; n<fgkChips; n++ )
178 for( Int_t p=0; p<fgkChannels; p++ )
50d05d7b 179 fGain[m][n][p] = 1.;
180
181 fDeadModules = nmod;
182 fDeadChips = nchip;
183 fDeadChannels = nchan;
184
185 // nothing to do
186 if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
2aea926d 187
703a4e51 188 if( nmod < 0 || nmod > fgkModules )
50d05d7b 189 {
190 cout << "Wrong number of dead modules: " << nmod << endl;
191 return;
192 }
703a4e51 193 Int_t nmax = (fgkModules-nmod)*fgkChips;
50d05d7b 194 if( nchip < 0 || nchip > nmax )
195 {
196 cout << "Wrong number of dead chips: " << nchip << endl;
197 return;
198 }
703a4e51 199 nmax = ((fgkModules - nmod)*fgkChips - nchip)*fgkChannels;
50d05d7b 200 if( nchan < 0 || nchan > nmax )
201 {
202 cout << "Wrong number of dead channels: " << nchan << endl;
203 return;
204 }
2aea926d 205
50d05d7b 206 TRandom *gran = new TRandom();
2aea926d 207
50d05d7b 208 // cout << "modules" << endl;
209 Int_t * mod = new Int_t [nmod];
210 Int_t i; //loop variable
211 for( i=0; i<nmod; i++ )
212 {
703a4e51 213 mod[i] = (Int_t) (1.+fgkModules*gran->Uniform());
50d05d7b 214 cout << i+1 << ": Dead module nr: " << mod[i] << endl;
703a4e51 215 for(Int_t n=0; n<fgkChips; n++)
216 for(Int_t p=0; p<fgkChannels; p++)
50d05d7b 217 fGain[mod[i]-1][n][p] = 0.;
218 }
219
220 // cout << "chips" << endl;
221 Int_t * chip = new Int_t[nchip];
703a4e51 222 Int_t * chipMod = new Int_t[nchip];
50d05d7b 223 i = 0;
224 while( i < nchip )
225 {
703a4e51 226 Int_t module = (Int_t) (fgkModules*gran->Uniform() + 1.);
227 if( module <=0 || module > fgkModules )
50d05d7b 228 cout << "Wrong module: " << module << endl;
703a4e51 229 Int_t flagMod = 0;
50d05d7b 230 for( Int_t k=0; k<nmod; k++ )
703a4e51 231 if( module == mod[k] ) { flagMod = 1; break; }
232 if( flagMod == 1 ) continue;
50d05d7b 233
703a4e51 234 Int_t chi = (Int_t) (fgkChips*gran->Uniform() + 1.);
235 if( chi <=0 || chi > fgkChips ) cout << "Wrong chip: " << chi << endl;
50d05d7b 236 i++;
237 chip[i-1] = chi;
703a4e51 238 chipMod[i-1] = module;
239 for( Int_t m=0; m<fgkChannels; m++ )
50d05d7b 240 fGain[module-1][chi-1][m] = 0.;
48058160 241 cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
703a4e51 242 << chipMod[i-1] << endl;
50d05d7b 243 }
244
245 // cout << "channels" << endl;
246 Int_t * channel = new Int_t[nchan];
703a4e51 247 Int_t * channelChip = new Int_t[nchan];
248 Int_t * channelMod = new Int_t[nchan];
50d05d7b 249 i = 0;
250 while( i < nchan )
251 {
252 Int_t k; //loop variable
703a4e51 253 Int_t module = (Int_t) (fgkModules*gran->Uniform() + 1.);
254 if( module <=0 || module > fgkModules )
50d05d7b 255 cout << "Wrong module: " << module << endl;
703a4e51 256 Int_t flagMod = 0;
50d05d7b 257 for( k=0; k<nmod; k++ )
703a4e51 258 if( module == mod[k] ) { flagMod = 1; break; }
259 if( flagMod == 1 ) continue;
260 Int_t chipp = (Int_t) (fgkChips*gran->Uniform() + 1.);
261 if( chipp <=0 || chipp > fgkChips ) cout << "Wrong chip: "<< chipp<<endl;
262 Int_t flagChip = 0;
50d05d7b 263 for( k=0; k<nchip; k++)
703a4e51 264 if( chipp == chip[k] && module == chipMod[k] ) {
265 flagChip = 1; break; }
266 if( flagChip == 1 ) continue;
50d05d7b 267 i++;
703a4e51 268 channel[i-1] = (Int_t) (fgkChannels*gran->Uniform() + 1.);
269 if( channel[i-1] <=0 || channel[i-1] > fgkChannels )
50d05d7b 270 cout << "Wrong channel: " << channel[i-1] << endl;
703a4e51 271 channelChip[i-1] = chipp;
272 channelMod[i-1] = module;
50d05d7b 273 fGain[module-1][chipp-1][channel[i-1]-1] = 0.;
48058160 274 cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. "
703a4e51 275 << channelChip[i-1] << " in module nr: " << channelMod[i-1]
48058160 276 << endl;
50d05d7b 277 }
278
279 delete [] mod;
280 delete [] chip;
703a4e51 281 delete [] chipMod;
50d05d7b 282 delete [] channel;
703a4e51 283 delete [] channelMod;
284 delete [] channelChip;
2aea926d 285}
48058160 286//______________________________________________________________________
287void AliITSresponseSDD::PrintGains(){
288 //
2aea926d 289
48058160 290 if( GetDeadModules() == 0 &&
291 GetDeadChips() == 0 &&
292 GetDeadChannels() == 0 )
293 return;
294
295 // Print Electronics Gains
50d05d7b 296 cout << "**************************************************" << endl;
297 cout << " Print Electronics Gains " << endl;
298 cout << "**************************************************" << endl;
299
2aea926d 300 // Print SDD electronic gains
703a4e51 301 for(Int_t t=0; t<fgkModules;t++)
302 for(Int_t u=0; u<fgkChips;u++)
303 for(Int_t v=0; v<fgkChannels;v++)
50d05d7b 304 {
48058160 305 if( fGain[t][u][v] != 1.0 )
306 cout << "Gain for Module: " << t+1 << ", Chip " << u+1 <<
307 ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
50d05d7b 308 }
2aea926d 309}
48058160 310//______________________________________________________________________
311void AliITSresponseSDD::Print(){
7551c5b2 312 // Print SDD response Parameters
313
314 cout << "**************************************************" << endl;
315 cout << " Silicon Drift Detector Response Parameters " << endl;
316 cout << "**************************************************" << endl;
48058160 317 cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl;
7551c5b2 318
319 cout << "Hardware compression parameters: " << endl;
48058160 320 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
7551c5b2 321 cout << "Noise before electronics (arbitrary units): " << fNoise << endl;
322 cout << "Baseline (ADC units): " << fBaseline << endl;
323 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl;
324
325 cout << "Dynamic Range: " << fDynamicRange << endl;
326 cout << "Charge Loss: " << fChargeLoss << endl;
703a4e51 327 cout << "Temperature: " << Temperature() << " K " << endl;
7551c5b2 328 cout << "Drift Speed: " << fDriftSpeed << endl;
329 cout << "Electronics (1=PASCAL, 2=OLA): " << fElectronics << endl;
330
331 cout << "N. of Sigma for signal integration: " << fNsigmas << endl;
332 cout << "N. of bins in lookup table: " << fNcomps << endl;
333
334 cout << "Max. ADC Value: " << fMaxAdc << endl;
335 cout << "Min. Value: " << fMinVal << endl;
336
2aea926d 337 PrintGains();
7551c5b2 338
339}
340
341
342