]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulationSDD.h
Cosmetic changes.
[u/mrichter/AliRoot.git] / ITS / AliITSsimulationSDD.h
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 /* $Id$ */
6
7 #include <TNtuple.h>
8 #include <TArrayF.h>
9
10 #include "AliITSsimulation.h"
11
12 class TH1F;
13 class TFile;
14 class TVector;
15 class TArrayI;
16 class TArrayF;
17 class AliITS;
18 class AliITSMap;
19 class AliITSMapA1;
20 class AliITSMapA2;
21 class AliITSetfSDD;
22 class AliITSInStream;
23 class AliITSresponse;
24
25 class AliITSsimulationSDD : public AliITSsimulation {
26
27  public:
28     AliITSsimulationSDD(); // default constructor
29     //Standard Constructor
30     AliITSsimulationSDD(AliITSsegmentation *seg, AliITSresponse *res);
31     // Copy opporator
32     AliITSsimulationSDD(AliITSsimulationSDD &source);
33     virtual ~AliITSsimulationSDD(); // Destructor
34     // = opporator
35     AliITSsimulationSDD& operator=(AliITSsimulationSDD &source);
36
37     // get the address of the array mapping the signal or pointers to arrays
38     virtual AliITSMap*  HitMap(Int_t i);
39
40     // set the scale size factor for the smples in FFT
41     virtual void SetScaleFourier(Int_t scale=4) {fScaleSize=scale;}
42     Int_t ScaleFourier() const {return fScaleSize;} // returns the scale factor
43     // set perpendicular tracks flag
44     virtual void SetPerpendTracksFlag(Bool_t flag=kFALSE) {fFlag=flag;}
45     // returns perpendicular track flag.
46     Bool_t PerpendTracksFlag() const {return fFlag;} 
47     // set compression parameters for 2D or 1D via response functions
48     void SetCompressParam();
49     // retrieve compression parameters for 2D or 1D
50     void CompressionParam(Int_t i, Int_t &db, Int_t &tl, Int_t &th);
51     // retrieve compression parameters for 2D or 1D
52     void CompressionParam(Int_t i, Int_t &db, Int_t &tl);
53
54     virtual Int_t Convert10to8(Int_t signal) const;// 10 to 8 bit SDD compresion
55     virtual Int_t Convert8to10(Int_t signal) const;//undo 10 to 8 bit SDD compresion
56     virtual void ZeroSuppression(const char *opt); // Apply zero suppresion
57     virtual void Init2D();   // initiilzes 2D compresion algorithm
58     virtual void Compress2D(); // Applies 2D compresion algorithm
59     virtual void Init1D();   // initilizes 1D compresion algorithm
60     virtual void Compress1D(); // Applies 1D compresion algorithm
61     virtual void StoreAllDigits(); // if No compresion run this.
62     virtual void ReadBaseline();  // read baseline values from a file
63     // returns baseline and noise for a given anode i.
64     virtual void GetAnodeBaseline(Int_t i, Float_t &baseline, Float_t &noise);
65     // local implementation of ITS->AddDigit. Specific for SDD
66     virtual void AddDigit(Int_t i, Int_t j, Int_t signal);
67     // Finds clulsters of signals. Use with regards to Compresion algorithms
68     virtual void  FindCluster(Int_t i, Int_t j,Int_t signal,
69                               Int_t minval,Bool_t &cond);
70
71     // get parameters for 1D - this could be changed when we get more
72     // input from Torino after they have a look at the code 
73     virtual Int_t Tolerance(Int_t i) {return fTol[i];}//returns tolerance
74     virtual Int_t Disable(Int_t i)  {return fT2[i];}//high threshold  2D
75     // Set the output file name - for 1D encoding 
76     virtual void SetFileName(const char *filnam) {fFileName=filnam;}
77
78     // add baseline, noise, electronics and ADC saturation effects
79     void ChargeToSignal();
80     // Digitses a SDD module
81     void DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
82     // Sorts tracks for the 3 most highly contributed one to be added to digit.
83     void SortTracks(Int_t *tracks,Float_t *charges,Int_t *hits,Int_t ntracks);
84     // collects and returns the fired SDD cells (uses AliITSMapA2...).
85     void ListOfFiredCells(Int_t *arg,Double_t timeAmplitude,TObjArray *list,
86                           TClonesArray *padr);
87
88     // Creates histograms of maps for debugging
89     void CreateHistograms(Int_t scale);
90     // Fills histograms of maps for debugging
91     void FillHistograms();
92     // Resets histograms of maps for debugging
93     void ResetHistograms();
94     // Get the pointer to the array of histograms
95     TObjArray*  GetHistArray() {return fHis;}
96     // create a separate tree for background monitoring (2D) 
97     virtual  void  MakeTreeB(Option_t *option="B") 
98         { fTreeB = new TNtuple("ntuple","2D backgr","nz:nl:nh:low:anode");}
99     // presently a dummy routine use TreeB() instead
100     void GetTreeB(Int_t) { }
101     // Return pointer to TreeB
102     TNtuple *TreeB() {return fTreeB;}
103     void WriteToFile(TFile *fp);// Writes the histograms to a file
104     // Get's histogram of a particular anode.
105     TH1F *GetAnode(Int_t wing, Int_t anode);
106
107     // Sets the check noise flag.
108     void SetCheckNoise(Bool_t check=kFALSE) {fCheckNoise=check;}
109     // Returns the noise value
110     Float_t GetNoise();
111     // sets DoFFT value.
112     void SetDoFFT(Int_t doFFT=1) {fDoFFT=doFFT;}
113
114     // Print SSD simulation Parameters
115     virtual void Print();
116
117  private:
118     // Variables and pointers for local use only. Not Streamed out.
119     AliITS         *fITS;          //! local pointer to ITS
120     AliITSMapA1    *fHitMap1;      //! local pointer to map of digits
121     AliITSMapA2    *fHitMap2;      //! local pointer to map of signals
122     AliITSInStream *fStream;       //! input file stream
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
132
133     TObjArray *fHis;          // just in case for histogramming
134     TArrayI    fD;            // decrease values for baseline eq.
135     TArrayI    fT1;           // low thresholds
136     TArrayI    fT2;           // high thresholds(2D) or disable (1D) 
137     TArrayI    fTol;          // tolerance
138     TArrayF    fBaseline;     // Baseline
139     TArrayF    fNoise;        // Noise value
140     TNtuple   *fTreeB;        // Background info tree for 2D
141     TString    fParam;        // Compresion algorithm options
142     TString    fFileName;     // File name for possible options above
143     Bool_t     fFlag;         // Flag used to simulate perpendicular tracks
144     Bool_t     fCheckNoise;   // Flag used to check the simulated noise
145     Int_t      fDoFFT;        // Flag used to switch off electronics when 0
146     Int_t      fNofMaps;      // Number of anodes used ( 1-2*nanodes per wing )
147     Int_t      fMaxNofSamples;// Number of time samples
148     Int_t      fScaleSize;    // scale size factor for the samples in FFT
149     Int_t      fModule;       // in case bgr,noise,param,change module-by-mod.
150     Int_t      fEvent;        // solely for output from bgr monitoring of 2D
151
152   ClassDef(AliITSsimulationSDD,1)  // Simulation of SDD clusters
153
154 };
155 #endif