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