source: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx@ 5319

Last change on this file since 5319 was 5248, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 6.1 KB
Line 
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 <sstream>
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
24class 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
48class MFadc {
49 private:
50 Int_t numpix;
51 Int_t fInnerPixelsNum; // number of inner (small) pixels.
52 //
53 // then for all pixels the shape of all the analog signals
54 //
55 Bool_t used[CAMERA_PIXELS] ; // a boolean to indicated if the pixels is used in this event
56 Float_t pedestal[CAMERA_PIXELS] ; // Pedestal of FADCs
57
58 Int_t fSlices_mFadc; // Number of simulated FADC slices. Larger than the actual number of slices
59 // that will be written, since we have to account for possible delays in the
60 // trigger
61
62 Int_t fResponseSlicesFadc;
63
64 //
65 // Float_t sig[CAMERA_PIXELS][] ;
66 // the analog signal for pixels, in bins of width
67 // equal to the FADC slice: (default 50/15 ns), but with a
68 // total of fSlices_mFadc bins (default 48).
69 //
70 Float_t *sig[CAMERA_PIXELS];
71
72 Float_t *noise;
73 Float_t *noise_outer;
74 Float_t *digital_noise;
75
76 Float_t *output[CAMERA_PIXELS]; // the analog signal for pixels that is read after a trigger
77 // occurs (high gain).
78
79 Float_t *output_lowgain[CAMERA_PIXELS]; // analog signal, low gain.
80
81 Float_t high2low_gain;
82
83 //
84 // first the data for the response function
85 //
86 Int_t shape_resp; // index shape of the phe_response function
87 // = 0 --> Gaussian
88 // = 1 --> Pulpo set-up
89 Float_t fwhm_resp; // fwhm of the phe_response function (in ns)
90 Float_t integ_resp; // area below curve of the phe_response function (in counts * ns)
91 Float_t *sing_resp; // the shape of the phe_response function
92
93 Float_t fFadcSlicesPerNanosec; // Number of FADC slices per nanosecond, that is, the
94 // sampling frequency of the FADC.
95
96 Int_t fFadcSlices; // Number of FADC slices that will be written on the output
97 // file (same number for high and low gain)
98
99 //
100 // We may end up with a different reponse for the outer pixels
101 //
102 Int_t shape_resp_outer ; // index shape of the phe_response function
103 // = 0 --> Gaussian
104 // = 1 --> Pulpo set-up
105 Float_t fwhm_resp_outer ; // fwhm of the phe_response function (in ns)
106 Float_t integ_resp_outer; // area below curve of the phe_response function (in counts * ns)
107 Float_t *sing_resp_outer; // the shape of the phe_response function
108
109
110 //
111 // RandomGenerator for the Electonic Noise
112 //
113
114 TRandom *GenElec ;
115
116 Float_t fadc_time_offset; // Time offset to adjust the delay between trigger
117 // and the peak position in the FADC of the signal
118 // in the trigger pixels.
119
120public:
121
122 MFadc(Int_t pix = 577,
123 Int_t shape = 0,
124 Float_t ampl = MFADC_RESPONSE_INTEGRAL,
125 Float_t fwhm = MFADC_RESPONSE_FWHM,
126 Int_t shapeout = 0,
127 Float_t amplout = MFADC_RESPONSE_INTEGRAL,
128 Float_t fwhmout = MFADC_RESPONSE_FWHM,
129 Float_t trig_delay = 0.,
130 Float_t fadc_slices_per_ns = FADC_SLICES_PER_NSEC,
131 Int_t fadc_slices_written = FADC_SLICES);
132
133 void SetSeed(UInt_t seed) {GenElec->SetSeed(seed);}
134
135 void Reset() ;
136
137 void Fill( Int_t, Float_t, Float_t, Int_t ) ;
138
139 void Fill( Int_t, Float_t, Float_t ) ;
140
141 void FillOuter( Int_t, Float_t, Float_t ) ;
142
143 void Set( Int_t iPix, Float_t *res);
144 void AddSignal( Int_t iPix, Float_t *res);
145
146 void SetPedestals( Int_t ped);
147
148 void SetPedestals( Float_t *ped);
149
150 void SetShape( Int_t inner, Int_t outer){
151 shape_resp=inner;
152 shape_resp_outer=outer;
153 }
154
155 void SetFwhm( Float_t fwhm){
156 fwhm_resp=fwhm;
157 }
158
159 void SetInteg( Float_t x){
160 integ_resp=x;
161 }
162
163 void SetFwhmOuter( Float_t fwhm){
164 fwhm_resp_outer=fwhm;
165 }
166
167 void SetIntegOuter( Float_t x){
168 integ_resp_outer=x;
169 }
170
171 void Baseline();
172
173 void Pedestals();
174
175 void Offset( Float_t, Int_t );
176
177 void SetElecNoise(Float_t value1=2.0, Float_t value2=2.0, UInt_t ninpix=CAMERA_PIXELS);
178
179 void ElecNoise();
180
181 void SetDigitalNoise(Float_t value=2.0);
182
183 void DigitalNoise() ;
184
185 void Scan() ;
186
187 void Scan(Float_t time) ;
188
189 void GetResponse( Float_t *resp ) ;
190
191 void GetPedestals( Float_t *offset);
192
193 Float_t GetPedestalNoise (Int_t pix, Int_t ishigh);
194
195 Float_t AddNoiseInSlices( Int_t pix, Int_t ishigh, Int_t n_slices);
196
197 void TriggeredFadc(Float_t time);
198
199 void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
200
201 UChar_t GetFadcSignal(Int_t pixel, Int_t slice);
202
203 UChar_t GetFadcLowGainSignal(Int_t pixel, Int_t slice);
204
205 void SetHigh2LowGain(Float_t h2l) {high2low_gain=h2l;}
206
207 Int_t GetShape() {
208 return shape_resp;
209 }
210
211 Float_t GetIntegral() {
212 return integ_resp ;
213 }
214
215 Float_t GetFwhm() {
216 return fwhm_resp ;
217 }
218
219 Float_t GetIntegralOuter() {
220 return integ_resp_outer ;
221 }
222
223 Float_t GetFwhmOuter() {
224 return fwhm_resp_outer ;
225 }
226
227 Float_t GetFadcSlicesPerNanosec() {
228 return fFadcSlicesPerNanosec;
229 }
230
231 Int_t GetResponseSlicesFadc() {
232 return fResponseSlicesFadc;
233 }
234
235 Bool_t IsPixelUsed(UInt_t p){
236 return used[p];
237 }
238
239} ;
240
241
242#endif
Note: See TracBrowser for help on using the repository browser.