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 |
|
---|
23 | class MMcEvt ;
|
---|
24 |
|
---|
25 | //==========
|
---|
26 | // MFadc
|
---|
27 | //
|
---|
28 | // The simulation of the Flash ADC system for the MAGIC teleskop is done with
|
---|
29 | // this class.
|
---|
30 | // So all methods concerning the FADC System should be done inside this
|
---|
31 | // class.
|
---|
32 | //
|
---|
33 | // The Idea is to (in)put the data of the photo electrons into the class and
|
---|
34 | // generate the response (output) of the FADC to that input. Response means
|
---|
35 | // in this sense the ADC values of the different time slices for all pixels
|
---|
36 | //
|
---|
37 | // The pixelisation is done by the camera program of Jose Carlos.
|
---|
38 | //
|
---|
39 | // This class is closly connected to the MTrigger classs. So some of the
|
---|
40 | // values defined in MTriggerDefine.h are also used by this class.
|
---|
41 | //
|
---|
42 | // But a lot of other stuff is defined here.
|
---|
43 | //
|
---|
44 | // --> Frist of all the WIDTH of the time slice of one FADC slice
|
---|
45 | // this is 3.33333 nsec.
|
---|
46 | //
|
---|
47 | #define WIDTH_FADC_TIMESLICE (50./15.) // this means 3.33 nsec
|
---|
48 | //
|
---|
49 | // --> Second the number of slices to fill in MFADC. This must by
|
---|
50 | // connected to the MTrigger class. The time of interest must be
|
---|
51 | // equal in both classes.
|
---|
52 | //
|
---|
53 | #define SLICES_MFADC (TOTAL_TRIGGER_TIME / WIDTH_FADC_TIMESLICE)
|
---|
54 | // --> The amount of ns before trigger that would be read from the ADC
|
---|
55 | // in oder to show also the start of the pulse before the
|
---|
56 | // the trigger time.
|
---|
57 | //
|
---|
58 | #define TIME_BEFORE_TRIGGER 10.
|
---|
59 | // --> like the trigger the FADC value will also have a standard response
|
---|
60 | // to one single Photo electron. This response is binned with smaller
|
---|
61 | // bins. The WIDTH of that response function is done here.
|
---|
62 | //
|
---|
63 | #define SUBBINS 5.
|
---|
64 | #define WIDTH_RESPONSE_MFADC (WIDTH_FADC_TIMESLICE / SUBBINS )
|
---|
65 | // 5 sub-bin in one FADC slice
|
---|
66 | //
|
---|
67 | // --> the number of Response slices
|
---|
68 | //
|
---|
69 | #define RESPONSE_SLICES_MFADC 45
|
---|
70 | //
|
---|
71 | //
|
---|
72 | #define MFADC_RESPONSE_FWHM 5.0
|
---|
73 |
|
---|
74 | //
|
---|
75 | //
|
---|
76 | #define MFADC_RESPONSE_AMPLITUDE 4.0
|
---|
77 | //
|
---|
78 | //
|
---|
79 | //
|
---|
80 | //
|
---|
81 | class MFadc {
|
---|
82 | private:
|
---|
83 | //
|
---|
84 | // then for all pixels the shape of all the analog signals
|
---|
85 | //
|
---|
86 | Bool_t used[CAMERA_PIXELS] ; // a boolean to indicated if the pixels is used in this event
|
---|
87 |
|
---|
88 | Float_t sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; // the analog signal for pixels
|
---|
89 | UChar_t output[CAMERA_PIXELS][FADC_SLICES]; // the analog signal for pixels that is read after a trigger occurs.
|
---|
90 |
|
---|
91 | //
|
---|
92 | // first the data for the response function
|
---|
93 | //
|
---|
94 | Float_t fwhm_resp ; // fwhm of the phe_response function
|
---|
95 | Float_t ampl_resp ; // amplitude of the phe_response function (in mV)
|
---|
96 | Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
|
---|
97 | //
|
---|
98 | // RandomGenerator for the Electonic Noise
|
---|
99 | //
|
---|
100 |
|
---|
101 | TRandom *GenElec ;
|
---|
102 |
|
---|
103 |
|
---|
104 | public:
|
---|
105 |
|
---|
106 | MFadc() ;
|
---|
107 |
|
---|
108 | void Reset() ;
|
---|
109 |
|
---|
110 | void Fill( Int_t, Float_t, Float_t ) ;
|
---|
111 |
|
---|
112 | void Baseline();
|
---|
113 |
|
---|
114 | void Offset( Float_t, Int_t );
|
---|
115 |
|
---|
116 | void ElecNoise() ;
|
---|
117 |
|
---|
118 | void Scan() ;
|
---|
119 |
|
---|
120 | void Scan(Float_t time) ;
|
---|
121 |
|
---|
122 | void GetResponse( Float_t *resp ) ;
|
---|
123 |
|
---|
124 | void TriggeredFadc(Float_t time);
|
---|
125 |
|
---|
126 | void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
|
---|
127 |
|
---|
128 | Float_t GetFadcSignal(Int_t pixel, Int_t slice);
|
---|
129 |
|
---|
130 | Float_t GetAmplitude() {
|
---|
131 | return ampl_resp ;
|
---|
132 | }
|
---|
133 |
|
---|
134 | Float_t GetFwhm() {
|
---|
135 | return fwhm_resp ;
|
---|
136 | }
|
---|
137 |
|
---|
138 |
|
---|
139 | } ;
|
---|
140 |
|
---|
141 |
|
---|
142 | #endif
|
---|