]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSUSimulationPix.h
fix in split clusters determination (problem spotted by Luca)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUSimulationPix.h
1 #ifndef ALIITSUSIMULATIONPIX_H
2 #define ALIITSUSIMULATIONPIX_H
3
4 /* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 ////////////////////////////////////////////////////////////
8 // Simulation class for upgrade pixels                    //
9 ////////////////////////////////////////////////////////////
10 #include <TRandom3.h>
11 #include <TObjArray.h>
12 #include "AliITSUSimulation.h"
13 #include "AliITSUSegmentationPix.h"
14
15 class TH1F;
16 class AliITSUChip;
17 class AliITSUSimuParam;
18 class AliITSUParamList;
19 class TH2;
20
21 //-------------------------------------------------------------------
22
23 class AliITSUSimulationPix : public AliITSUSimulation {
24 public:
25     enum {kCellX1,kCellX2,kCellZ1,kCellZ2,kCellYDepth,kNDtSpread}; // data used for ch. spread integral calc.
26     //
27     // charge spread functions defined
28     enum {kSpreadFunGauss2D                   // single gaussian in 2D, SpreadFunGauss2D
29         ,kSpreadFunDoubleGauss2D            // double gaussian in 2D, SpreadFunDoubleGauss2D
30         ,kSpreadFunHisto                    // use 2D histo from the object stored in fResponseParam
31         ,kNSpreadFuns
32     };
33     // These are enums for interpretation of the entries in the AliITSUParamList*fResponseParam :
34     // object to holding the sensor-specific response data
35     // fist kParamStart entries of spread fun params are reserved for common parameters
36     enum {kChargeSpreadType                  // charge spread function type, one of kNSpreadFuns types
37         ,kSpreadFunParamNXoffs               // number of pixels to consider +- from injection point (in X)
38         ,kSpreadFunParamNZoffs               // number of pixels to consider +- from injection point (in Z)
39         ,kSpreadFunMinSteps                  // the single hit charge is divided into kSpreadFunMinSteps (minimum is 3)
40         ,kReadOutSchemeType                  // readout type strobe, rolling shutter etc
41         ,kReadOutCycleLength                 // full readout cycle window
42         ,kSpreadFunGlobalQScale              // Global charge scaling factor to match tes beam results to simu (Geant3)
43         ,kPixSNDisrcCut                      // S/N cut applied at discrimination level
44         ,kPixMinElToAdd                      // Min number of electrons to add to sdig
45         ,kPixNoiseIsOn                       // Turn Pixel Noise on
46         ,kPixNoiseInAllMod                   // To apply pixel noise in all chips, if not only on ones where there is a hit
47         ,kPixNoiseMPV                        // Pixel noise MPV
48         ,kPixNoiseSigma                      // Pixel noise sigma
49         ,kPixFakeRate                        // Pixel fake rate
50         ,kDigitalSim                         //Digital pixel simulation
51         //
52         ,kNReservedParams=20                 // some reserved slots
53         ,kParamStart = kNReservedParams      // user parameters must start from this slot
54     };
55     //___ Noisy pixel type
56     enum { kNoisyPixOCDB = 9990, kNoisyPixRnd = 9991 };
57     
58     //
59     // defined readout types:
60     enum {kReadOutStrobe                      // hits in static time window fReadOutCycleLength wrt offset fReadOOutCycleOffset (global for sensor) are seen
61         ,kReadOutRollingShutter             // hits in rolling (row-wise) window are seen (see GetReadOutCycleRollingShutter)
62         ,kNReadOutTypes
63     };
64     // elements of the SpreadFunGauss2D parameterization (offsetted by kParamStart)
65     enum {kG1MeanX=kParamStart,kG1SigX,kG1MeanZ,kG1SigZ,kNG1Par};
66     // elements of the SpreadFunDoubleGauss2D parameterization (offsetted by kParamStart)
67     enum {kG2MeanX0=kParamStart,kG2SigX0,kG2MeanZ0,kG2SigZ0,kG2MeanX1,kG2SigX1,kG2MeanZ1,kG2SigZ1,kG2ScaleG2,kNG2Par};
68     //
69     AliITSUSimulationPix();
70     AliITSUSimulationPix(AliITSUSimuParam* sim,AliITSUSensMap* map);
71     virtual ~AliITSUSimulationPix();
72     AliITSUSimulationPix(const AliITSUSimulationPix &source);
73     AliITSUSimulationPix& operator=(const AliITSUSimulationPix &s);
74     void Init();
75     //
76     void FinishSDigitiseChip();
77     void DigitiseChip();
78     //
79     void SDigitiseChip();
80     void WriteSDigits();
81     void Hits2SDigits();
82     void Hits2SDigitsFast();
83     void Hits2SDigitsFastDigital();
84     void AddNoisyPixels();
85     void RemoveDeadPixels();
86     void FrompListToDigits();
87     //
88     Int_t AddRandomNoisePixels(Double_t tof=0);
89     Bool_t SetTanLorAngle(Double_t WeightHole=1.0);
90     Double_t GetTanLorAngle() const {return fTanLorAng;};
91     //
92     // For backwards compatibility
93     void SDigitsToDigits(){ FinishSDigitiseChip();}
94     //
95     Double_t SpreadFunDoubleGauss2D(const Double_t *dtIn);
96     Double_t SpreadFunGauss2D(const Double_t *dtIn);
97     Double_t SpreadFrom2DHisto(const Double_t *dtIn);
98     //
99     virtual void SetResponseParam(AliITSUParamList* resp);
100     //
101     Int_t GetReadOutCycle(Int_t row, Int_t col, Double_t hitTime);
102     Int_t GetReadOutCycleRollingShutter(Int_t row, Int_t col, Double_t hitTime);
103     //
104     void CalcDiodeShiftInPixel(Int_t xrow, Int_t zcol, Float_t &x, Float_t &z);
105     //
106 private:
107     void SpreadCharge2D(Double_t x0,Double_t z0, Double_t dy, Int_t ix0,Int_t iz0,
108                         Double_t el, Double_t tof, Int_t tID, Int_t hID);
109     void PlaceDigitalPixels(Double_t x0,Double_t z0, Double_t el, Double_t tof, Int_t tID, Int_t hID);
110     
111     //
112     void SetCoupling(AliITSUSDigit* old);     // "New" coupling routine  Tiziano Virgili
113     void SetCouplingOld(AliITSUSDigit* old);  // "Old" coupling routine  Rocco Caliandro
114     //
115 protected:
116     Double_t      fTanLorAng;               //! Tangent of the Lorentz Angle (weighted average for hole and electrons)
117     Double_t      fGlobalChargeScale;       // Charge scaling to match Geant and Test beam
118     //
119     TH2*          fSpread2DHisto;           //! optional 2D histo for charge spread parameterization
120     Double_t (AliITSUSimulationPix::*fSpreadFun)(const Double_t *dtIn); //! pointer on current spread function
121     Int_t    (AliITSUSimulationPix::*fROTimeFun)(Int_t row,Int_t col, Double_t hitTime); //! pointer on current R/O time check function
122     
123     ClassDef(AliITSUSimulationPix,1)  // Simulation of pixel clusters
124 };
125 #endif