Removing obsolete class AliITSGeant3Geometry - Test beam simulation classes back...
[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
fcf95fc7 6
8a33ae9e 7/* $Id$ */
1ca7869b 8
8ba39da9 9////////////////////////////////////////////////////////////
10// Simulation class for SDD //
11////////////////////////////////////////////////////////////
12
b0f5e3fc 13#include <TNtuple.h>
b0f5e3fc 14#include "AliITSsimulation.h"
b0f5e3fc 15
1ca7869b 16class TH1F;
17class TFile;
1ca7869b 18class TArrayI;
19class TArrayF;
e8189707 20class AliITS;
c7a4dac0 21class AliITSpList;
e8189707 22class AliITSMap;
23class AliITSMapA1;
24class AliITSMapA2;
b0f5e3fc 25class AliITSetfSDD;
c7a4dac0 26class AliITSsegmentationSDD;
e8189707 27class AliITSInStream;
fcf95fc7 28class AliITSCalibration;
29class AliITSCalibrationSDD;
b0f5e3fc 30
b0f5e3fc 31class AliITSsimulationSDD : public AliITSsimulation {
aacedc3e 32 public:
8a33ae9e 33 AliITSsimulationSDD(); // default constructor
34 //Standard Constructor
8ba39da9 35 AliITSsimulationSDD(AliITSDetTypeSim* dettyp);
f45f6658 36 // Copy operator
8a33ae9e 37 AliITSsimulationSDD(AliITSsimulationSDD &source);
38 virtual ~AliITSsimulationSDD(); // Destructor
f45f6658 39 // = operator
d2f55a22 40 AliITSsimulationSDD& operator=(const AliITSsimulationSDD &source);
5402d9ca 41 virtual AliITSsimulation& operator=(const AliITSsimulation &source);
c7a4dac0 42 // Initilize variables for this simulation
aacedc3e 43 void Init();
8a33ae9e 44
8ba39da9 45 // Get a pointer to the segmentation object
46 virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(1);}
47 // set pointer to segmentation object
48 virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(1,seg);}
8a33ae9e 49
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 // retrieve compression parameters for 2D or 1D
f45f6658 62 void CompressionParam(Int_t i, Int_t &db, Int_t &tl, Int_t &th) const;
8a33ae9e 63 // retrieve compression parameters for 2D or 1D
f45f6658 64 void CompressionParam(Int_t i, Int_t &db, Int_t &tl) const;
8a33ae9e 65
aacedc3e 66 virtual Int_t Convert10to8(Int_t signal) const;//10 to 8 bit SDD compresion
8a33ae9e 67 virtual void ZeroSuppression(const char *opt); // Apply zero suppresion
68 virtual void Init2D(); // initiilzes 2D compresion algorithm
69 virtual void Compress2D(); // Applies 2D compresion algorithm
70 virtual void Init1D(); // initilizes 1D compresion algorithm
71 virtual void Compress1D(); // Applies 1D compresion algorithm
72 virtual void StoreAllDigits(); // if No compresion run this.
8a33ae9e 73 // returns baseline and noise for a given anode i.
f45f6658 74 //virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const;
8a33ae9e 75 // local implementation of ITS->AddDigit. Specific for SDD
76 virtual void AddDigit(Int_t i, Int_t j, Int_t signal);
77 // Finds clulsters of signals. Use with regards to Compresion algorithms
78 virtual void FindCluster(Int_t i, Int_t j,Int_t signal,
aacedc3e 79 Int_t minval,Bool_t &cond);
8a33ae9e 80
81 // get parameters for 1D - this could be changed when we get more
82 // input from Torino after they have a look at the code
8ba39da9 83 virtual Int_t Tolerance(Int_t i) const {return fTol[i];}//returns tolerance
84 virtual Int_t Disable(Int_t i) const {return fT2[i];}//high threshold 2D
8a33ae9e 85 // Set the output file name - for 1D encoding
86 virtual void SetFileName(const char *filnam) {fFileName=filnam;}
87
88 // add baseline, noise, electronics and ADC saturation effects
8ba39da9 89 void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE);
50d05d7b 90 // add dead channels
8ba39da9 91 void ApplyDeadChannels(Int_t mod);
50d05d7b 92 // add crosstalk effect
8ba39da9 93 void ApplyCrosstalk(Int_t mod);
50d05d7b 94
95 // create maps to build the lists of tracks for each summable digit
96 void InitSimulationModule( Int_t module, Int_t event );
97 // clear maps
98 void ClearMaps();
c7a4dac0 99 // Summable Digitses a SDD module
100 void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
48058160 101 // Add Summable digits to module maps.
102 Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
50d05d7b 103 // digitize module from the sum of summable digits.
104 void FinishSDigitiseModule();
c7a4dac0 105 // Writes summable digits
50d05d7b 106 void WriteSDigits();
c7a4dac0 107 // Introduces electronics effects and does zero-suppresion if required
50d05d7b 108 void FinishDigits();
8a33ae9e 109 // Digitses a SDD module
110 void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
c7a4dac0 111 // Spread charge in a SDD module
50d05d7b 112 void HitsToAnalogDigits(AliITSmodule *mod);
8a33ae9e 113 // Sorts tracks for the 3 most highly contributed one to be added to digit.
aacedc3e 114 //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits
115 // Int_t ntracks);
8a33ae9e 116 // collects and returns the fired SDD cells (uses AliITSMapA2...).
50d05d7b 117 //void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
aacedc3e 118 // TClonesArray *padr);
8a33ae9e 119
120 // Creates histograms of maps for debugging
121 void CreateHistograms(Int_t scale);
122 // Fills histograms of maps for debugging
123 void FillHistograms();
124 // Resets histograms of maps for debugging
125 void ResetHistograms();
126 // Get the pointer to the array of histograms
127 TObjArray* GetHistArray() {return fHis;}
128 // create a separate tree for background monitoring (2D)
129 virtual void MakeTreeB(Option_t *option="B")
aacedc3e 130 { if(strstr(option,"B"))
131 fTreeB = new TNtuple("ntuple", "2D backgr","nz:nl:nh:low:anode");}
8a33ae9e 132 // presently a dummy routine use TreeB() instead
133 void GetTreeB(Int_t) { }
134 // Return pointer to TreeB
135 TNtuple *TreeB() {return fTreeB;}
136 void WriteToFile(TFile *fp);// Writes the histograms to a file
137 // Get's histogram of a particular anode.
138 TH1F *GetAnode(Int_t wing, Int_t anode);
139
140 // Sets the check noise flag.
141 void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;}
142 // Returns the noise value
143 Float_t GetNoise();
144 // sets DoFFT value.
145 void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
146
147 // Print SSD simulation Parameters
d2f55a22 148 virtual void PrintStatus() const;
8a33ae9e 149
aacedc3e 150 private:
f45f6658 151 // virtual void GetBaseline(Int_t mod); // read baseline values from a file
152 // set compression parameters for 2D or 1D via response functions
153 void SetCompressParam();
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
f45f6658 176 // TArrayF fBaseline; // Baseline
177 //TArrayF fNoise; // Noise value
8a33ae9e 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
f45f6658 189 ClassDef(AliITSsimulationSDD,2) // Simulation of SDD clusters
8a33ae9e 190
b0f5e3fc 191};
192#endif