]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationSDD.h
9325027fd68879c2e6bb170036e32b9ea847c41f
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSDD.h
1 #ifndef ALIITSSIMULATIONSDD_H
2 #define ALIITSSIMULATIONSDD_H
3
4
5 #include <TH1.h>
6 #include <TFile.h>
7 #include <TNtuple.h>
8 #include <TVector.h>
9 #include <TArrayI.h>
10
11 #include "AliITSsimulation.h"
12
13 //___________________________________________________
14
15
16 class AliITS;
17 class AliITSMap;
18 class AliITSMapA1;
19 class AliITSMapA2;
20 class AliITSetfSDD;
21 class AliITSInStream;
22
23 //___________________________________________________
24
25 class AliITSsimulationSDD : public AliITSsimulation {
26
27 public:
28
29   AliITSsimulationSDD();
30   AliITSsimulationSDD(AliITSsegmentation *seg, AliITSresponse *res);
31   AliITSsimulationSDD(AliITSsimulationSDD &source);
32   virtual ~AliITSsimulationSDD();
33   AliITSsimulationSDD& operator=(AliITSsimulationSDD &source);
34
35   // get the address of the array mapping the signal or pointers to arrays
36   virtual AliITSMap*  HitMap(Int_t i);
37
38   // set the scale size factor for the smples in FFT
39   virtual void SetScaleFourier(Int_t scale=4) {fScaleSize=scale;}
40   Int_t ScaleFourier() {return fScaleSize;}
41   // set perpendicular tracks flag
42   virtual void SetPerpendTracksFlag(Bool_t flag=1) {fFlag=1;}
43   Bool_t PerpendTracksFlag() {return fFlag;} 
44   // set compression parameters for 2D or 1D via response functions
45   void SetCompressParam();
46   // retrieve compression parameters for 2D or 1D
47   void CompressionParam(Int_t i, Int_t &db, Int_t &tl, Int_t &th);
48   void CompressionParam(Int_t i, Int_t &db, Int_t &tl);
49
50   virtual Int_t Convert10to8(Int_t signal);
51   virtual Int_t Convert8to10(Int_t signal);
52   virtual void ZeroSuppression(const char *opt);
53   virtual void Init2D();
54   virtual void Compress2D();
55   virtual void Init1D();
56   virtual void Compress1D();
57   virtual void StoreAllDigits();
58   virtual void ReadBaseline();
59   virtual void GetAnodeBaseline(Int_t i, Float_t &baseline, Float_t &noise);
60   virtual void AddDigit(Int_t i, Int_t j, Int_t signal);
61   virtual void  FindCluster
62        (Int_t i, Int_t j,Int_t signal,Int_t minval,Bool_t &cond);
63
64
65   // get parameters for 1D - this could be changed when we get more
66   // input from Torino after they have a look at the code 
67   virtual Int_t Tolerance(Int_t i) {return fTol[i];}
68   virtual Int_t Disable(Int_t i) {return fT2[i];}
69   // Set the output file name - for 1D encoding 
70   virtual void SetFileName(const char *filnam) {fFileName=filnam;}
71
72   void ChargeToSignal();
73   void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
74   void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits,Int_t ntracks);
75   void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
76                         TClonesArray *padr);
77
78   void CreateHistograms(Int_t scale);
79   void FillHistograms();
80   void ResetHistograms();
81   // Get the pointer to the array of histograms
82   TObjArray*  GetHistArray() {return fHis;}
83
84   // create a separate tree for background monitoring (2D) 
85   virtual  void  MakeTreeB(Option_t *option="B") 
86     { fTreeB = new TNtuple("ntuple","2D backgr","nz:nl:nh:low:anode");}
87   void           GetTreeB(Int_t) { }
88
89   // Return pointer to TreeB
90   TNtuple      *TreeB() {return fTreeB;} 
91
92   void WriteToFile(TFile *fp);
93   TH1F *GetAnode(Int_t wing, Int_t anode); 
94   void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;}
95   Float_t GetNoise();
96   void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
97
98
99 private:
100   AliITS              *fITS;  //! local pointer to ITS
101
102   AliITSMapA1         *fHitMap1; //! local pointer to map of digits
103   AliITSMapA2         *fHitMap2; //! local pointer to map of signals
104   AliITSInStream      *fStream;  //! input file stream
105   AliITSetfSDD        *fElectronics; //! local pointer to electronics simulation
106   
107   TArrayI             fD;            // decrease values for baseline eq.
108   TArrayI             fT1;           // low thresholds
109   TArrayI             fT2;           // high thresholds(2D) or disable (1D) 
110   TArrayI             fTol;          // tolerance
111   TArrayF             fBaseline;     // Baseline
112   TArrayF             fNoise;        // Noise value
113   TNtuple            *fTreeB;        // Background info tree for 2D
114   TString             fParam;        // Compresion algorithm options
115   TString             fFileName;     // File name for possible options above
116
117   Bool_t fFlag;         // Flag used to simulate perpendicular tracks
118   Bool_t fCheckNoise;   // Flag used to check the simulated noise
119   Int_t  fDoFFT;        // Flag used to switch off electronics when 0
120   Int_t fNofMaps;       // Number of anodes used ( 1 - 2*nanodes per wing )
121   Int_t fMaxNofSamples; // Number of time samples
122   Int_t fScaleSize;     // scale size factor for the samples in FFT
123   Int_t fModule;  // in case bgr, noise, param change module-by-module
124   Int_t fEvent;   // solely for output from bgr monitoring of 2D
125   
126   TObjArray *fHis;             // just in case for histogramming
127
128   Double_t            *fInZR;  // ! [fScaleSize*fMaxNofSamples]  
129                                // input of the real part of FFT
130   Double_t            *fInZI;  // ! [fScaleSize*fMaxNofSamples] 
131                                // input of the imaginary part of FFT
132   Double_t            *fOutZR; // ! [fScaleSize*fMaxNofSamples] 
133                                // output of the real part of FFT
134   Double_t            *fOutZI; // ! [fScaleSize*fMaxNofSamples] 
135                                // output of the imaginary part of FFT
136
137   ClassDef(AliITSsimulationSDD,1)  // Simulation of SDD clusters
138     
139 };
140 #endif