Merge branch 'master' into TPCdev
[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"
dee45d79 15#include "AliITSsegmentationSDD.h"
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;
fcf95fc7 26class AliITSCalibration;
27class AliITSCalibrationSDD;
b0f5e3fc 28
b0f5e3fc 29class AliITSsimulationSDD : public AliITSsimulation {
aacedc3e 30 public:
8a33ae9e 31 AliITSsimulationSDD(); // default constructor
32 //Standard Constructor
8ba39da9 33 AliITSsimulationSDD(AliITSDetTypeSim* dettyp);
fa358bbd 34
8a33ae9e 35 virtual ~AliITSsimulationSDD(); // Destructor
fa358bbd 36
85f5e9c2 37 // virtual AliITSsimulation& operator=(const AliITSsimulation &source);
c7a4dac0 38 // Initilize variables for this simulation
aacedc3e 39 void Init();
8a33ae9e 40
8ba39da9 41 // Get a pointer to the segmentation object
42 virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(1);}
43 // set pointer to segmentation object
44 virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(1,seg);}
8a33ae9e 45
dee45d79 46 static Int_t ScaleFourier(const AliITSsegmentationSDD* seg)
47 {if(seg->Npx()==128) {return 8;} else {return 4;}} // returns the scale factor
8a33ae9e 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;}
50d05d7b 52 // set crosstalk flag
53 virtual void SetCrosstalkFlag(Bool_t flag=kFALSE) {fCrosstalkFlag=flag;}
54 // return crosstalk flag
55 Bool_t CrosstalkFlag() const {return fCrosstalkFlag;}
20f3f947 56 void FastFourierTransform(Double_t *real, Double_t *imag, Int_t direction);
aacedc3e 57 virtual Int_t Convert10to8(Int_t signal) const;//10 to 8 bit SDD compresion
83ec5e27 58 virtual Int_t Convert8to10(Int_t signal) const;//8 to 10 bit decompresion
8a33ae9e 59 virtual void Compress2D(); // Applies 2D compresion algorithm
8a33ae9e 60 virtual void StoreAllDigits(); // if No compresion run this.
8a33ae9e 61 // returns baseline and noise for a given anode i.
f45f6658 62 //virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const;
8a33ae9e 63 // local implementation of ITS->AddDigit. Specific for SDD
83ec5e27 64 virtual void AddDigit(Int_t i, Int_t j, Int_t signalc, Int_t signale);
8a33ae9e 65
5683bd96 66 // add baseline, noise, gain, electronics and ADC saturation effects
67 void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE, Bool_t bAddGain=kTRUE);
50d05d7b 68 // add crosstalk effect
8ba39da9 69 void ApplyCrosstalk(Int_t mod);
50d05d7b 70
71 // create maps to build the lists of tracks for each summable digit
72 void InitSimulationModule( Int_t module, Int_t event );
73 // clear maps
74 void ClearMaps();
c7a4dac0 75 // Summable Digitses a SDD module
76 void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
48058160 77 // Add Summable digits to module maps.
78 Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
50d05d7b 79 // digitize module from the sum of summable digits.
80 void FinishSDigitiseModule();
c7a4dac0 81 // Writes summable digits
50d05d7b 82 void WriteSDigits();
c7a4dac0 83 // Introduces electronics effects and does zero-suppresion if required
50d05d7b 84 void FinishDigits();
8a33ae9e 85 // Digitses a SDD module
86 void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
c7a4dac0 87 // Spread charge in a SDD module
50d05d7b 88 void HitsToAnalogDigits(AliITSmodule *mod);
8a33ae9e 89 // Sorts tracks for the 3 most highly contributed one to be added to digit.
aacedc3e 90 //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits
91 // Int_t ntracks);
8a33ae9e 92 // collects and returns the fired SDD cells (uses AliITSMapA2...).
50d05d7b 93 //void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
aacedc3e 94 // TClonesArray *padr);
8a33ae9e 95
96 // Creates histograms of maps for debugging
97 void CreateHistograms(Int_t scale);
98 // Fills histograms of maps for debugging
99 void FillHistograms();
100 // Resets histograms of maps for debugging
101 void ResetHistograms();
102 // Get the pointer to the array of histograms
103 TObjArray* GetHistArray() {return fHis;}
8a33ae9e 104 void WriteToFile(TFile *fp);// Writes the histograms to a file
105 // Get's histogram of a particular anode.
106 TH1F *GetAnode(Int_t wing, Int_t anode);
107
8a33ae9e 108 // sets DoFFT value.
109 void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
110
111 // Print SSD simulation Parameters
d2f55a22 112 virtual void PrintStatus() const;
8a33ae9e 113
aacedc3e 114 private:
fa358bbd 115 AliITSsimulationSDD(const AliITSsimulationSDD &source);
116 AliITSsimulationSDD& operator=(const AliITSsimulationSDD &source);
117
f45f6658 118 // virtual void GetBaseline(Int_t mod); // read baseline values from a file
8a33ae9e 119 // Variables and pointers for local use only. Not Streamed out.
120 AliITS *fITS; //! local pointer to ITS
8a33ae9e 121 AliITSMapA2 *fHitMap2; //! local pointer to map of signals
48058160 122 AliITSMapA2 *fHitSigMap2; //! local pointer to map of signals
123 AliITSMapA2 *fHitNoiMap2; //! local pointer to map of signals
8a33ae9e 124 AliITSetfSDD *fElectronics; //! local pointer to electronics simulation
125 Double_t *fInZR; //! [fScaleSize*fMaxNofSamples] input of the
126 // real part of FFT
127 Double_t *fInZI; //! [fScaleSize*fMaxNofSamples]
128 // input of the imaginary part of FFT
129 Double_t *fOutZR; //! [fScaleSize*fMaxNofSamples]
130 // output of the real part of FFT
131 Double_t *fOutZI; //! [fScaleSize*fMaxNofSamples]
132 // output of the imaginary part of FFT
43217ad9 133 Bool_t *fAnodeFire; //! [#of anodes] Flag if there is a signal
8a33ae9e 134
135 TObjArray *fHis; // just in case for histogramming
8a33ae9e 136 Bool_t fFlag; // Flag used to simulate perpendicular tracks
50d05d7b 137 Bool_t fCrosstalkFlag; // Flag used to apply the crosstalk effect
8a33ae9e 138 Int_t fDoFFT; // Flag used to switch off electronics when 0
139 Int_t fNofMaps; // Number of anodes used ( 1-2*nanodes per wing )
140 Int_t fMaxNofSamples;// Number of time samples
141 Int_t fScaleSize; // scale size factor for the samples in FFT
95d1e92f 142
20f3f947 143 ClassDef(AliITSsimulationSDD,3) // Simulation of SDD clusters
8a33ae9e 144
b0f5e3fc 145};
146#endif