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