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 */
8 ////////////////////////////////////////////////////////////
9 // Simulation class for SDD //
10 ////////////////////////////////////////////////////////////
15 #include "AliITSsimulation.h"
28 class AliITSsegmentationSDD;
31 class AliITSresponseSDD;
33 class AliITSsimulationSDD : public AliITSsimulation {
35 AliITSsimulationSDD(); // default constructor
36 //Standard Constructor
37 AliITSsimulationSDD(AliITSDetTypeSim* dettyp);
39 AliITSsimulationSDD(AliITSsimulationSDD &source);
40 virtual ~AliITSsimulationSDD(); // Destructor
42 AliITSsimulationSDD& operator=(const AliITSsimulationSDD &source);
43 virtual AliITSsimulation& operator=(const AliITSsimulation &source);
44 // Initilize variables for this simulation
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);}
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;}
60 virtual void SetCrosstalkFlag(Bool_t flag=kFALSE) {fCrosstalkFlag=flag;}
61 // return crosstalk flag
62 Bool_t CrosstalkFlag() const {return fCrosstalkFlag;}
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);
70 virtual Int_t Convert10to8(Int_t signal) const;//10 to 8 bit SDD compresion
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.
79 virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const;
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,
84 Int_t minval,Bool_t &cond);
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
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
90 // Set the output file name - for 1D encoding
91 virtual void SetFileName(const char *filnam) {fFileName=filnam;}
93 // add baseline, noise, electronics and ADC saturation effects
94 void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE);
96 void ApplyDeadChannels(Int_t mod);
97 // add crosstalk effect
98 void ApplyCrosstalk(Int_t mod);
100 // create maps to build the lists of tracks for each summable digit
101 void InitSimulationModule( Int_t module, Int_t event );
104 // Summable Digitses a SDD module
105 void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
106 // Add Summable digits to module maps.
107 Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
108 // digitize module from the sum of summable digits.
109 void FinishSDigitiseModule();
110 // Writes summable digits
112 // Introduces electronics effects and does zero-suppresion if required
114 // Digitses a SDD module
115 void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
116 // Spread charge in a SDD module
117 void HitsToAnalogDigits(AliITSmodule *mod);
118 // Sorts tracks for the 3 most highly contributed one to be added to digit.
119 //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits
121 // collects and returns the fired SDD cells (uses AliITSMapA2...).
122 //void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
123 // TClonesArray *padr);
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")
135 { if(strstr(option,"B"))
136 fTreeB = new TNtuple("ntuple", "2D backgr","nz:nl:nh:low:anode");}
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);
145 // Sets the check noise flag.
146 void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;}
147 // Returns the noise value
150 void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
152 // Print SSD simulation Parameters
153 virtual void PrintStatus() const;
156 // Variables and pointers for local use only. Not Streamed out.
157 AliITS *fITS; //! local pointer to ITS
158 AliITSMapA2 *fHitMap2; //! local pointer to map of signals
159 AliITSMapA2 *fHitSigMap2; //! local pointer to map of signals
160 AliITSMapA2 *fHitNoiMap2; //! local pointer to map of signals
161 AliITSInStream *fStream; //! input file stream
162 AliITSetfSDD *fElectronics; //! local pointer to electronics simulation
163 Double_t *fInZR; //! [fScaleSize*fMaxNofSamples] input of the
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
171 Bool_t *fAnodeFire; //! [#of anodes] Flag if there is a signal
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
185 Bool_t fCrosstalkFlag; // Flag used to apply the crosstalk effect
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
191 ClassDef(AliITSsimulationSDD,1) // Simulation of SDD clusters