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 | //
|
---|
55 | // --> The amount of FADC slice written to the raw format.
|
---|
56 | //
|
---|
57 | #define FADC_SLICES 15
|
---|
58 | // --> The amount of ns before trigger that would be read from the ADC
|
---|
59 | // in oder to show also the start of the pulse before the
|
---|
60 | // the trigger time.
|
---|
61 | //
|
---|
62 | #define TIME_BEFORE_TRIGGER 10.
|
---|
63 | // --> like the trigger the FADC value will also have a standard response
|
---|
64 | // to one single Photo electron. This response is binned with smaller
|
---|
65 | // bins. The WIDTH of that response function is done here.
|
---|
66 | //
|
---|
67 | #define SUBBINS 5.
|
---|
68 | #define WIDTH_RESPONSE_MFADC (WIDTH_FADC_TIMESLICE / SUBBINS )
|
---|
69 | // 5 sub-bin in one FADC slice
|
---|
70 | //
|
---|
71 | // --> the number of Response slices
|
---|
72 | //
|
---|
73 | #define RESPONSE_SLICES_MFADC 45
|
---|
74 | //
|
---|
75 | //
|
---|
76 | #define MFADC_RESPONSE_FWHM 5.0
|
---|
77 |
|
---|
78 | //
|
---|
79 | //
|
---|
80 | #define MFADC_RESPONSE_AMPLITUDE 4.0
|
---|
81 | //
|
---|
82 | //
|
---|
83 | //
|
---|
84 | //
|
---|
85 | class MFadc {
|
---|
86 | private:
|
---|
87 | //
|
---|
88 | // then for all pixels the shape of all the analog signals
|
---|
89 | //
|
---|
90 | Bool_t used[CAMERA_PIXELS] ; // a boolean to indicated if the pixels is used in this event
|
---|
91 |
|
---|
92 | Float_t sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; // the analog signal for pixels
|
---|
93 | UChar_t output[CAMERA_PIXELS][FADC_SLICES]; // the analog signal for pixels that is read after a trigger occurs.
|
---|
94 |
|
---|
95 | //
|
---|
96 | // first the data for the response function
|
---|
97 | //
|
---|
98 | Float_t fwhm_resp ; // fwhm of the phe_response function
|
---|
99 | Float_t ampl_resp ; // amplitude of the phe_response function (in mV)
|
---|
100 | Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
|
---|
101 | //
|
---|
102 | // RandomGenerator for the Electonic Noise
|
---|
103 | //
|
---|
104 |
|
---|
105 | TRandom *GenElec ;
|
---|
106 |
|
---|
107 |
|
---|
108 | public:
|
---|
109 |
|
---|
110 | MFadc() ;
|
---|
111 |
|
---|
112 | void Reset() ;
|
---|
113 |
|
---|
114 | void Fill( Int_t, Float_t, Float_t ) ;
|
---|
115 |
|
---|
116 | void Baseline();
|
---|
117 |
|
---|
118 | void Offset( Float_t, Int_t );
|
---|
119 |
|
---|
120 | void ElecNoise() ;
|
---|
121 |
|
---|
122 | void Scan() ;
|
---|
123 |
|
---|
124 | void Scan(Float_t time) ;
|
---|
125 |
|
---|
126 | void GetResponse( Float_t *resp ) ;
|
---|
127 |
|
---|
128 | void TriggeredFadc(Float_t time);
|
---|
129 |
|
---|
130 | void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
|
---|
131 |
|
---|
132 | Float_t GetFadcSignal(Int_t pixel, Int_t slice);
|
---|
133 |
|
---|
134 | Float_t GetAmplitude() {
|
---|
135 | return ampl_resp ;
|
---|
136 | }
|
---|
137 |
|
---|
138 | Float_t GetFwhm() {
|
---|
139 | return fwhm_resp ;
|
---|
140 | }
|
---|
141 |
|
---|
142 |
|
---|
143 | } ;
|
---|
144 |
|
---|
145 |
|
---|
146 | #endif
|
---|