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

Last change on this file since 5079 was 5079, checked in by moralejo, 20 years ago
*** empty log message ***
File size: 5.7 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 <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
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 Float_t sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; // the analog signal for pixels, in bins of width
59 // equal to the FADC slice: 50/15 ns, but with a
60 // total of SLICES_MFADC (=48 now) bins.
61 Float_t noise[((Int_t) SLICES_MFADC)*1001];
62 Float_t noise_outer[((Int_t) SLICES_MFADC)*1001];
63 Int_t digital_noise[((Int_t) SLICES_MFADC)*1001];
64
65 Float_t output[CAMERA_PIXELS][FADC_SLICES]; // the analog signal for pixels that is read after a trigger
66 // occurs (high gain). Only 15 (=FADC_SLICES) bins
67
68 Float_t output_lowgain[CAMERA_PIXELS][FADC_SLICES]; // analog signal, low gain.
69
70 Float_t high2low_gain;
71 //
72 // first the data for the response function
73 //
74 Int_t shape_resp ; // index shape of the phe_response function
75 // = 0 --> Gaussian
76 // = 1 --> Pulpo set-up
77 Float_t fwhm_resp ; // fwhm of the phe_response function (in ns)
78 Float_t integ_resp ; // area below curve of the phe_response function (in counts * ns)
79 Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
80
81 //
82 // We may end up with a different reponse for the outer pixels
83 //
84 Int_t shape_resp_outer ; // index shape of the phe_response function
85 // = 0 --> Gaussian
86 // = 1 --> Pulpo set-up
87 Float_t fwhm_resp_outer ; // fwhm of the phe_response function (in ns)
88 Float_t integ_resp_outer ; // area below curve of the phe_response function (in counts * ns)
89 Float_t sing_resp_outer[ RESPONSE_SLICES_MFADC ] ; // the shape of the phe_response function
90 //
91 // RandomGenerator for the Electonic Noise
92 //
93
94 TRandom *GenElec ;
95
96 Float_t fadc_time_offset; // Time offset to adjust the delay between trigger
97 // and the peak position in the FADC of the signal
98 // in the trigger pixels.
99
100
101public:
102
103 MFadc(Int_t pix=577,
104 Int_t shape=0,
105 Float_t ampl=MFADC_RESPONSE_INTEGRAL,
106 Float_t fwhm=MFADC_RESPONSE_FWHM,
107 Int_t shapeout=0,
108 Float_t amplout=MFADC_RESPONSE_INTEGRAL,
109 Float_t fwhmout=MFADC_RESPONSE_FWHM,
110 Float_t trig_delay=0.) ;
111
112 void SetSeed(UInt_t seed) {GenElec->SetSeed(seed);}
113
114 void Reset() ;
115
116 void Fill( Int_t, Float_t, Float_t, Int_t ) ;
117
118 void Fill( Int_t, Float_t, Float_t ) ;
119
120 void FillOuter( Int_t, Float_t, Float_t ) ;
121
122 void Set( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
123
124 void AddSignal( Int_t iPix, Float_t res[(Int_t) SLICES_MFADC]);
125
126 void SetPedestals( Int_t ped);
127
128 void SetPedestals( Float_t *ped);
129
130 void SetShape( Int_t inner, Int_t outer){
131 shape_resp=inner;
132 shape_resp_outer=outer;
133 }
134
135 void SetFwhm( Float_t fwhm){
136 fwhm_resp=fwhm;
137 }
138
139 void SetInteg( Float_t x){
140 integ_resp=x;
141 }
142
143 void SetFwhmOuter( Float_t fwhm){
144 fwhm_resp_outer=fwhm;
145 }
146
147 void SetIntegOuter( Float_t x){
148 integ_resp_outer=x;
149 }
150
151 void Baseline();
152
153 void Pedestals();
154
155 void Offset( Float_t, Int_t );
156
157 void SetElecNoise(Float_t value1=2.0, Float_t value2=2.0, UInt_t ninpix=CAMERA_PIXELS);
158
159 void ElecNoise();
160
161 void SetDigitalNoise(Float_t value=2.0);
162
163 void DigitalNoise() ;
164
165 void Scan() ;
166
167 void Scan(Float_t time) ;
168
169 void GetResponse( Float_t *resp ) ;
170
171 void GetPedestals( Float_t *offset);
172
173 Float_t GetPedestalNoise (Int_t pix, Int_t ishigh);
174
175 Float_t AddNoiseInSlices( Int_t pix, Int_t ishigh, Int_t n_slices);
176
177 void TriggeredFadc(Float_t time);
178
179 void ShowSignal ( MMcEvt *McEvt , Float_t ) ;
180
181 UChar_t GetFadcSignal(Int_t pixel, Int_t slice);
182
183 UChar_t GetFadcLowGainSignal(Int_t pixel, Int_t slice);
184
185 void SetHigh2LowGain(Float_t h2l) {high2low_gain=h2l;}
186
187 Float_t GetShape() {
188 return shape_resp;
189 }
190
191 Float_t GetIntegral() {
192 return integ_resp ;
193 }
194
195 Float_t GetFwhm() {
196 return fwhm_resp ;
197 }
198
199 Float_t GetIntegralOuter() {
200 return integ_resp_outer ;
201 }
202
203 Float_t GetFwhmOuter() {
204 return fwhm_resp_outer ;
205 }
206
207 Bool_t IsPixelUsed(UInt_t p){
208 return used[p];
209 }
210
211} ;
212
213
214#endif
Note: See TracBrowser for help on using the repository browser.