Line data Source code
1 : #ifndef ALIITSSIMULATIONSDD_H
2 : #define ALIITSSIMULATIONSDD_H
3 : /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 :
7 : /* $Id$ */
8 :
9 : ////////////////////////////////////////////////////////////
10 : // Simulation class for SDD //
11 : ////////////////////////////////////////////////////////////
12 :
13 : #include <TNtuple.h>
14 : #include "AliITSsimulation.h"
15 : #include "AliITSsegmentationSDD.h"
16 : class TH1F;
17 : class TFile;
18 : class TArrayI;
19 : class TArrayF;
20 : class AliITS;
21 : class AliITSpList;
22 : class AliITSMap;
23 : class AliITSMapA1;
24 : class AliITSMapA2;
25 : class AliITSetfSDD;
26 : class AliITSCalibration;
27 : class AliITSCalibrationSDD;
28 :
29 : class AliITSsimulationSDD : public AliITSsimulation {
30 : public:
31 : AliITSsimulationSDD(); // default constructor
32 : //Standard Constructor
33 : AliITSsimulationSDD(AliITSDetTypeSim* dettyp);
34 :
35 : virtual ~AliITSsimulationSDD(); // Destructor
36 :
37 : // virtual AliITSsimulation& operator=(const AliITSsimulation &source);
38 : // Initilize variables for this simulation
39 : void Init();
40 :
41 : // Get a pointer to the segmentation object
42 198 : virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(1);}
43 : // set pointer to segmentation object
44 0 : virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(1,seg);}
45 :
46 : static Int_t ScaleFourier(const AliITSsegmentationSDD* seg)
47 4 : {if(seg->Npx()==128) {return 8;} else {return 4;}} // returns the scale factor
48 : // set perpendicular tracks flag
49 1 : virtual void SetPerpendTracksFlag(Bool_t flag=kFALSE) {fFlag=flag;}
50 : // returns perpendicular track flag.
51 0 : Bool_t PerpendTracksFlag() const {return fFlag;}
52 : // set crosstalk flag
53 1 : virtual void SetCrosstalkFlag(Bool_t flag=kFALSE) {fCrosstalkFlag=flag;}
54 : // return crosstalk flag
55 0 : Bool_t CrosstalkFlag() const {return fCrosstalkFlag;}
56 : void FastFourierTransform(Double_t *real, Double_t *imag, Int_t direction);
57 : virtual Int_t Convert10to8(Int_t signal) const;//10 to 8 bit SDD compresion
58 : virtual Int_t Convert8to10(Int_t signal) const;//8 to 10 bit decompresion
59 : virtual void Compress2D(); // Applies 2D compresion algorithm
60 : virtual void StoreAllDigits(); // if No compresion run this.
61 : // returns baseline and noise for a given anode i.
62 : //virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const;
63 : // local implementation of ITS->AddDigit. Specific for SDD
64 : virtual void AddDigit(Int_t i, Int_t j, Int_t signalc, Int_t signale);
65 :
66 : // add baseline, noise, gain, electronics and ADC saturation effects
67 : void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE, Bool_t bAddGain=kTRUE);
68 : // add crosstalk effect
69 : void ApplyCrosstalk(Int_t mod);
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();
75 : // Summable Digitses a SDD module
76 : void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
77 : // Add Summable digits to module maps.
78 : Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
79 : // digitize module from the sum of summable digits.
80 : void FinishSDigitiseModule();
81 : // Writes summable digits
82 : void WriteSDigits();
83 : // Introduces electronics effects and does zero-suppresion if required
84 : void FinishDigits();
85 : // Digitses a SDD module
86 : void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
87 : // Spread charge in a SDD module
88 : void HitsToAnalogDigits(AliITSmodule *mod);
89 : // Sorts tracks for the 3 most highly contributed one to be added to digit.
90 : //void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits
91 : // Int_t ntracks);
92 : // collects and returns the fired SDD cells (uses AliITSMapA2...).
93 : //void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
94 : // TClonesArray *padr);
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 0 : TObjArray* GetHistArray() {return fHis;}
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 :
108 : // sets DoFFT value.
109 2 : void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
110 :
111 : // Print SSD simulation Parameters
112 : virtual void PrintStatus() const;
113 :
114 : private:
115 : AliITSsimulationSDD(const AliITSsimulationSDD &source);
116 : AliITSsimulationSDD& operator=(const AliITSsimulationSDD &source);
117 :
118 : // virtual void GetBaseline(Int_t mod); // read baseline values from a file
119 : // Variables and pointers for local use only. Not Streamed out.
120 : AliITS *fITS; //! local pointer to ITS
121 : AliITSMapA2 *fHitMap2; //! local pointer to map of signals
122 : AliITSMapA2 *fHitSigMap2; //! local pointer to map of signals
123 : AliITSMapA2 *fHitNoiMap2; //! local pointer to map of signals
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
133 : Bool_t *fAnodeFire; //! [#of anodes] Flag if there is a signal
134 :
135 : TObjArray *fHis; // just in case for histogramming
136 : Bool_t fFlag; // Flag used to simulate perpendicular tracks
137 : Bool_t fCrosstalkFlag; // Flag used to apply the crosstalk effect
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
142 :
143 696 : ClassDef(AliITSsimulationSDD,3) // Simulation of SDD clusters
144 :
145 : };
146 : #endif
|