1 | #ifndef __MFadc__
|
---|
2 | #define __MFadc__
|
---|
3 | //
|
---|
4 | // class MFadc
|
---|
5 | //
|
---|
6 | // implemented by Harald Kornmayer
|
---|
7 | //
|
---|
8 | // This is a class to simulate the FADC.
|
---|
9 | // It assumes a special response of the PMT for one single Photo-electron.
|
---|
10 | //
|
---|
11 | //
|
---|
12 | //
|
---|
13 | #include <stream.h>
|
---|
14 | #include <math.h>
|
---|
15 |
|
---|
16 | #include "TObject.h"
|
---|
17 | #include "TRandom.h"
|
---|
18 |
|
---|
19 | #include "Mdefine.h"
|
---|
20 |
|
---|
21 | #include "MTriggerDefine.h"
|
---|
22 | #include "MFadcDefine.h"
|
---|
23 |
|
---|
24 | class MMcEvt ;
|
---|
25 |
|
---|
26 | //==========
|
---|
27 | // MFadc
|
---|
28 | //
|
---|
29 | // The simulation of the Flash ADC system for the MAGIC teleskop is done with
|
---|
30 | // this class.
|
---|
31 | // So all methods concerning the FADC System should be done inside this
|
---|
32 | // class.
|
---|
33 | //
|
---|
34 | // The Idea is to (in)put the data of the photo electrons into the class and
|
---|
35 | // generate the response (output) of the FADC to that input. Response means
|
---|
36 | // in this sense the ADC values of the different time slices for all pixels
|
---|
37 | //
|
---|
38 | // The pixelisation is done by the camera program of Jose Carlos.
|
---|
39 | //
|
---|
40 | // This class is closly connected to the MTrigger classs. So some of the
|
---|
41 | // values defined in MTriggerDefine.h are also used by this class.
|
---|
42 | //
|
---|
43 | // But a lot of other stuff is defined in MFadcDefine.h.
|
---|
44 | //
|
---|
45 | //
|
---|
46 |
|
---|
47 |
|
---|
48 | class MFadc {
|
---|
49 | private:
|
---|
50 | Int_t numpix;
|
---|
51 | //
|
---|
52 | // then for all pixels the shape of all the analog signals
|
---|
53 | //
|
---|
54 | Bool_t used[CAMERA_PIXELS] ; // a boolean to indicated if the pixels is used in this event
|
---|
55 | Float_t pedestal[CAMERA_PIXELS] ; // Pedestal of FADCs
|
---|
56 |
|
---|
57 | Float_t sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; // the analog signal for pixels
|
---|
58 | Float_t noise[((Int_t) SLICES_MFADC)*1001];
|
---|
59 | Int_t digital_noise[((Int_t) SLICES_MFADC)*1001];
|
---|
60 |
|
---|
61 | UChar_t output[CAMERA_PIXELS][FADC_SLICES]; // the analog signal for pixels that is read after a trigger occurs (high gain).
|
---|
62 |
|
---|
63 | UChar_t output_lowgain[CAMERA_PIXELS][FADC_SLICES]; // analog signal, low gain.
|
---|
64 | Float_t high2low_gain;
|
---|
65 | //
|
---|
66 | // first the data for the response function
|
---|
67 | //
|
---|
68 | Float_t fwhm_resp ; // fwhm of the phe_response function (in ns)
|
---|
69 | Float_t ampl_resp ; // area below curve of the phe_response function (in counts * ns)
|
---|
70 | Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
|
---|
71 |
|
---|
72 | //
|
---|
73 | // We may end up with a different reponse for the outer pixels
|
---|
74 | //
|
---|
75 | Float_t fwhm_resp_outer ; // fwhm of the phe_response function (in ns)
|
---|
76 | Float_t ampl_resp_outer ; // area below curve of the phe_response function (in counts * ns)
|
---|
77 | Float_t sing_resp_outer[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
|
---|
78 | //
|
---|
79 | // RandomGenerator for the Electonic Noise
|
---|
80 | //
|
---|
81 |
|
---|
82 | TRandom *GenElec ;
|
---|
83 |
|
---|
84 |
|
---|
85 | public:
|
---|
86 |
|
---|
87 | MFadc(Int_t pix=577,
|
---|
88 | Float_t ampl=MFADC_RESPONSE_AMPLITUDE,
|
---|
89 | Float_t fwhm=MFADC_RESPONSE_FWHM,
|
---|
90 | Float_t amplout=MFADC_RESPONSE_AMPLITUDE,
|
---|
91 | Float_t fwhmout=MFADC_RESPONSE_FWHM) ;
|
---|
92 |
|
---|
93 | void SetSeed(UInt_t seed) {GenElec->SetSeed(seed);}
|
---|
94 |
|
---|
95 | void Reset() ;
|
---|
96 |
|
---|
97 | void Fill( Int_t, Float_t, Float_t, Int_t ) ;
|
---|
98 |
|
---|
99 | void Fill( Int_t, Float_t, Float_t ) ;
|
---|
100 |
|
---|
101 | void FillOuter( Int_t, Float_t, Float_t ) ;
|
---|
102 |
|
---|
103 | void Set( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
|
---|
104 |
|
---|
105 | void AddSignal( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
|
---|
106 |
|
---|
107 | void SetPedestals( Int_t ped);
|
---|
108 |
|
---|
109 | void SetPedestals( Float_t *ped);
|
---|
110 |
|
---|
111 | void SetFwhm( Float_t fwhm){
|
---|
112 | fwhm_resp=fwhm;
|
---|
113 | }
|
---|
114 |
|
---|
115 | void SetAmpl( Float_t ampl){
|
---|
116 | ampl_resp=ampl;
|
---|
117 | }
|
---|
118 |
|
---|
119 | void SetFwhmOuter( Float_t fwhm){
|
---|
120 | fwhm_resp_outer=fwhm;
|
---|
121 | }
|
---|
122 |
|
---|
123 | void SetAmplOuter( Float_t ampl){
|
---|
124 | ampl_resp_outer=ampl;
|
---|
125 | }
|
---|
126 |
|
---|
127 | void Baseline();
|
---|
128 |
|
---|
129 | void Pedestals();
|
---|
130 |
|
---|
131 | void Offset( Float_t, Int_t );
|
---|
132 |
|
---|
133 | void SetElecNoise(Float_t value=2.0);
|
---|
134 |
|
---|
135 | void ElecNoise(Float_t value=2.0) ;
|
---|
136 |
|
---|
137 | void SetDigitalNoise(Float_t value=2.0);
|
---|
138 |
|
---|
139 | void DigitalNoise() ;
|
---|
140 |
|
---|
141 | void Scan() ;
|
---|
142 |
|
---|
143 | void Scan(Float_t time) ;
|
---|
144 |
|
---|
145 | void GetResponse( Float_t *resp ) ;
|
---|
146 |
|
---|
147 | void GetPedestals( Float_t *offset);
|
---|
148 |
|
---|
149 | Float_t GetPedestalNoise (Int_t pix, Int_t ishigh);
|
---|
150 |
|
---|
151 | void TriggeredFadc(Float_t time);
|
---|
152 |
|
---|
153 | void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
|
---|
154 |
|
---|
155 | UChar_t GetFadcSignal(Int_t pixel, Int_t slice);
|
---|
156 |
|
---|
157 | UChar_t GetFadcLowGainSignal(Int_t pixel, Int_t slice);
|
---|
158 |
|
---|
159 | void SetHigh2LowGain(Float_t h2l) {high2low_gain=h2l;}
|
---|
160 |
|
---|
161 | Float_t GetAmplitude() {
|
---|
162 | return ampl_resp ;
|
---|
163 | }
|
---|
164 |
|
---|
165 | Float_t GetFwhm() {
|
---|
166 | return fwhm_resp ;
|
---|
167 | }
|
---|
168 |
|
---|
169 | Float_t GetAmplitudeOuter() {
|
---|
170 | return ampl_resp_outer ;
|
---|
171 | }
|
---|
172 |
|
---|
173 | Float_t GetFwhmOuter() {
|
---|
174 | return fwhm_resp_outer ;
|
---|
175 | }
|
---|
176 |
|
---|
177 | Bool_t IsPixelUsed(UInt_t p){
|
---|
178 | return used[p];
|
---|
179 | }
|
---|
180 |
|
---|
181 | } ;
|
---|
182 |
|
---|
183 |
|
---|
184 | #endif
|
---|