]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationSDD.h
New methods and data member added by M. Horner.
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSDD.h
1 #ifndef ALIITSSIMULATIONSDD_H
2 #define ALIITSSIMULATIONSDD_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice     */
5 /* $Id$ */
6
7 #include <TNtuple.h>
8 #include <TArrayF.h>
9
10 #include "AliITSsimulation.h"
11
12 class TH1F;
13 class TFile;
14 class TVector;
15 class TArrayI;
16 class TArrayF;
17 class AliITS;
18 class AliITSpList;
19 class AliITSMap;
20 class AliITSMapA1;
21 class AliITSMapA2;
22 class AliITSetfSDD;
23 class AliITSsegmentationSDD;
24 class AliITSInStream;
25 class AliITSresponse;
26 class AliITSresponseSDD;
27
28 class AliITSsimulationSDD : public AliITSsimulation {
29
30  public:
31     AliITSsimulationSDD(); // default constructor
32     //Standard Constructor
33     AliITSsimulationSDD(AliITSsegmentation *seg, AliITSresponse *res);
34     // Copy opporator
35     AliITSsimulationSDD(AliITSsimulationSDD &source);
36     virtual ~AliITSsimulationSDD(); // Destructor
37     // = opporator
38     AliITSsimulationSDD& operator=(AliITSsimulationSDD &source);
39     // Initilize variables for this simulation
40     void Init(AliITSsegmentationSDD *seg,AliITSresponseSDD *resp);
41
42     // get the address of the array mapping the signal or pointers to arrays
43 //    virtual AliITSMap*  HitMap(Int_t i);
44
45     // set the scale size factor for the smples in FFT
46     virtual void SetScaleFourier(Int_t scale=4) {fScaleSize=scale;}
47     Int_t ScaleFourier() const {return fScaleSize;} // returns the scale factor
48     // set perpendicular tracks flag
49     virtual void SetPerpendTracksFlag(Bool_t flag=kFALSE) {fFlag=flag;}
50     // returns perpendicular track flag.
51     Bool_t PerpendTracksFlag() const {return fFlag;} 
52     // set crosstalk flag
53     virtual void SetCrosstalkFlag(Bool_t flag=kFALSE) {fCrosstalkFlag=flag;}
54     // return crosstalk flag
55     Bool_t CrosstalkFlag() const {return fCrosstalkFlag;}
56     // set compression parameters for 2D or 1D via response functions
57     void SetCompressParam();
58     // retrieve compression parameters for 2D or 1D
59     void CompressionParam(Int_t i, Int_t &db, Int_t &tl, Int_t &th);
60     // retrieve compression parameters for 2D or 1D
61     void CompressionParam(Int_t i, Int_t &db, Int_t &tl);
62
63     virtual Int_t Convert10to8(Int_t signal) const;// 10 to 8 bit SDD compresion
64     virtual Int_t Convert8to10(Int_t signal) const;//undo 10 to 8 bit SDD compresion
65     virtual void ZeroSuppression(const char *opt); // Apply zero suppresion
66     virtual void Init2D();   // initiilzes 2D compresion algorithm
67     virtual void Compress2D(); // Applies 2D compresion algorithm
68     virtual void Init1D();   // initilizes 1D compresion algorithm
69     virtual void Compress1D(); // Applies 1D compresion algorithm
70     virtual void StoreAllDigits(); // if No compresion run this.
71     virtual void ReadBaseline();  // read baseline values from a file
72     // returns baseline and noise for a given anode i.
73     virtual void GetAnodeBaseline(Int_t i, Float_t &baseline, Float_t &noise);
74     // local implementation of ITS->AddDigit. Specific for SDD
75     virtual void AddDigit(Int_t i, Int_t j, Int_t signal);
76     // Finds clulsters of signals. Use with regards to Compresion algorithms
77     virtual void  FindCluster(Int_t i, Int_t j,Int_t signal,
78                               Int_t minval,Bool_t &cond);
79
80     // get parameters for 1D - this could be changed when we get more
81     // input from Torino after they have a look at the code 
82     virtual Int_t Tolerance(Int_t i) {return fTol[i];}//returns tolerance
83     virtual Int_t Disable(Int_t i)  {return fT2[i];}//high threshold  2D
84     // Set the output file name - for 1D encoding 
85     virtual void SetFileName(const char *filnam) {fFileName=filnam;}
86
87     // add baseline, noise, electronics and ADC saturation effects
88     void ChargeToSignal(Bool_t bAddNoise=kFALSE);
89     // add dead channels
90     void ApplyDeadChannels();
91     // add crosstalk effect
92     void ApplyCrosstalk();
93     
94     // create maps to build the lists of tracks for each summable digit
95     void InitSimulationModule( Int_t module, Int_t event );
96     // clear maps
97     void ClearMaps();
98     // Summable Digitses a SDD module
99     void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
100     // Add Summable digits to module maps.
101     Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
102     // digitize module from the sum of summable digits.
103     void FinishSDigitiseModule();
104     // Writes summable digits
105     void WriteSDigits();
106     // Introduces electronics effects and does zero-suppresion if required
107     void FinishDigits();
108     // Digitses a SDD module
109     void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
110     // Spread charge in a SDD module
111     void HitsToAnalogDigits(AliITSmodule *mod);
112     // Sorts tracks for the 3 most highly contributed one to be added to digit.
113     //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits,Int_t ntracks);
114     // collects and returns the fired SDD cells (uses AliITSMapA2...).
115     //void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
116         //                TClonesArray *padr);
117
118     // Creates histograms of maps for debugging
119     void CreateHistograms(Int_t scale);
120     // Fills histograms of maps for debugging
121     void FillHistograms();
122     // Resets histograms of maps for debugging
123     void ResetHistograms();
124     // Get the pointer to the array of histograms
125     TObjArray*  GetHistArray() {return fHis;}
126     // create a separate tree for background monitoring (2D) 
127     virtual  void  MakeTreeB(Option_t *option="B") 
128         { fTreeB = new TNtuple("ntuple","2D backgr","nz:nl:nh:low:anode");}
129     // presently a dummy routine use TreeB() instead
130     void GetTreeB(Int_t) { }
131     // Return pointer to TreeB
132     TNtuple *TreeB() {return fTreeB;}
133     void WriteToFile(TFile *fp);// Writes the histograms to a file
134     // Get's histogram of a particular anode.
135     TH1F *GetAnode(Int_t wing, Int_t anode);
136
137     // Sets the check noise flag.
138     void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;}
139     // Returns the noise value
140     Float_t GetNoise();
141     // sets DoFFT value.
142     void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
143
144     // Print SSD simulation Parameters
145     virtual void Print();
146
147  private:
148     // Variables and pointers for local use only. Not Streamed out.
149     AliITS         *fITS;          //! local pointer to ITS
150 //    AliITSMapA1    *fHitMap1;      //! local pointer to map of digits
151     AliITSMapA2    *fHitMap2;      //! local pointer to map of signals
152     AliITSMapA2    *fHitSigMap2;   //! local pointer to map of signals
153     AliITSMapA2    *fHitNoiMap2;   //! local pointer to map of signals
154 //    AliITSpList    *fpList;        //! 
155 //    TObjArray      *falist;        //
156 //    TClonesArray   *fpadr;         //
157     AliITSInStream *fStream;       //! input file stream
158     AliITSetfSDD   *fElectronics;  //! local pointer to electronics simulation
159     Double_t       *fInZR;         //! [fScaleSize*fMaxNofSamples] input of the
160                                    // real part of FFT
161     Double_t       *fInZI;         //! [fScaleSize*fMaxNofSamples] 
162                                    // input of the imaginary part of FFT
163     Double_t       *fOutZR;        //! [fScaleSize*fMaxNofSamples] 
164                                    // output of the real part of FFT
165     Double_t       *fOutZI;        //! [fScaleSize*fMaxNofSamples] 
166                                    // output of the imaginary part of FFT
167     Bool_t         *fAnodeFire;     //! [#of anodes] Flag if there is a signal
168
169     TObjArray *fHis;          // just in case for histogramming
170     TArrayI    fD;            // decrease values for baseline eq.
171     TArrayI    fT1;           // low thresholds
172     TArrayI    fT2;           // high thresholds(2D) or disable (1D) 
173     TArrayI    fTol;          // tolerance
174     TArrayF    fBaseline;     // Baseline
175     TArrayF    fNoise;        // Noise value
176     TNtuple   *fTreeB;        // Background info tree for 2D
177     TString    fParam;        // Compresion algorithm options
178     TString    fFileName;     // File name for possible options above
179     Bool_t     fFlag;         // Flag used to simulate perpendicular tracks
180     Bool_t     fCheckNoise;   // Flag used to check the simulated noise
181     Bool_t     fCrosstalkFlag; // Flag used to apply the crosstalk effect
182     Int_t      fDoFFT;        // Flag used to switch off electronics when 0
183     Int_t      fNofMaps;      // Number of anodes used ( 1-2*nanodes per wing )
184     Int_t      fMaxNofSamples;// Number of time samples
185     Int_t      fScaleSize;    // scale size factor for the samples in FFT
186 //    Int_t      fModule;       //! in case bgr,noise,param,change module-by-mod.
187 //    Int_t      fEvent;        //! solely for output from bgr monitoring of 2D
188
189   ClassDef(AliITSsimulationSDD,1)  // Simulation of SDD clusters
190
191 };
192 #endif