1 | #ifndef __MTrigger__
|
---|
2 | #define __MTrigger__
|
---|
3 |
|
---|
4 | #define CASE_SHOW 0
|
---|
5 | #define CASE_NSB 1
|
---|
6 | #define CASE_STAR 2
|
---|
7 |
|
---|
8 | // class MTrigger
|
---|
9 | //
|
---|
10 | // implemented by Harald Kornmayer
|
---|
11 | //
|
---|
12 | // This is a class to simulate the trigger.
|
---|
13 | // It assumes a special response of the PMT for one single Photo-electron.
|
---|
14 | //
|
---|
15 | //
|
---|
16 | //
|
---|
17 | #include <iostream.h>
|
---|
18 | #include <math.h>
|
---|
19 |
|
---|
20 | #include "TROOT.h"
|
---|
21 | #include "TObject.h"
|
---|
22 | #include "TRandom.h"
|
---|
23 | #include "TH1.h"
|
---|
24 |
|
---|
25 | #include "Mdefine.h"
|
---|
26 | #include "MMcEvt.hxx"
|
---|
27 |
|
---|
28 | #include "MGeomCam.h"
|
---|
29 |
|
---|
30 | #include "MTriggerDefine.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | //==========
|
---|
34 | // MTrigger
|
---|
35 | //
|
---|
36 | // The simulation of the Trigger for MonteCarlo Events is using this
|
---|
37 | // class. So all methods concerning the trigger should be done inside this
|
---|
38 | // class.
|
---|
39 | //
|
---|
40 | // For a better understanding of the behavior of the trigger is here small
|
---|
41 | // abstract of the trigger. This may change in the future.
|
---|
42 | //
|
---|
43 | //
|
---|
44 | // We now from the camera program (This is the surrounding of the class
|
---|
45 | // MTrigger.) that one photo electron leaves at time t the photo cathode
|
---|
46 | // of the pixel number iPix).
|
---|
47 | //
|
---|
48 | // At the end of the PMT, the preamp, the optical fiber transmission we
|
---|
49 | // get a signal of a given shape. After some discussion with Eckart the
|
---|
50 | // standard response function looks like this :
|
---|
51 | //
|
---|
52 | // It is a gaussian Signal with a given FWHM.
|
---|
53 | //
|
---|
54 | // So whenever a photo electron leaves the photo cathod, on has to add
|
---|
55 | // the standard response function to the analog signal of the pixel.
|
---|
56 | //
|
---|
57 | // Each pixel of the camera has such an summed-up analog signal. It may
|
---|
58 | // look like this picture:
|
---|
59 | //
|
---|
60 | //
|
---|
61 | // This is the input of the discriminator for the pixels. The output of
|
---|
62 | // the discriminator is a digital signal. The response of the diskriminator
|
---|
63 | // is not fixed at the moment. There are discussion about this topic.
|
---|
64 | //
|
---|
65 | // At the moment the response is very simple. Whenever the analog signal
|
---|
66 | // is crossing a defined threshold from below to above, a digital signal
|
---|
67 | // with a given length is created.
|
---|
68 | //
|
---|
69 | // No one can start with the simulation of different trigger levels.
|
---|
70 | //
|
---|
71 | // The TriggerLevelZero is a very easy one. It is just looking if there
|
---|
72 | // are more then N digital signals at level ON (=1). If this is the case,
|
---|
73 | // a TriggerLevelZero signal is created.
|
---|
74 | //
|
---|
75 | // The TriggerLevelOne is not implemented now. This will be a kind of next
|
---|
76 | // neighbour condition (i.e. four neigbouring analog signals at the same
|
---|
77 | // time, but this requests at least four digital signals at level ON, what
|
---|
78 | // is equivalent with a TriggerLevelZero.
|
---|
79 | //
|
---|
80 | //
|
---|
81 | class MTrigger {
|
---|
82 |
|
---|
83 | private:
|
---|
84 | Int_t pixnum;
|
---|
85 | //
|
---|
86 | // then for all pixels the shape of all the analog signals
|
---|
87 | //
|
---|
88 | Bool_t *used; // a boolean to indicated if the pixels is used in this event
|
---|
89 | Int_t *nphotshow; // count the photo electrons per pixel coming from showers
|
---|
90 | Int_t *nphotnsb; // count the photo electrons per pixel coming from NSB
|
---|
91 | Int_t *nphotstar; // count the photo electrons per pixel coming from stars
|
---|
92 |
|
---|
93 | Float_t **a_sig ; // the analog signal for pixels
|
---|
94 |
|
---|
95 | Float_t *baseline; // for the baseline shift
|
---|
96 |
|
---|
97 | //
|
---|
98 | // then for all pixels the shape of the digital signal
|
---|
99 | //
|
---|
100 | Bool_t *dknt ; // a boolean to indicated if the pixels has passed the diskrminator
|
---|
101 | Float_t **d_sig ; // the digital signal for all pixels
|
---|
102 |
|
---|
103 | //
|
---|
104 | // and the sum of all digital signals
|
---|
105 | //
|
---|
106 | Float_t sum_d_sig[TRIGGER_TIME_SLICES] ;
|
---|
107 |
|
---|
108 | //
|
---|
109 | // first the data for the response function
|
---|
110 | //
|
---|
111 | Float_t fwhm_resp ; // fwhm of the phe_response function
|
---|
112 | Float_t ampl_resp ; // amplitude of the phe_response function (in mV)
|
---|
113 | Float_t sing_resp[ RESPONSE_SLICES ] ; // the shape of the phe_response function
|
---|
114 | Float_t peak_time ; // the time from the start of the response function to the maximum peak
|
---|
115 |
|
---|
116 | TH1F *histPmt ;
|
---|
117 | Float_t histMean ; // Mean value of the distribution of Rasmik (stored in histPmt)
|
---|
118 | TRandom *GenElec ; // RandomGenerator for the Electronic Noise
|
---|
119 |
|
---|
120 | Float_t *noise;
|
---|
121 |
|
---|
122 | //
|
---|
123 | // some values for the trigger settings
|
---|
124 | //
|
---|
125 |
|
---|
126 | Float_t *chan_thres ; // the threshold (in mV) for each individuel pixels
|
---|
127 | Float_t gate_leng ; // the length of the digital signal if analog signal is above threshold
|
---|
128 |
|
---|
129 | Float_t overlaping_time; // Minimum coincidence time
|
---|
130 |
|
---|
131 | Float_t trigger_multi ; // Number of Pixels requested for a Trigger
|
---|
132 | Int_t trigger_geometry ; // 0 means a pixel with trigger_multi-1 neighbours
|
---|
133 | // 1 means trigger_multi neighbours
|
---|
134 | // 2 means trigger_multi closed neighbours
|
---|
135 | //
|
---|
136 | // The lookup table for the next neighbours
|
---|
137 | //
|
---|
138 |
|
---|
139 | Int_t *NN[6] ;
|
---|
140 |
|
---|
141 | //
|
---|
142 | // The lookup table for trigger cells
|
---|
143 | //
|
---|
144 |
|
---|
145 | Int_t *TC[TRIGGER_CELLS] ;
|
---|
146 |
|
---|
147 | //
|
---|
148 | // some information about the different TriggerLevels in each Event
|
---|
149 | //
|
---|
150 |
|
---|
151 | Int_t nZero ; // how many ZeroLevel Trigger in one Event
|
---|
152 | Bool_t SlicesZero[TRIGGER_TIME_SLICES] ; // Times Slices at which the ZeroLevel Triggers occur
|
---|
153 |
|
---|
154 | Int_t nFirst ; // how many FirstLevel Trigger in one Event
|
---|
155 | Int_t SlicesFirst[5] ; // Times Slices at which the FirstLevel Triggers occur
|
---|
156 | Int_t PixelsFirst[5] ; // Pixel which fires the trigger
|
---|
157 |
|
---|
158 | Int_t nSecond ; // how many SecondLevel Trigger in one Event
|
---|
159 | Int_t SlicesSecond[5] ; // Times Slices at which the SecondLevel Triggers occur
|
---|
160 | Int_t PixelsSecond[5] ; // Pixel which fires the trigger
|
---|
161 |
|
---|
162 | private:
|
---|
163 |
|
---|
164 | Float_t Fill( Int_t, Float_t, Int_t ) ;
|
---|
165 |
|
---|
166 | Bool_t PassNextNeighbour( Bool_t m[], Bool_t *n) ;
|
---|
167 |
|
---|
168 | void OverlapingTime( Bool_t m[], Bool_t *n, Int_t ifSli); // n[] will have pixels of
|
---|
169 | // m[] that are on for the required verlaping time
|
---|
170 |
|
---|
171 | public:
|
---|
172 |
|
---|
173 | MTrigger(int pix=577) ;
|
---|
174 |
|
---|
175 | MTrigger(int pix, MGeomCam *camgeom,
|
---|
176 | float gate, float overt, float ampl, float fwhm) ;
|
---|
177 |
|
---|
178 | MTrigger(int pix,
|
---|
179 | float gate, float overt, float ampl, float fwhm) ;
|
---|
180 |
|
---|
181 | ~MTrigger() ;
|
---|
182 |
|
---|
183 | void SetSeed(UInt_t seed) {GenElec->SetSeed(seed);}
|
---|
184 |
|
---|
185 | void Reset() ;
|
---|
186 |
|
---|
187 | void ClearZero() ;
|
---|
188 |
|
---|
189 | void ClearFirst() ;
|
---|
190 |
|
---|
191 | Float_t FillShow( Int_t, Float_t ) ;
|
---|
192 |
|
---|
193 | Float_t FillNSB( Int_t, Float_t ) ;
|
---|
194 |
|
---|
195 | Float_t FillStar( Int_t, Float_t ) ;
|
---|
196 |
|
---|
197 | void AddNSB( Int_t pix, Float_t resp[TRIGGER_TIME_SLICES]);
|
---|
198 |
|
---|
199 | void SetElecNoise(Float_t factor=0.3);
|
---|
200 |
|
---|
201 | void ElecNoise(Float_t factor = 0.3) ;
|
---|
202 |
|
---|
203 | void SetResponseShape();
|
---|
204 |
|
---|
205 | void SetMultiplicity (Int_t multi);
|
---|
206 |
|
---|
207 | void SetTopology (Int_t topo);
|
---|
208 |
|
---|
209 | void SetThreshold (Float_t thres[]);
|
---|
210 |
|
---|
211 | void SetFwhm(Float_t fwhm);
|
---|
212 |
|
---|
213 | void SetAmpl(Float_t ampl){
|
---|
214 | ampl_resp=ampl;
|
---|
215 | }
|
---|
216 |
|
---|
217 | void CheckThreshold (float *thres, int cells);
|
---|
218 |
|
---|
219 | void ReadThreshold (char name[]);
|
---|
220 |
|
---|
221 | void ReadParam(char name[]);
|
---|
222 |
|
---|
223 | Float_t GetMultiplicity (){
|
---|
224 | return(trigger_multi);
|
---|
225 | }
|
---|
226 |
|
---|
227 | Int_t GetTopology (){
|
---|
228 | return(trigger_geometry);
|
---|
229 | }
|
---|
230 |
|
---|
231 | Float_t GetThreshold (Int_t il){
|
---|
232 | return(chan_thres[il]);
|
---|
233 | }
|
---|
234 |
|
---|
235 | void GetResponse( Float_t * resp) ;
|
---|
236 |
|
---|
237 | void GetMapDiskriminator(Byte_t *map);
|
---|
238 |
|
---|
239 | void Diskriminate() ;
|
---|
240 |
|
---|
241 | void ShowSignal (MMcEvt *McEvt) ;
|
---|
242 |
|
---|
243 | Int_t ZeroLevel() ;
|
---|
244 |
|
---|
245 | Int_t FirstLevel() ;
|
---|
246 |
|
---|
247 | Float_t GetFirstLevelTime( Int_t il ) ;
|
---|
248 |
|
---|
249 | Int_t GetFirstLevelPixel( Int_t il ) ;
|
---|
250 |
|
---|
251 | Float_t GetAmplitude() {
|
---|
252 | return ampl_resp ;
|
---|
253 | }
|
---|
254 |
|
---|
255 | Float_t GetFwhm() {
|
---|
256 | return fwhm_resp ;
|
---|
257 | }
|
---|
258 |
|
---|
259 | } ;
|
---|
260 |
|
---|
261 | #endif
|
---|
262 |
|
---|