]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUSimuParam.cxx
4893d67f1cbc36a4d162b79b362ffe3ee681a108
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSimuParam.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
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  **************************************************************************/
15
16 /* $Id: AliITSUSimuParam.cxx 48165 2011-03-07 17:48:57Z masera $ */
17
18 ///////////////////////////////////////////////////////////////////
19 //                                                               //
20 // Implementation of the class to store the parameters used in   //
21 // the simulation of SPD, SDD and SSD detectors                  //
22 // Origin: F.Prino, Torino, prino@to.infn.it                     //
23 //                                                               //
24 ///////////////////////////////////////////////////////////////////
25 #include "AliITSUSimuParam.h"
26 #include "AliLog.h"
27
28
29 const Double_t  AliITSUSimuParam::fgkPixUpgBiasVoltageDefault = 18.182;
30 const Double_t  AliITSUSimuParam::fgkPixUpgThreshDefault = 3000.;
31 const Double_t  AliITSUSimuParam::fgkPixUpgThrSigmaDefault = 250.;
32 const UInt_t    AliITSUSimuParam::fgkPixUpgCouplingOptDefault = AliITSUSimuParam::kOldCouplingPixUpg;
33 const Double_t  AliITSUSimuParam::fgkPixUpgCouplColDefault = 0.;
34 const Double_t  AliITSUSimuParam::fgkPixUpgCouplRowDefault = 0.055;
35 const Double_t  AliITSUSimuParam::fgkPixUpgEccDiffDefault = 0.85;
36 const Double_t  AliITSUSimuParam::fgkPixUpgLorentzHoleWeightDefault = 1.0;
37 const Double_t  AliITSUSimuParam::fgkGeVtoChargeDefault = 3.6e-9;
38 const Double_t  AliITSUSimuParam::fgkDOverVDefault = 0.000375;
39 const Double_t  AliITSUSimuParam::fgkTDefault = 300;
40
41 const Double_t  AliITSUSimuParam::fgkNsigmasDefault = 3.;
42 const Int_t    AliITSUSimuParam::fgkNcompsDefault = 121;
43
44 ClassImp(AliITSUSimuParam)
45
46 //______________________________________________________________________
47 AliITSUSimuParam::AliITSUSimuParam()
48 :  fGeVcharge(fgkGeVtoChargeDefault)
49   ,fDOverV(fgkDOverVDefault)
50   ,fT(fgkTDefault)
51   //
52   ,fNPixUpg(0)
53   ,fPixUpgCouplOpt(kOldCouplingPixUpg)
54   ,fPixUpgCouplCol(fgkPixUpgCouplColDefault)
55   ,fPixUpgCouplRow(fgkPixUpgCouplRowDefault)
56   ,fPixUpgEccDiff(fgkPixUpgEccDiffDefault)
57   ,fPixUpgLorentzDrift(kTRUE)
58   ,fPixUpgLorentzHoleWeight(fgkPixUpgLorentzHoleWeightDefault)
59   ,fPixUpgAddNoisyFlag(kFALSE)
60   ,fPixUpgRemoveDeadFlag(kFALSE)
61   //
62   ,fPixUpgThreshDef(fgkPixUpgThreshDefault)
63   ,fPixUpgThrSigmaDef(fgkPixUpgThrSigmaDefault)
64   ,fPixUpgBiasVoltageDef(fgkPixUpgBiasVoltageDefault)
65   ,fPixUpgNoiseDef(0)
66   ,fPixUpgBaselineDef(0)
67   //
68   ,fPixUpgThresh(0)
69   ,fPixUpgThrSigma(0)
70   ,fPixUpgBiasVoltage(0)
71   ,fPixUpgSigma(0)
72   ,fPixUpgNoise(0)
73   ,fPixUpgBaseline(0)
74 {  
75   // default constructor
76 }
77
78 //______________________________________________________________________
79 AliITSUSimuParam::AliITSUSimuParam(UInt_t nPixUpg)
80   :fGeVcharge(fgkGeVtoChargeDefault)
81   ,fDOverV(fgkDOverVDefault)
82   ,fT(fgkTDefault)
83     //
84   ,fNPixUpg(nPixUpg)
85   ,fPixUpgCouplOpt(kOldCouplingPixUpg)
86   ,fPixUpgCouplCol(fgkPixUpgCouplColDefault)
87   ,fPixUpgCouplRow(fgkPixUpgCouplRowDefault)
88   ,fPixUpgEccDiff(fgkPixUpgEccDiffDefault)
89   ,fPixUpgLorentzDrift(kTRUE)
90   ,fPixUpgLorentzHoleWeight(fgkPixUpgLorentzHoleWeightDefault)
91   ,fPixUpgAddNoisyFlag(kFALSE)
92   ,fPixUpgRemoveDeadFlag(kFALSE)
93   //
94   ,fPixUpgThreshDef(fgkPixUpgThreshDefault)
95   ,fPixUpgThrSigmaDef(fgkPixUpgThrSigmaDefault)
96   ,fPixUpgBiasVoltageDef(fgkPixUpgBiasVoltageDefault)
97   ,fPixUpgNoiseDef(0)
98   ,fPixUpgBaselineDef(0)
99   //
100   ,fPixUpgThresh(0)
101   ,fPixUpgThrSigma(0)
102   ,fPixUpgBiasVoltage(0)
103   ,fPixUpgSigma(0)
104   ,fPixUpgNoise(0)
105   ,fPixUpgBaseline(0)
106 {  
107   // regular constructor
108   if (fNPixUpg>0) {
109     fPixUpgBiasVoltage = new Double_t[fNPixUpg];
110     fPixUpgThresh      = new Double_t[fNPixUpg];
111     fPixUpgThrSigma    = new Double_t[fNPixUpg];
112     fPixUpgNoise       = new Double_t[fNPixUpg];
113     fPixUpgBaseline    = new Double_t[fNPixUpg];
114   }
115   SetPixUpgThreshold(fgkPixUpgThreshDefault,fgkPixUpgThrSigmaDefault);
116   SetPixUpgNoise(0.,0.);
117   SetPixUpgBiasVoltage(fgkPixUpgBiasVoltageDefault);
118   //
119 }
120
121 //______________________________________________________________________
122 AliITSUSimuParam::AliITSUSimuParam(const AliITSUSimuParam &simpar)
123   :TObject(simpar)
124   ,fGeVcharge(simpar.fGeVcharge)
125   ,fDOverV(simpar.fDOverV)
126   ,fT(simpar.fT)
127    //
128   ,fNPixUpg(simpar.fNPixUpg)
129   ,fPixUpgCouplOpt(simpar.fPixUpgCouplOpt)
130   ,fPixUpgCouplCol(simpar.fPixUpgCouplCol)
131   ,fPixUpgCouplRow(simpar.fPixUpgCouplRow)
132   ,fPixUpgEccDiff(simpar.fPixUpgEccDiff)
133   ,fPixUpgLorentzDrift(simpar.fPixUpgLorentzDrift)
134   ,fPixUpgLorentzHoleWeight(simpar.fPixUpgLorentzHoleWeight)
135   ,fPixUpgAddNoisyFlag(simpar.fPixUpgAddNoisyFlag)
136   ,fPixUpgRemoveDeadFlag(simpar.fPixUpgRemoveDeadFlag)
137    //
138   ,fPixUpgThreshDef(simpar.fPixUpgThreshDef)
139   ,fPixUpgThrSigmaDef(simpar.fPixUpgThrSigmaDef)
140   ,fPixUpgBiasVoltageDef(simpar.fPixUpgBiasVoltageDef)
141   ,fPixUpgNoiseDef(simpar.fPixUpgNoiseDef)
142   ,fPixUpgBaselineDef(simpar.fPixUpgBaselineDef)
143   //
144   ,fPixUpgThresh(0)
145   ,fPixUpgThrSigma(0)
146   ,fPixUpgBiasVoltage(0)
147   ,fPixUpgSigma(0)
148   ,fPixUpgNoise(0)
149   ,fPixUpgBaseline(0)   
150    //
151 {
152   // copy constructor
153   if (fNPixUpg) {
154     fPixUpgBiasVoltage = new Double_t[fNPixUpg];
155     fPixUpgThresh      = new Double_t[fNPixUpg];
156     fPixUpgThrSigma    = new Double_t[fNPixUpg];
157     fPixUpgNoise       = new Double_t[fNPixUpg];
158     fPixUpgBaseline    = new Double_t[fNPixUpg];
159   }
160   for (Int_t i=fNPixUpg;i--;) {
161     fPixUpgBiasVoltage[i] = simpar.fPixUpgBiasVoltage[i];
162     fPixUpgThresh[i]      = simpar.fPixUpgThresh[i];
163     fPixUpgThrSigma[i]    = simpar.fPixUpgThrSigma[i];
164     fPixUpgNoise[i]       = simpar.fPixUpgNoise[i];
165     fPixUpgBaseline[i]    = simpar.fPixUpgBaseline[i];
166   }
167   //
168 }
169
170 //______________________________________________________________________
171 AliITSUSimuParam& AliITSUSimuParam::operator=(const AliITSUSimuParam& source)
172 {
173   // Assignment operator. 
174   if (this==&source) return *this;
175   this->~AliITSUSimuParam();
176   new(this) AliITSUSimuParam(source);
177   return *this;
178   //
179 }
180
181 //______________________________________________________________________
182 AliITSUSimuParam::~AliITSUSimuParam() 
183 {
184   // destructor
185   delete[] fPixUpgBiasVoltage;
186   delete[] fPixUpgThresh;
187   delete[] fPixUpgThrSigma;
188   delete[] fPixUpgNoise;
189   delete[] fPixUpgBaseline;
190 }
191
192 //________________________________________________________________________
193 void AliITSUSimuParam::Print(Option_t *) const
194 {
195   // Dump all parameters
196   Dump();
197 }
198
199 //_______________________________________________________________________
200 Double_t AliITSUSimuParam::ApplyPixUpgBaselineAndNoise(UInt_t mod) const 
201 {
202   // generate random noise 
203   double base,noise;
204   if (mod>=fNPixUpg) {
205     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
206     base = fPixUpgBaselineDef;
207     noise = fPixUpgNoiseDef;
208   }
209   else {
210     base  = fPixUpgBaseline[mod];
211     noise = fPixUpgNoise[mod];    
212   }
213   return base+noise*gRandom->Gaus();
214 }
215
216 //_______________________________________________________________________
217 Double_t AliITSUSimuParam::CalcProbNoiseOverThreshold(UInt_t mod) const 
218 {
219   // calculate probability of noise exceeding the threshold
220   double base,noise,thresh;
221   if (mod>=fNPixUpg) {
222     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
223     base   = fPixUpgBaselineDef;
224     noise  = fPixUpgNoiseDef;
225     thresh = fPixUpgThreshDef;
226   }
227   else {
228     base   = fPixUpgBaseline[mod];
229     noise  = fPixUpgNoise[mod];
230     thresh = fPixUpgThresh[mod];
231   }
232   if (noise<1e-12) {
233     if (base>thresh) return 1;
234     else             return 0;
235   }
236   return CalcProbNoiseOverThreshold(base, noise, thresh);
237 }
238
239 //_______________________________________________________________________
240 void AliITSUSimuParam::SetPixUpgThreshold(Double_t thresh, Double_t sigma, int mod)
241 {
242   // set threshold params
243   if (mod<0) {
244     fPixUpgThreshDef = thresh;
245     fPixUpgThrSigmaDef  = sigma;
246     for (int i=fNPixUpg;i--;) {
247       fPixUpgThresh[i] = thresh;
248       fPixUpgThrSigma[i]  = sigma;
249     }
250   }
251   else if (mod>=(int)fNPixUpg) {
252     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
253     fPixUpgThreshDef = thresh;
254     fPixUpgThrSigmaDef  = sigma;
255   }
256   else {
257     fPixUpgThresh[mod] = thresh;
258     fPixUpgThrSigma[mod]  = sigma;
259   }
260   //
261 }
262
263 //_______________________________________________________________________
264 Double_t AliITSUSimuParam::GetPixUpgThreshold(UInt_t mod) const
265 {
266   // obtain threshold
267   if (mod>=fNPixUpg) {
268     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
269     return fPixUpgThreshDef;
270   }
271   else return fPixUpgThresh[mod];
272 }
273
274 //_______________________________________________________________________
275 void AliITSUSimuParam::GetPixUpgThreshold(UInt_t mod, Double_t &thresh, Double_t &sigma) const
276 {
277   // obtain thresholds
278   if (mod>=fNPixUpg) {
279     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
280     thresh = fPixUpgThreshDef;
281     sigma  = fPixUpgThrSigmaDef;
282   }
283   else {
284     thresh = fPixUpgThresh[mod];
285     sigma  = fPixUpgThrSigma[mod];
286   }
287 }
288
289 //_______________________________________________________________________
290 void AliITSUSimuParam::SetPixUpgBiasVoltage(Double_t val, int mod)
291 {
292   // set threshold params
293   if (mod<0) {
294     fPixUpgBiasVoltageDef = val;
295     for (int i=fNPixUpg;i--;) fPixUpgBiasVoltage[i] = val;
296   }
297   else if (mod>=(int)fNPixUpg) {
298     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
299     fPixUpgBiasVoltageDef = val;
300   }
301   else fPixUpgBiasVoltage[mod] = val;
302   //
303 }
304
305 //_______________________________________________________________________
306 Double_t AliITSUSimuParam::GetPixUpgBiasVoltage(UInt_t mod) const
307 {
308   // obtain threshold
309   if (mod>=fNPixUpg) {
310     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
311     return fPixUpgBiasVoltageDef;
312   }
313   else return fPixUpgBiasVoltage[mod];
314 }
315
316 //_______________________________________________________________________
317 void AliITSUSimuParam::SetPixUpgNoise(Double_t noise, Double_t baseline, int mod)
318 {
319   // set noise params
320   if (mod<0) {
321     fPixUpgNoiseDef = noise;
322     fPixUpgBaselineDef  = baseline;
323     for (int i=fNPixUpg;i--;) {
324       fPixUpgNoise[i] = noise;
325       fPixUpgBaseline[i]  = baseline;
326     }
327   }
328   else if (mod>=(int)fNPixUpg) {
329     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
330     fPixUpgNoiseDef = noise;
331     fPixUpgBaselineDef  = baseline;
332   }
333   else {
334     fPixUpgNoise[mod] = noise;
335     fPixUpgBaseline[mod]  = baseline;
336   }
337   //
338 }
339
340 //_______________________________________________________________________
341 void AliITSUSimuParam::GetPixUpgNoise(UInt_t mod, Double_t &noise, Double_t &baseline) const
342 {
343   // obtain noise
344   if (mod>=fNPixUpg) {
345     if (fNPixUpg>0) {AliFatal(Form("Wrong module %d, NPidUpg=%d",mod,fNPixUpg));}
346     noise     = fPixUpgNoiseDef;
347     baseline  = fPixUpgBaselineDef;
348   }
349   else {
350     noise     = fPixUpgNoise[mod];
351     baseline  = fPixUpgBaseline[mod];
352   }
353 }
354
355 //_______________________________________________________________________
356 void AliITSUSimuParam::SetPixUpgCouplingOption(UInt_t opt)
357 {
358   // set coupling option
359   if (opt>=kMaxCouplingOptPixUpg) AliFatal(Form("Coupling option %d should be less than %d",opt,kMaxCouplingOptPixUpg));
360   fPixUpgCouplOpt = opt;
361 }
362
363
364 //______________________________________________________________________
365 Double_t AliITSUSimuParam::LorentzAngleHole(Double_t B) const 
366 {
367   // Computes the Lorentz angle for electrons in Si
368   // Input: magnetic Field in KGauss
369   // Output: Lorentz angle in radians (positive if Bz is positive)
370   // Main Reference: NIM A 497 (2003) 389–396.
371   // "An algorithm for calculating the Lorentz angle in silicon detectors", V. Bartsch et al.
372   //
373   const Double_t krH=0.70; // Hall scattering factor for Hole
374   const Double_t kT0  = 300.;       // reference Temperature (degree K).
375   const Double_t kmulow0 = 470.5;   // cm^2/Volt-sec
376   const Double_t keT0 = -2.5;       // Power of Temp.
377   const Double_t beta0 = 1.213;     // beta coeff. at T0=300K
378   const Double_t keT1 = 0.17;       // Power of Temp. for beta
379   const Double_t kvsat0 = 8.37E+06; // saturated velocity at T0=300K (cm/sec)
380   const Double_t keT2 = 0.52;       // Power of Temp. for vsat
381   Double_t tT = fT;
382   Double_t eE= 1./fDOverV;
383   Double_t muLow=kmulow0*TMath::Power(tT/kT0,keT0);
384   Double_t beta=beta0*TMath::Power(tT/kT0,keT1);
385   Double_t vsat=kvsat0*TMath::Power(tT/kT0,keT2);
386   Double_t mu=muLow/TMath::Power(1+TMath::Power(muLow*eE/vsat,beta),1/beta);
387   Double_t angle=TMath::ATan(krH*mu*B*1.E-05); // Conversion Factor
388   return angle;
389 }
390
391 //______________________________________________________________________
392 Double_t AliITSUSimuParam::LorentzAngleElectron(Double_t B) const 
393 {
394   // Computes the Lorentz angle for electrons in Si
395   // Input: magnetic Field in KGauss
396   // Output: Lorentz angle in radians (positive if Bz is positive)
397   // Main Reference: NIM A 497 (2003) 389–396.
398   // "An algorithm for calculating the Lorentz angle in silicon detectors", V. Bartsch et al.
399   //
400   const Double_t krH=1.15; // Hall scattering factor for Electron
401   const Double_t kT0  = 300.;       // reference Temperature (degree K).
402   const Double_t kmulow0 = 1417.0;  // cm^2/Volt-sec
403   const Double_t keT0 = -2.2;       // Power of Temp.
404   const Double_t beta0 = 1.109;     // beta coeff. at T0=300K
405   const Double_t keT1 = 0.66;       // Power of Temp. for beta
406   const Double_t kvsat0 = 1.07E+07; // saturated velocity at T0=300K (cm/sec)
407   const Double_t keT2 = 0.87;       // Power of Temp. for vsat
408   Double_t tT = fT;
409   Double_t eE= 1./fDOverV;
410   Double_t muLow=kmulow0*TMath::Power(tT/kT0,keT0);
411   Double_t beta=beta0*TMath::Power(tT/kT0,keT1);
412   Double_t vsat=kvsat0*TMath::Power(tT/kT0,keT2);
413   Double_t mu=muLow/TMath::Power(1+TMath::Power(muLow*eE/vsat,beta),1/beta);
414   Double_t angle=TMath::ATan(krH*mu*B*1.E-05);
415   return angle;
416 }
417
418 //______________________________________________________________________
419 Double_t AliITSUSimuParam::SigmaDiffusion3D(Double_t l) const 
420 {
421   // Returns the Gaussian sigma^2 == <x^2+y^2+z^2> [cm^2] due to the
422   // defusion of electrons or holes through a distance l [cm] caused
423   // by an applied voltage v [volt] through a distance d [cm] in any
424   //  material at a temperature T [degree K]. The sigma diffusion when
425   //  expressed in terms of the distance over which the diffusion
426   // occures, l=time/speed, is independent of the mobility and therefore
427   //  the properties of the material. The charge distributions is given by
428   // n = exp(-r^2/4Dt)/(4piDt)^1.5. From this <r^2> = 6Dt where D=mkT/e
429   // (m==mobility, k==Boltzman's constant, T==temparature, e==electric
430   // charge. and vel=m*v/d. consiquently sigma^2=6kTdl/ev.
431   // Inputs:
432   //    Double_t l   Distance the charge has to travel.
433   // Output:
434   //    none.
435   // Return:
436   //    The Sigma due to the diffution of electrons. [cm]
437   const Double_t kcon = 5.17040258E-04; // == 6k/e [J/col or volts]  
438   return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
439 }
440
441 //______________________________________________________________________
442 Double_t AliITSUSimuParam::SigmaDiffusion2D(Double_t l) const 
443 {
444   // Returns the Gaussian sigma^2 == <x^2+z^2> [cm^2] due to the defusion
445   // of electrons or holes through a distance l [cm] caused by an applied
446   // voltage v [volt] through a distance d [cm] in any material at a
447   // temperature T [degree K]. The sigma diffusion when expressed in terms
448   // of the distance over which the diffusion occures, l=time/speed, is
449   // independent of the mobility and therefore the properties of the
450   // material. The charge distributions is given by
451   // n = exp(-r^2/4Dt)/(4piDt)^1.5. From this <x^2+z^2> = 4Dt where D=mkT/e
452   // (m==mobility, k==Boltzman's constant, T==temparature, e==electric
453   // charge. and vel=m*v/d. consiquently sigma^2=4kTdl/ev.
454   // Inputs:
455   //    Double_t l   Distance the charge has to travel.
456   // Output:
457   //    none.
458   // Return:
459   //    The Sigma due to the diffution of electrons. [cm]
460   const Double_t kcon = 3.446935053E-04; // == 4k/e [J/col or volts]
461   return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
462 }
463
464 //______________________________________________________________________
465 Double_t AliITSUSimuParam::SigmaDiffusion1D(Double_t l) const 
466 {
467   // Returns the Gaussian sigma^2 == <x^2> [cm^2] due to the defusion
468   // of electrons or holes through a distance l [cm] caused by an applied
469   // voltage v [volt] through a distance d [cm] in any material at a
470   // temperature T [degree K]. The sigma diffusion when expressed in terms
471   // of the distance over which the diffusion occures, l=time/speed, is
472   // independent of the mobility and therefore the properties of the
473   // material. The charge distributions is given by
474   // n = exp(-r^2/4Dt)/(4piDt)^1.5. From this <r^2> = 2Dt where D=mkT/e
475   // (m==mobility, k==Boltzman's constant, T==temparature, e==electric
476   // charge. and vel=m*v/d. consiquently sigma^2=2kTdl/ev.
477   // Inputs:
478   //    Double_t l   Distance the charge has to travel.
479   // Output:
480   //    none.
481   // Return:
482   //    The Sigma due to the diffution of electrons. [cm]
483   const Double_t kcon = 1.723467527E-04; // == 2k/e [J/col or volts]
484   return TMath::Sqrt(kcon*fT*fDOverV*l);  // [cm]
485 }