| 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 | //
|
|---|
| 51 | // then for all pixels the shape of all the analog signals
|
|---|
| 52 | //
|
|---|
| 53 | Bool_t used[CAMERA_PIXELS] ; // a boolean to indicated if the pixels is used in this event
|
|---|
| 54 | Float_t pedestal[CAMERA_PIXELS] ; // Pedestal of FADCs
|
|---|
| 55 |
|
|---|
| 56 | Float_t sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; // the analog signal for pixels
|
|---|
| 57 | UChar_t output[CAMERA_PIXELS][FADC_SLICES]; // the analog signal for pixels that is read after a trigger occurs.
|
|---|
| 58 |
|
|---|
| 59 | //
|
|---|
| 60 | // first the data for the response function
|
|---|
| 61 | //
|
|---|
| 62 | Float_t fwhm_resp ; // fwhm of the phe_response function
|
|---|
| 63 | Float_t ampl_resp ; // amplitude of the phe_response function (in mV)
|
|---|
| 64 | Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
|
|---|
| 65 | //
|
|---|
| 66 | // RandomGenerator for the Electonic Noise
|
|---|
| 67 | //
|
|---|
| 68 |
|
|---|
| 69 | TRandom *GenElec ;
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | public:
|
|---|
| 73 |
|
|---|
| 74 | MFadc(Float_t ampl=MFADC_RESPONSE_AMPLITUDE, Float_t fwhm=MFADC_RESPONSE_FWHM) ;
|
|---|
| 75 |
|
|---|
| 76 | void Reset() ;
|
|---|
| 77 |
|
|---|
| 78 | void Fill( Int_t, Float_t, Float_t ) ;
|
|---|
| 79 |
|
|---|
| 80 | void Set( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
|
|---|
| 81 |
|
|---|
| 82 | void AddSignal( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
|
|---|
| 83 |
|
|---|
| 84 | void SetPedestals( Int_t ped);
|
|---|
| 85 |
|
|---|
| 86 | void SetPedestals( Float_t ped[CAMERA_PIXELS]);
|
|---|
| 87 |
|
|---|
| 88 | void SetFwhm( Float_t fwhm){
|
|---|
| 89 | fwhm_resp=fwhm;
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | void SetAmpl( Float_t ampl){
|
|---|
| 93 | ampl_resp=ampl;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | void Baseline();
|
|---|
| 97 |
|
|---|
| 98 | void Pedestals();
|
|---|
| 99 |
|
|---|
| 100 | void Offset( Float_t, Int_t );
|
|---|
| 101 |
|
|---|
| 102 | void ElecNoise() ;
|
|---|
| 103 |
|
|---|
| 104 | void Scan() ;
|
|---|
| 105 |
|
|---|
| 106 | void Scan(Float_t time) ;
|
|---|
| 107 |
|
|---|
| 108 | void GetResponse( Float_t *resp ) ;
|
|---|
| 109 |
|
|---|
| 110 | void GetPedestals( Float_t *offset);
|
|---|
| 111 |
|
|---|
| 112 | void TriggeredFadc(Float_t time);
|
|---|
| 113 |
|
|---|
| 114 | void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
|
|---|
| 115 |
|
|---|
| 116 | UChar_t GetFadcSignal(Int_t pixel, Int_t slice);
|
|---|
| 117 |
|
|---|
| 118 | Float_t GetAmplitude() {
|
|---|
| 119 | return ampl_resp ;
|
|---|
| 120 | }
|
|---|
| 121 |
|
|---|
| 122 | Float_t GetFwhm() {
|
|---|
| 123 | return fwhm_resp ;
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 | } ;
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | #endif
|
|---|