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