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