source: trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTrigger.hxx@ 400

Last change on this file since 400 was 393, checked in by blanch, 25 years ago
It owns to MTrigger.cxx version 1.7
File size: 6.2 KB
Line 
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.h"
27
28#include "MTriggerDefine.h"
29
30
31//==========
32// MTrigger
33//
34// The simulation of the Trigger for MonteCarlo Events is using this
35// class. So all methods concerning the trigger should be done inside this
36// class.
37//
38// For a better understanding of the behavior of the trigger is here small
39// abstract of the trigger. This may change in the future.
40//
41//
42// We now from the camera program (This is the surrounding of the class
43// MTrigger.) that one photo electron leaves at time t the photo cathode
44// of the pixel number iPix).
45//
46// At the end of the PMT, the preamp, the optical fiber transmission we
47// get a signal of a given shape. After some discussion with Eckart the
48// standard response function looks like this :
49//
50// It is a gaussian Signal with a given FWHM.
51//
52// So whenever a photo electron leaves the photo cathod, on has to add
53// the standard response function to the analog signal of the pixel.
54//
55// Each pixel of the camera has such an summed-up analog signal. It may
56// look like this picture:
57//
58//
59// This is the input of the discriminator for the pixels. The output of
60// the discriminator is a digital signal. The response of the diskriminator
61// is not fixed at the moment. There are discussion about this topic.
62//
63// At the moment the response is very simple. Whenever the analog signal
64// is crossing a defined threshold from below to above, a digital signal
65// with a given length is created.
66//
67// No one can start with the simulation of different trigger levels.
68//
69// The TriggerLevelZero is a very easy one. It is just looking if there
70// are more then N digital signals at level ON (=1). If this is the case,
71// a TriggerLevelZero signal is created.
72//
73// The TriggerLevelOne is not implemented now. This will be a kind of next
74// neighbour condition (i.e. four neigbouring analog signals at the same
75// time, but this requests at least four digital signals at level ON, what
76// is equivalent with a TriggerLevelZero.
77//
78//
79class MTrigger {
80
81 private:
82 //
83 // then for all pixels the shape of all the analog signals
84 //
85 Bool_t used [TRIGGER_PIXELS] ; // a boolean to indicated if the pixels is used in this event
86 Int_t nphotshow[TRIGGER_PIXELS]; // count the photo electrons per pixel coming from showers
87 Int_t nphotnsb[TRIGGER_PIXELS]; // count the photo electrons per pixel coming from NSB
88 Int_t nphotstar[TRIGGER_PIXELS]; // count the photo electrons per pixel coming from stars
89
90 Float_t *a_sig[TRIGGER_PIXELS] ; // the analog signal for pixels
91
92 Float_t baseline[TRIGGER_PIXELS] ; // for the baseline shift
93
94 //
95 // then for all pixels the shape of the digital signal
96 //
97 Bool_t dknt [TRIGGER_PIXELS] ; // a boolean to indicated if the pixels has passed the diskrminator
98 Float_t *d_sig[TRIGGER_PIXELS] ; // the digital signal for all pixels
99
100 //
101 // and the sum of all digital signals
102 //
103 Float_t sum_d_sig[TRIGGER_TIME_SLICES] ;
104
105 //
106 // first the data for the response function
107 //
108 Float_t fwhm_resp ; // fwhm of the phe_response function
109 Float_t ampl_resp ; // amplitude of the phe_response function (in mV)
110 Float_t sing_resp[ RESPONSE_SLICES ] ; // the shape of the phe_response function
111 Float_t peak_time ; // the time from the start of the response function to the maximum peak
112
113 TH1F *histPmt ;
114 Float_t histMean ; // Mean value of the distribution of Rasmik (stored in histPmt)
115 TRandom *GenElec ; // RandomGenerator for the Electronic Noise
116
117 //
118 // some values for the trigger settings
119 //
120
121 Float_t chan_thres[TRIGGER_PIXELS] ; // the threshold (in mV) for each individuel pixels
122 Float_t gate_leng ; // the length of the digital signal if analog signal is above threshold
123
124 Float_t trigger_multi ; // Number of Pixels requested for a Trigger
125 Int_t trigger_geometry ; // 0 means a pixel with trigger_multi-1 neighbours
126 // 1 means trigger_multi neighbours
127 // 2 means trigger_multi closed neighbours
128 //
129 // The lookup table for the next neighbours
130 //
131
132 Int_t NN[TRIGGER_PIXELS][6] ;
133
134 //
135 // some information about the different TriggerLevels in each Event
136 //
137
138 Int_t nZero ; // how many ZeroLevel Trigger in one Event
139 Bool_t SlicesZero[TRIGGER_TIME_SLICES] ; // Times Slices at which the ZeroLevel Triggers occur
140
141 Int_t nFirst ; // how many FirstLevel Trigger in one Event
142 Int_t SlicesFirst[5] ; // Times Slices at which the FirstLevel Triggers occur
143 Int_t PixelsFirst[5] ; // Pixel which fires the trigger
144
145 Int_t nSecond ; // how many SecondLevel Trigger in one Event
146 Int_t SlicesSecond[5] ; // Times Slices at which the SecondLevel Triggers occur
147 Int_t PixelsSecond[5] ; // Pixel which fires the trigger
148
149private:
150
151 Float_t Fill( Int_t, Float_t, Int_t ) ;
152
153 Bool_t PassNextNeighbour( Bool_t m[], Bool_t *n) ;
154
155public:
156
157 MTrigger() ;
158
159 ~MTrigger() ;
160
161 void Reset() ;
162
163 void ClearZero() ;
164
165 void ClearFirst() ;
166
167 Float_t FillShow( Int_t, Float_t ) ;
168
169 Float_t FillNSB( Int_t, Float_t ) ;
170
171 Float_t FillStar( Int_t, Float_t ) ;
172
173 void ElecNoise() ;
174
175 void SetResponseShape();
176
177 void SetMultiplicity (Int_t multi);
178
179 void SetTopology (Int_t topo);
180
181 void SetThreshold (Float_t thres[]);
182
183 void ReadThreshold (char name[]);
184
185 void ReadParam(char name[]);
186
187 Float_t GetMultiplicity (){
188 return(trigger_multi);
189 }
190
191 Int_t GetTopology (){
192 return(trigger_geometry);
193 }
194
195 Float_t GetThreshold (Int_t il){
196 return(chan_thres[il]);
197 }
198
199 void Diskriminate() ;
200
201 void ShowSignal (MMcEvt *McEvt) ;
202
203 Int_t ZeroLevel() ;
204
205 Int_t FirstLevel() ;
206
207 Float_t GetFirstLevelTime( Int_t il ) ;
208
209 Int_t GetFirstLevelPixel( Int_t il ) ;
210} ;
211
212#endif
213
Note: See TracBrowser for help on using the repository browser.