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