1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // class MacroCellData |
---|
3 | // these objects are the output from the simulation of a whole |
---|
4 | // macrocell for an event |
---|
5 | // M. Pallavicini - created |
---|
6 | // modified 24/10/2003; trigger implemented as visitor of the class |
---|
7 | // many trigger algorythms handled independently |
---|
8 | // |
---|
9 | |
---|
10 | #ifndef _MACROCELLDATA_HH_ |
---|
11 | #define _MACROCELLDATA_HH_ |
---|
12 | |
---|
13 | #include <map> |
---|
14 | #include <string> |
---|
15 | #include "ChipGtuData.hh" |
---|
16 | |
---|
17 | class ChipGtuData; |
---|
18 | class MacroCellHit; |
---|
19 | class MacroCell; |
---|
20 | |
---|
21 | class MacroCellData |
---|
22 | { |
---|
23 | public: |
---|
24 | |
---|
25 | // ctor |
---|
26 | MacroCellData (MacroCell *); |
---|
27 | |
---|
28 | // dtor |
---|
29 | virtual ~ MacroCellData (); |
---|
30 | |
---|
31 | // add data from front end to macrocell |
---|
32 | void Add (Int_t, ChipGtuData *); |
---|
33 | |
---|
34 | // simulate Macrocell response for a single GTU |
---|
35 | void BuildGtu (Int_t); |
---|
36 | |
---|
37 | // check if two GTUs have contiguous hits |
---|
38 | Bool_t CheckContiguity (Int_t gtu1, Int_t gtu2); |
---|
39 | |
---|
40 | // simulate event response for GTU and trigger |
---|
41 | // many different trigger algorithms are handled as visitors |
---|
42 | void SimulateTrigger (); |
---|
43 | |
---|
44 | // returns true if a trigger occurred |
---|
45 | Bool_t HasTriggered () const |
---|
46 | { |
---|
47 | return (Bool_t) fTriggered; |
---|
48 | } |
---|
49 | |
---|
50 | //comunication LTT third level |
---|
51 | inline void SetLTTTrigger (Int_t val) |
---|
52 | { |
---|
53 | ftest_triggerLTT = val; |
---|
54 | } |
---|
55 | inline Int_t GetLTTTrigger () |
---|
56 | { |
---|
57 | return ftest_triggerLTT; |
---|
58 | } |
---|
59 | |
---|
60 | inline void SetLTTTriggerMaxCounts (Int_t val) |
---|
61 | { |
---|
62 | fup_countsLTT = val; |
---|
63 | } |
---|
64 | inline Int_t GetLTTTriggerMaxCounts () |
---|
65 | { |
---|
66 | return fup_countsLTT; |
---|
67 | } |
---|
68 | |
---|
69 | inline void SetLTTTriggerMaxGtu (Int_t val) |
---|
70 | { |
---|
71 | fGTU_upLTT = val; |
---|
72 | } |
---|
73 | inline Int_t GetLTTTriggerMaxGtu () |
---|
74 | { |
---|
75 | return fGTU_upLTT; |
---|
76 | } |
---|
77 | |
---|
78 | inline void SetLTTTriggerMaxRow (Int_t val) |
---|
79 | { |
---|
80 | frow_upLTT = val; |
---|
81 | } |
---|
82 | inline Int_t GetLTTTriggerMaxRow () |
---|
83 | { |
---|
84 | return frow_upLTT; |
---|
85 | } |
---|
86 | |
---|
87 | inline void SetLTTTriggerMaxCol (Int_t val) |
---|
88 | { |
---|
89 | fcol_upLTT = val; |
---|
90 | } |
---|
91 | inline Int_t GetLTTTriggerMaxCol () |
---|
92 | { |
---|
93 | return fcol_upLTT; |
---|
94 | } |
---|
95 | |
---|
96 | inline void SetLTTTriggerChipID (Int_t val) |
---|
97 | { |
---|
98 | fchip_ID_upLTT = val; |
---|
99 | } |
---|
100 | inline Int_t GetLTTTriggerChipID () |
---|
101 | { |
---|
102 | return fchip_ID_upLTT; |
---|
103 | } |
---|
104 | |
---|
105 | inline void SetLTTTriggerMaxDir (Int_t val) |
---|
106 | { |
---|
107 | fdir_upLTT = val; |
---|
108 | } |
---|
109 | inline Int_t GetLTTTriggerMaxDir () |
---|
110 | { |
---|
111 | return fdir_upLTT; |
---|
112 | } |
---|
113 | |
---|
114 | inline void SetLTTTriggerPdmID (Int_t val) |
---|
115 | { |
---|
116 | fPdmID_LTT = val; |
---|
117 | } |
---|
118 | inline Int_t GetLTTTriggerPdmID () |
---|
119 | { |
---|
120 | return fPdmID_LTT; |
---|
121 | } |
---|
122 | |
---|
123 | //comunication PTT third level |
---|
124 | inline void SetPTTTrigger (Int_t val) |
---|
125 | { |
---|
126 | ftest_triggerPTT = val; |
---|
127 | } |
---|
128 | inline Int_t GetPTTTrigger () |
---|
129 | { |
---|
130 | return ftest_triggerPTT; |
---|
131 | } |
---|
132 | |
---|
133 | inline void SetPTTTriggerMaxCounts (Int_t val) |
---|
134 | { |
---|
135 | fup_countsPTT = val; |
---|
136 | } |
---|
137 | inline Int_t GetPTTTriggerMaxCounts () |
---|
138 | { |
---|
139 | return fup_countsPTT; |
---|
140 | } |
---|
141 | |
---|
142 | inline void SetPTTTriggerMaxGtu (Int_t val) |
---|
143 | { |
---|
144 | fGTU_upPTT = val; |
---|
145 | } |
---|
146 | inline Int_t GetPTTTriggerMaxGtu () |
---|
147 | { |
---|
148 | return fGTU_upPTT; |
---|
149 | } |
---|
150 | |
---|
151 | inline void SetPTTTriggerMaxRow (Int_t val) |
---|
152 | { |
---|
153 | frow_upPTT = val; |
---|
154 | } |
---|
155 | inline Int_t GetPTTTriggerMaxRow () |
---|
156 | { |
---|
157 | return frow_upPTT; |
---|
158 | } |
---|
159 | |
---|
160 | inline void SetPTTTriggerMaxCol (Int_t val) |
---|
161 | { |
---|
162 | fcol_upPTT = val; |
---|
163 | } |
---|
164 | inline Int_t GetPTTTriggerMaxCol () |
---|
165 | { |
---|
166 | return fcol_upPTT; |
---|
167 | } |
---|
168 | |
---|
169 | inline void SetPTTTriggerChipID (Int_t val) |
---|
170 | { |
---|
171 | fchip_ID_upPTT = val; |
---|
172 | } |
---|
173 | inline Int_t GetPTTTriggerChipID () |
---|
174 | { |
---|
175 | return fchip_ID_upPTT; |
---|
176 | } |
---|
177 | |
---|
178 | inline void SetPTTTriggerPdmID(Int_t val) |
---|
179 | { |
---|
180 | fPdmID_PTT = val; |
---|
181 | } |
---|
182 | |
---|
183 | inline Int_t GetPTTTriggerPdmID() |
---|
184 | { |
---|
185 | return fPdmID_PTT; |
---|
186 | } |
---|
187 | |
---|
188 | |
---|
189 | inline void SetCCB_LTTTrigger (Int_t val) |
---|
190 | { |
---|
191 | ftest_triggerCCB_LTT = val; |
---|
192 | } |
---|
193 | inline Int_t GetCCB_LTTTrigger () |
---|
194 | { |
---|
195 | return ftest_triggerCCB_LTT; |
---|
196 | } |
---|
197 | |
---|
198 | inline void SetCCB_LTTTriggerMaxCounts (Int_t val) |
---|
199 | { |
---|
200 | fup_countsCCB_LTT = val; |
---|
201 | } |
---|
202 | inline Int_t GetCCB_LTTTriggerMaxCounts () |
---|
203 | { |
---|
204 | return fup_countsCCB_LTT; |
---|
205 | } |
---|
206 | |
---|
207 | inline void SetCCB_LTTTriggerMaxGtu (Int_t val) |
---|
208 | { |
---|
209 | fGTU_upCCB_LTT = val; |
---|
210 | } |
---|
211 | inline Int_t GetCCB_LTTTriggerMaxGtu () |
---|
212 | { |
---|
213 | return fGTU_upCCB_LTT; |
---|
214 | } |
---|
215 | |
---|
216 | inline void SetCCB_LTTTriggerMaxRow (Int_t val) |
---|
217 | { |
---|
218 | frow_upCCB_LTT = val; |
---|
219 | } |
---|
220 | inline Int_t GetCCB_LTTTriggerMaxRow () |
---|
221 | { |
---|
222 | return frow_upCCB_LTT; |
---|
223 | } |
---|
224 | |
---|
225 | inline void SetCCB_LTTTriggerMaxCol (Int_t val) |
---|
226 | { |
---|
227 | fcol_upCCB_LTT = val; |
---|
228 | } |
---|
229 | inline Int_t GetCCB_LTTTriggerMaxCol () |
---|
230 | { |
---|
231 | return fcol_upCCB_LTT; |
---|
232 | } |
---|
233 | |
---|
234 | inline void SetCCB_LTTTriggerChipID (Int_t val) |
---|
235 | { |
---|
236 | fchip_ID_upCCB_LTT = val; |
---|
237 | } |
---|
238 | inline Int_t GetCCB_LTTTriggerChipID () |
---|
239 | { |
---|
240 | return fchip_ID_upCCB_LTT; |
---|
241 | } |
---|
242 | |
---|
243 | inline void SetCCB_LTTTriggerMaxDir (Int_t val) |
---|
244 | { |
---|
245 | fdir_upCCB_LTT = val; |
---|
246 | } |
---|
247 | inline Int_t GetCCB_LTTTriggerMaxDir () |
---|
248 | { |
---|
249 | return fdir_upCCB_LTT; |
---|
250 | } |
---|
251 | |
---|
252 | inline void SetCCB_LTTTriggerPdmID (Int_t val) |
---|
253 | { |
---|
254 | fPdmID_CCB_LTT = val; |
---|
255 | } |
---|
256 | |
---|
257 | inline Int_t GetCCB_LTTTriggerPdmID () |
---|
258 | { |
---|
259 | return fPdmID_CCB_LTT; |
---|
260 | } |
---|
261 | |
---|
262 | |
---|
263 | |
---|
264 | // pointer to parent MacroCell |
---|
265 | inline MacroCell *Cell () |
---|
266 | { |
---|
267 | return pCell; |
---|
268 | } |
---|
269 | |
---|
270 | // is there any data ? |
---|
271 | inline Bool_t IsEmpty () const |
---|
272 | { |
---|
273 | return fEmpty; |
---|
274 | } |
---|
275 | inline void SetEmpty (Bool_t val = kTRUE) |
---|
276 | { |
---|
277 | fEmpty = val; |
---|
278 | } |
---|
279 | |
---|
280 | // infos about GTUs |
---|
281 | inline Int_t GtuStart () const |
---|
282 | { |
---|
283 | return fGtuStart; |
---|
284 | } |
---|
285 | inline Int_t GtuEnd () const |
---|
286 | { |
---|
287 | return fGtuEnd; |
---|
288 | } |
---|
289 | inline Int_t GtuTrigger () const |
---|
290 | { |
---|
291 | return fGtuTrigger; |
---|
292 | } |
---|
293 | inline Int_t NGtus () const |
---|
294 | { |
---|
295 | return fNumActiveGtus; |
---|
296 | } |
---|
297 | |
---|
298 | // time in ns of the first edge of the first GTU for this event |
---|
299 | // the time is measured from the Photons time |
---|
300 | Double_t GtuTimeStart (); |
---|
301 | |
---|
302 | // same for second edge of last GTU |
---|
303 | Double_t GtuTimeEnd (); |
---|
304 | |
---|
305 | // return vector of hits for one gtu; no checks on boundaries |
---|
306 | vector < MacroCellHit * >*Hits (Int_t gtu) |
---|
307 | { |
---|
308 | return fData[gtu]; |
---|
309 | } |
---|
310 | |
---|
311 | // return point to hit iH for gtu iGtu; no checks on boundaries |
---|
312 | MacroCellHit *Hit (Int_t iGtu, Int_t iHit) |
---|
313 | { |
---|
314 | return ((*fData[iGtu])[iHit]); |
---|
315 | } |
---|
316 | |
---|
317 | // returns total number of MacroCellHit objects |
---|
318 | Int_t NumMacroCellHits (); |
---|
319 | |
---|
320 | // returns the chipgtudata of a chip in a given gtu |
---|
321 | ChipGtuData *GetChipGtuData (Int_t chip, Int_t gtu); |
---|
322 | |
---|
323 | // dump some data on string |
---|
324 | string & Dump (); |
---|
325 | |
---|
326 | virtual Bool_t ClearMemory (); |
---|
327 | // physically release the memory allocated by the arrays of this object |
---|
328 | private: |
---|
329 | |
---|
330 | MacroCell * pCell; // parent macrocell |
---|
331 | |
---|
332 | string text_dump; // string used for dump |
---|
333 | Int_t fup_countsLTT,fGTU_upLTT,frow_upLTT,fcol_upLTT,fchip_ID_upLTT,fdir_upLTT,fPdmID_LTT; |
---|
334 | Int_t fup_countsPTT,fGTU_upPTT,frow_upPTT,fcol_upPTT,fchip_ID_upPTT,fdir_upPTT,fPdmID_PTT; |
---|
335 | Int_t fup_countsCCB_LTT,fGTU_upCCB_LTT,frow_upCCB_LTT,fcol_upCCB_LTT,fchip_ID_upCCB_LTT,fdir_upCCB_LTT,fPdmID_CCB_LTT; |
---|
336 | Int_t ftest_triggerLTT,ftest_triggerPTT,ftest_triggerCCB_LTT; |
---|
337 | Int_t fGtuStart; // first GTU in which there was activity |
---|
338 | Int_t fGtuEnd; // last GTU in which there was activity |
---|
339 | Int_t fGtuTrigger; // GTU in which there was trigger |
---|
340 | Bool_t fTriggered; // True if macrocell was trigged |
---|
341 | Int_t fNumActiveGtus; // number of GTUs in which there was activity |
---|
342 | |
---|
343 | // map of vectors of objects from chips (first index GTU) |
---|
344 | map < Int_t, vector < ChipGtuData * >*>fChipData; |
---|
345 | |
---|
346 | // same as before where first map key is front end chip id and second gtu |
---|
347 | map < Int_t, map < Int_t, ChipGtuData * >*>fChipData2; |
---|
348 | |
---|
349 | // map of vectors of macrocell hits (first index GTU) |
---|
350 | map < Int_t, vector < MacroCellHit * >*>fData; |
---|
351 | |
---|
352 | // true if no data are available |
---|
353 | Bool_t fEmpty; |
---|
354 | |
---|
355 | // set gtu at which trigger occurred |
---|
356 | inline void SetGtuTrigger (Int_t gtu) |
---|
357 | { |
---|
358 | // Save trigger time. If time was earlier than |
---|
359 | // a previous trigger, overwrite it. |
---|
360 | if ((gtu < fGtuTrigger) || !fTriggered){ |
---|
361 | fGtuTrigger = gtu; |
---|
362 | fTriggered = true; |
---|
363 | } |
---|
364 | } |
---|
365 | |
---|
366 | ClassDef (MacroCellData, 0) friend class ChipTrackingTrgEngine; |
---|
367 | friend class ChipTrackingTrgEngine0; |
---|
368 | friend class ChipTrackingTrgEngine1; |
---|
369 | friend class ChipTrackingTrgEngine2; |
---|
370 | friend class ChipTrackingTrgEngine3; |
---|
371 | friend class ChipTrackingTrgEngine4; |
---|
372 | friend class LblChipTrackingTrgEngine; |
---|
373 | friend class SignalChipTrackingTrgEngine; |
---|
374 | friend class PTTTrigger; |
---|
375 | friend class LTTTrigger; |
---|
376 | friend class CCB_LTTTrigger; |
---|
377 | }; |
---|
378 | |
---|
379 | #endif |
---|