]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUSimuParam.h
clusterizer,reconstructor + many fixes (Magnus,Stefan)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSimuParam.h
1 #ifndef ALIITSUSIMUPARAM_H
2 #define ALIITSUSIMUPARAM_H
3 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6
7 ///////////////////////////////////////////////////////////////////
8 //                                                               //
9 // Class to store the parameters used in the simulation ITS      //
10 //                                                               //
11 ///////////////////////////////////////////////////////////////////
12 #include <TRandom.h>
13 #include <TObject.h>
14 #include <TMath.h>
15 #include "AliMathBase.h"
16
17 class AliITSUSimuParam : public TObject {
18
19  public:
20   enum {kOldCouplingPix,kNewCouplingPix,kMaxCouplingOptPix};
21   //
22   AliITSUSimuParam();
23   AliITSUSimuParam(UInt_t nPix);
24   AliITSUSimuParam(const AliITSUSimuParam& simpar);
25   // assignment operator 
26   AliITSUSimuParam& operator=(const AliITSUSimuParam& source);
27   ~AliITSUSimuParam();
28
29   Double_t ApplyPixBaselineAndNoise(UInt_t mod) const;
30   Double_t CalcProbNoiseOverThreshold(UInt_t mod) const;
31   //
32   void     SetPixThreshold(Double_t thresh, Double_t sigma, int mod=-1);
33   void     SetPixMinElToAdd(Double_t nel)                                        {fPixMinElToAddDef = nel;}
34   void     GetPixThreshold(UInt_t mod, Double_t& thresh, Double_t& sigma) const;
35   Double_t GetPixThreshold(UInt_t mod)                                    const;
36   Double_t GetPixMinElToAdd()                                             const  {return fPixMinElToAddDef;}
37   //
38   void     SetPixNoise(Double_t noise, Double_t baseline, Int_t mod=-1);
39   void     GetPixNoise(UInt_t mod,Double_t &noise, Double_t &baseline)    const;
40   //
41   void     SetPixBiasVoltage(Double_t bias=18.182,Int_t mod=-1);
42   Double_t GetPixBiasVoltage(UInt_t mod)                                  const;
43
44  
45   void     SetGeVToCharge(Double_t gc=fgkNcompsDefault)                             {fGeVcharge = gc;}
46   Double_t GetGeVToCharge()                                                  const  {return fGeVcharge;}
47   Double_t GeVToCharge(Double_t gev)                                         const  {return gev/fGeVcharge;}
48   //
49   void     SetDistanceOverVoltage(Double_t d,Double_t v)                            {fDOverV = d/v;}
50   void     SetDistanceOverVoltage(Double_t dv=fgkDOverVDefault)                     {fDOverV = dv;}
51   Double_t GetDistanceOverVoltage()                                          const  {return fDOverV;}
52   //
53   void     SetPixCouplingOption(UInt_t opt);
54   UInt_t   GetPixCouplingOption()                                         const  {return fPixCouplOpt;}
55
56   void     SetPixCouplingParam(Double_t col, Double_t row)                       {fPixCouplCol = col; fPixCouplRow = row;}
57   void     GetPixCouplingParam(Double_t &col, Double_t &row)              const  {col = fPixCouplCol; row = fPixCouplRow;}
58
59   void     SetPixSigmaDiffusionAsymmetry(Double_t ecc)                           {fPixEccDiff=ecc;}   
60   void     GetPixSigmaDiffusionAsymmetry(Double_t &ecc)                   const  {ecc=fPixEccDiff;}
61
62   void     SetPixLorentzDrift(Bool_t ison)                                       {fPixLorentzDrift=ison;}
63   Bool_t   GetPixLorentzDrift()                                           const  {return fPixLorentzDrift;}
64   void     SetPixLorentzHoleWeight(Double_t weight)                               {fPixLorentzHoleWeight=weight;}
65   Double_t GetPixLorentzHoleWeight()                                      const  {return fPixLorentzHoleWeight;}
66   
67   void     SetPixAddNoisyFlag(Bool_t value)                                      {fPixAddNoisyFlag = value;}
68   Bool_t   GetPixAddNoisyFlag()                                           const  {return fPixAddNoisyFlag;}
69   void     SetPixRemoveDeadFlag(Bool_t value)                                    {fPixRemoveDeadFlag = value;}
70   Bool_t   GetPixRemoveDeadFlag()                                         const  {return fPixRemoveDeadFlag;}
71   //
72   Double_t LorentzAngleElectron(Double_t bz)                                 const;
73   Double_t LorentzAngleHole(Double_t bz)                                     const;
74   //
75   Double_t SigmaDiffusion3D(Double_t  l)                                     const;
76   Double_t SigmaDiffusion2D(Double_t l)                                      const;
77   Double_t SigmaDiffusion1D(Double_t l)                                      const;
78   //
79   virtual void Print(Option_t *opt = "")                                     const; 
80   //
81   static Double_t CalcProbNoiseOverThreshold(double base, double noise, double thresh);
82   static Double_t GenerateNoiseQFunction(double prob, double mean, double sigma);
83   //
84  protected:
85
86   static const Double_t fgkPixBiasVoltageDefault;//default for fPixBiasVoltage
87   static const Double_t fgkPixThreshDefault; //default for fThresh
88   static const Double_t fgkPixMinElToAddDefault; // default min number of electrons to add to sdigit
89   static const Double_t fgkPixThrSigmaDefault; //default for fSigma
90   static const Double_t fgkPixCouplColDefault; //default for fPixCouplCol
91   static const Double_t fgkPixCouplRowDefault; //default for fPixCouplRow
92   static const Double_t fgkPixEccDiffDefault;//default for fPixEccDiff
93   static const Double_t fgkPixLorentzHoleWeightDefault;//default for fPixLorentzHoleWeight
94   static const UInt_t   fgkPixCouplingOptDefault;  // type of pixel Coupling (old or new)
95   static const Double_t fgkDOverVDefault;             // default distance over voltage 
96   static const Double_t fgkGeVtoChargeDefault;        // default energy to ionize (free an electron) in GeV
97   static const Double_t fgkTDefault;                  // default temperature
98
99   static const Double_t fgkNsigmasDefault; //default for fNsigmas
100   static const Int_t fgkNcompsDefault; //default for fNcomps
101
102  private:
103   //
104   Double_t   fGeVcharge;          // Energy to ionize (free an electron) in GeV
105   Double_t   fDOverV;             // The parameter d/v where d is the disance over which the the potential v is applied d/v [cm/volts]
106   Double_t   fT;                  // The temperature of the Si in Degree K.
107   //
108   UInt_t     fNPix;            // number of Pix type detectors
109   UInt_t     fPixCouplOpt;     // Pix Coupling Option
110   Double_t   fPixCouplCol;     // Pix Coupling parameter along the cols
111   Double_t   fPixCouplRow;     // Pix Coupling parameter along the rows
112   Double_t   fPixEccDiff;      // Eccentricity (i.e. asymmetry parameter) in the  Gaussian diffusion for Pix  
113   Bool_t     fPixLorentzDrift;     // Flag to decide whether to simulate the Lorentz Drift or not in Pix
114   Double_t   fPixLorentzHoleWeight;// Lorentz Angle is computed for Pix as average of Hole and Electron
115   //                                    this parameter gives the relative weights between the two
116   Bool_t     fPixAddNoisyFlag;     // Flag saying whether noisy pixels should be added to digits
117   Bool_t     fPixRemoveDeadFlag;   // Flag saying whether dead pixels should be removed from digits
118   //
119   Double_t   fPixThreshDef;      // Pix Threshold value
120   Double_t   fPixThrSigmaDef;    // Pix Threshold fluctuation
121   Double_t   fPixBiasVoltageDef; // Bias Voltage for the Pix
122   Double_t   fPixNoiseDef;       // Pix electronic noise: sigma
123   Double_t   fPixBaselineDef;    // Pix electronic noise: baseline
124   Double_t   fPixMinElToAddDef;  // min number of electrons to add
125   //
126   Double_t*  fPixThresh;      //[fNPix] Pix Threshold value
127   Double_t*  fPixThrSigma;    //[fNPix] Pix Threshold fluctuation
128   Double_t*  fPixBiasVoltage; //[fNPix] Bias Voltage for the Pix
129   Double_t*  fPixSigma;       //[fNPix] Pix threshold fluctuations spread
130   Double_t*  fPixNoise;       //[fNPix] Pix electronic noise: sigma
131   Double_t*  fPixBaseline;    //[fNPix] Pix electronic noise: baseline
132   //
133
134   ClassDef(AliITSUSimuParam,1);  // ITSU simulataion params
135 };
136
137 //_______________________________________________________________________
138 inline Double_t AliITSUSimuParam::CalcProbNoiseOverThreshold(double mean, double sigma, double thresh) 
139 {
140   // calculate probability of gaussian noise exceeding the threshold
141   if (mean+6*sigma<thresh) return 0;
142   if (mean-6*sigma>thresh) return 1.;
143   const double ksqrt2 = 1.41421356237309515e+00;
144   return 0.5*AliMathBase::ErfcFast( (thresh-mean)/(sigma*ksqrt2));
145 }
146
147 //_______________________________________________________________________
148 inline Double_t AliITSUSimuParam::GenerateNoiseQFunction(double prob, double mean, double sigma) 
149 {
150   // generate random noise exceeding threshold probability prob, i.e. find a random point in the right
151   // tail of the gaussian(base,noise), provided that the tail integral = prob
152   const double ksqrt2 = 1.41421356237309515e+00;
153   return mean+sigma*ksqrt2*TMath::ErfcInverse(2*prob*(1.-gRandom->Rndm()));
154 }
155
156
157
158 #endif