]>
Commit | Line | Data |
---|---|---|
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 | ||
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | //////////////////////////////////////////////////////////// | |
10 | // Simulation class for SDD // | |
11 | //////////////////////////////////////////////////////////// | |
12 | ||
13 | #include <TNtuple.h> | |
14 | #include "AliITSsimulation.h" | |
15 | ||
16 | class TH1F; | |
17 | class TFile; | |
18 | class TArrayI; | |
19 | class TArrayF; | |
20 | class AliITS; | |
21 | class AliITSpList; | |
22 | class AliITSMap; | |
23 | class AliITSMapA1; | |
24 | class AliITSMapA2; | |
25 | class AliITSetfSDD; | |
26 | class AliITSsegmentationSDD; | |
27 | class AliITSInStream; | |
28 | class AliITSCalibration; | |
29 | class AliITSCalibrationSDD; | |
30 | ||
31 | class AliITSsimulationSDD : public AliITSsimulation { | |
32 | public: | |
33 | AliITSsimulationSDD(); // default constructor | |
34 | //Standard Constructor | |
35 | AliITSsimulationSDD(AliITSDetTypeSim* dettyp); | |
36 | // Copy operator | |
37 | AliITSsimulationSDD(const AliITSsimulationSDD &source); | |
38 | virtual ~AliITSsimulationSDD(); // Destructor | |
39 | // = operator | |
40 | AliITSsimulationSDD& operator=(const AliITSsimulationSDD &source); | |
41 | virtual AliITSsimulation& operator=(const AliITSsimulation &source); | |
42 | // Initilize variables for this simulation | |
43 | void Init(); | |
44 | ||
45 | // Get a pointer to the segmentation object | |
46 | virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(1);} | |
47 | // set pointer to segmentation object | |
48 | virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(1,seg);} | |
49 | ||
50 | // set the scale size factor for the smples in FFT | |
51 | virtual void SetScaleFourier(Int_t scale=4) {fScaleSize=scale;} | |
52 | Int_t ScaleFourier() const {return fScaleSize;} // returns the scale factor | |
53 | // set perpendicular tracks flag | |
54 | virtual void SetPerpendTracksFlag(Bool_t flag=kFALSE) {fFlag=flag;} | |
55 | // returns perpendicular track flag. | |
56 | Bool_t PerpendTracksFlag() const {return fFlag;} | |
57 | // set crosstalk flag | |
58 | virtual void SetCrosstalkFlag(Bool_t flag=kFALSE) {fCrosstalkFlag=flag;} | |
59 | // return crosstalk flag | |
60 | Bool_t CrosstalkFlag() const {return fCrosstalkFlag;} | |
61 | // retrieve compression parameters for 2D or 1D | |
62 | void CompressionParam(Int_t i, Int_t &db, Int_t &tl, Int_t &th) const; | |
63 | // retrieve compression parameters for 2D or 1D | |
64 | void CompressionParam(Int_t i, Int_t &db, Int_t &tl) const; | |
65 | ||
66 | virtual Int_t Convert10to8(Int_t signal) const;//10 to 8 bit SDD compresion | |
67 | virtual void ZeroSuppression(const char *opt); // Apply zero suppresion | |
68 | virtual void Init2D(); // initiilzes 2D compresion algorithm | |
69 | virtual void Compress2D(); // Applies 2D compresion algorithm | |
70 | virtual void Init1D(); // initilizes 1D compresion algorithm | |
71 | virtual void Compress1D(); // Applies 1D compresion algorithm | |
72 | virtual void StoreAllDigits(); // if No compresion run this. | |
73 | // returns baseline and noise for a given anode i. | |
74 | //virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const; | |
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); | |
80 | ||
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) const {return fTol[i];}//returns tolerance | |
84 | virtual Int_t Disable(Int_t i) const {return fT2[i];}//high threshold 2D | |
85 | // Set the output file name - for 1D encoding | |
86 | virtual void SetFileName(const char *filnam) {fFileName=filnam;} | |
87 | ||
88 | // add baseline, noise, gain, electronics and ADC saturation effects | |
89 | void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE, Bool_t bAddGain=kTRUE); | |
90 | // add crosstalk effect | |
91 | void ApplyCrosstalk(Int_t mod); | |
92 | ||
93 | // create maps to build the lists of tracks for each summable digit | |
94 | void InitSimulationModule( Int_t module, Int_t event ); | |
95 | // clear maps | |
96 | void ClearMaps(); | |
97 | // Summable Digitses a SDD module | |
98 | void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev); | |
99 | // Add Summable digits to module maps. | |
100 | Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask ); | |
101 | // digitize module from the sum of summable digits. | |
102 | void FinishSDigitiseModule(); | |
103 | // Writes summable digits | |
104 | void WriteSDigits(); | |
105 | // Introduces electronics effects and does zero-suppresion if required | |
106 | void FinishDigits(); | |
107 | // Digitses a SDD module | |
108 | void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev); | |
109 | // Spread charge in a SDD module | |
110 | void HitsToAnalogDigits(AliITSmodule *mod); | |
111 | // Sorts tracks for the 3 most highly contributed one to be added to digit. | |
112 | //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits | |
113 | // 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 | { if(strstr(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); | |
137 | ||
138 | // Sets the check noise flag. | |
139 | void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;} | |
140 | // Returns the noise value | |
141 | Float_t GetNoise(); | |
142 | // sets DoFFT value. | |
143 | void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;} | |
144 | ||
145 | // Print SSD simulation Parameters | |
146 | virtual void PrintStatus() const; | |
147 | ||
148 | private: | |
149 | // virtual void GetBaseline(Int_t mod); // read baseline values from a file | |
150 | // set compression parameters for 2D or 1D via response functions | |
151 | void SetCompressParam(); | |
152 | // Variables and pointers for local use only. Not Streamed out. | |
153 | AliITS *fITS; //! local pointer to ITS | |
154 | AliITSMapA2 *fHitMap2; //! local pointer to map of signals | |
155 | AliITSMapA2 *fHitSigMap2; //! local pointer to map of signals | |
156 | AliITSMapA2 *fHitNoiMap2; //! local pointer to map of signals | |
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 | ||
187 | ClassDef(AliITSsimulationSDD,2) // Simulation of SDD clusters | |
188 | ||
189 | }; | |
190 | #endif |