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