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