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