source: trunk/FACT++/src/EventBuilderWrapper.h@ 17299

Last change on this file since 17299 was 17272, checked in by tbretz, 11 years ago
Added night to the end of the DRS_RUNS service.
File size: 45.8 KB
Line 
1#ifndef FACT_EventBuilderWrapper
2#define FACT_EventBuilderWrapper
3
4#include <sstream>
5
6#if BOOST_VERSION < 104400
7#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))
8#undef BOOST_HAS_RVALUE_REFS
9#endif
10#endif
11#include <boost/thread.hpp>
12#include <boost/filesystem.hpp>
13#include <boost/date_time/posix_time/posix_time_types.hpp>
14
15#include "DimWriteStatistics.h"
16
17#include "DataCalib.h"
18#include "DataWriteRaw.h"
19
20#ifdef HAVE_FITS
21#include "DataWriteFits.h"
22#else
23#define DataWriteFits DataWriteFits2
24#endif
25
26#include "DataWriteFits2.h"
27
28namespace ba = boost::asio;
29namespace bs = boost::system;
30namespace fs = boost::filesystem;
31
32using ba::ip::tcp;
33
34using namespace std;
35
36// ========================================================================
37
38#include "EventBuilder.h"
39
40void StartEvtBuild();
41void CloseRunFile();
42
43// ========================================================================
44
45class EventBuilderWrapper
46{
47public:
48 // FIXME
49 static EventBuilderWrapper *This;
50
51 MessageImp &fMsg;
52
53private:
54 boost::thread fThreadMain;
55
56 enum
57 {
58 kCurrent = 0,
59 kTotal = 1,
60 kEventId = 2,
61 kTriggerId = 3,
62 };
63
64 FAD::FileFormat_t fFileFormat;
65
66 //uint32_t fMaxRun;
67 uint32_t fLastOpened;
68 uint32_t fLastClosed;
69 array<uint32_t,4> fNumEvts;
70
71 DimWriteStatistics fDimWriteStats;
72 DimDescribedService fDimRuns;
73 DimDescribedService fDimEvents;
74 DimDescribedService fDimRawData;
75 DimDescribedService fDimEventData;
76 DimDescribedService fDimFeedbackData;
77 DimDescribedService fDimFwVersion;
78 DimDescribedService fDimRunNumber;
79 DimDescribedService fDimStatus;
80 DimDescribedService fDimDNA;
81 DimDescribedService fDimTemperature;
82 DimDescribedService fDimPrescaler;
83 DimDescribedService fDimRefClock;
84 DimDescribedService fDimRoi;
85 DimDescribedService fDimDac;
86 DimDescribedService fDimDrsRuns;
87 DimDescribedService fDimDrsCalibration;
88 DimDescribedService fDimStatistics1;
89 //DimDescribedService fDimStatistics2;
90 DimDescribedService fDimFileFormat;
91 DimDescribedService fDimIncomplete;
92
93 Queue<pair<Time,GUI_STAT>> fQueueStatistics1;
94 Queue<tuple<Time,bool,FAD::EventHeader>> fQueueProcHeader;
95 Queue<pair<Time,array<uint32_t,4>>> fQueueEvents;
96 Queue<pair<Time,array<uint16_t,2>>> fQueueRoi;
97 Queue<vector<char>> fQueueRawData;
98 Queue<tuple<Time,uint32_t,array<float,1440*4>>> fQueueEventData;
99 Queue<tuple<Time, array<uint32_t,40>, array<int16_t,160>>> fQueueTempRefClk;
100
101 string fPath;
102 uint32_t fNightAsInt;
103 uint32_t fRunNumber;
104 int64_t fRunInProgress;
105
106 array<uint16_t,2> fVecRoi;
107 pair<float,array<float, 1440*4>> fMaxEvent; // Maximum event from applyCalib
108
109protected:
110 bool InitRunNumber(const string &path="")
111 {
112 if (!path.empty())
113 {
114 if (!DimWriteStatistics::DoesPathExist(path, fMsg))
115 {
116 fMsg.Error("Data path "+path+" does not exist!");
117 return false;
118 }
119
120 fPath = path;
121 fDimWriteStats.SetCurrentFolder(fPath);
122
123 fMsg.Info("Data path set to "+path+".");
124 }
125
126 // Get current night
127 const Time now;
128
129 const uint32_t night = now.NightAsInt();
130 if (night==fNightAsInt)
131 return true;
132
133 if (night<fNightAsInt)
134 {
135 fMsg.Warn("New night "+to_string(night)+" ["+now.GetAsStr()+"] before current night "+to_string(night)+"... keeping old one.");
136 fMsg.Warn("Please check the system clock.");
137 return true;
138 }
139
140 // Check for run numbers
141 fRunNumber = 1000;
142
143 while (--fRunNumber>0)
144 {
145 const string name = DataProcessorImp::FormFileName(fPath, night, fRunNumber, "");
146
147 if (access((name+"bin").c_str(), F_OK) == 0)
148 break;
149 if (access((name+"fits").c_str(), F_OK) == 0)
150 break;
151 if (access((name+"fits.fz").c_str(), F_OK) == 0)
152 break;
153 if (access((name+"fits.gz").c_str(), F_OK) == 0)
154 break;
155 if (access((name+"drs.fits").c_str(), F_OK) == 0)
156 break;
157 }
158
159 // This is now the first file which does not exist
160 fRunNumber++;
161 fLastOpened = 0;
162
163 // Check if we have exceeded the maximum
164 if (fRunNumber==1000)
165 {
166 fMsg.Error("You have a file with run-number 1000 in "+fPath+" ["+to_string(night)+"]");
167 return false;
168 }
169
170 ostringstream str;
171 if (fNightAsInt==0)
172 str << "First night...";
173 else
174 str << "Night has changed from " << fNightAsInt << " [" << now << "]... ";
175 str << " next run-number is " << night << "-" << setfill('0') << setw(3) << fRunNumber << " [" << (fPath.empty()?".":fPath) << "]";
176 fMsg.Message(str);
177
178 fNightAsInt = night;
179
180 return true;
181 }
182
183public:
184 EventBuilderWrapper(MessageImp &imp) : fMsg(imp),
185 fFileFormat(FAD::kNone), /*fMaxRun(0),*/ fLastOpened(0), fLastClosed(0),
186 fDimWriteStats ("FAD_CONTROL", imp),
187 fDimRuns ("FAD_CONTROL/RUNS", "I:2;C",
188 "Run files statistics"
189 "|stats[int]:last opened or closed run"
190 "|file[string]:filename of last opened file"),
191 fDimEvents ("FAD_CONTROL/EVENTS", "I:4",
192 "Event counts"
193 "|evtsCount[int]:Num evts cur. run, total (all run), evt ID, trig. Num"),
194 fDimRawData ("FAD_CONTROL/RAW_DATA", "S:1;S:1;I:1;I:1;S:1;I:1;I:2;I:40;S:1440;S:160;F",
195 "|roi[uint16]:number of samples per pixel"
196 "|roi_tm[uint16]:number of samples per time-marker channel"
197 "|num_fad[uint32]:event number from FADs"
198 "|num_ftm[uint32]:trigger number from FTM"
199 "|type[uint16]:trigger type from FTM"
200 "|num_boards[uint32]:number of active boards"
201 "|time[uint32]:PC time as unix time stamp"
202 "|time_board[uint32]:Time stamp of FAD boards"
203 "|start_pix[int16]:start sample of pixels"
204 "|start_tm[int16]:start sample of time marker channels"
205 "|adc[int16]:adc data"),
206 fDimEventData ("FAD_CONTROL/EVENT_DATA", "F:1440;F:1440;F:1440;F:1440", "|avg:|rms:|max:|pos"),
207 fDimFeedbackData("FAD_CONTROL/FEEDBACK_DATA", "F:1440", ""),
208 fDimFwVersion ("FAD_CONTROL/FIRMWARE_VERSION", "F:42",
209 "Firmware version number of fad boards"
210 "|firmware[float]:Version number of firmware, for each board. 40=min, 41=max"),
211 fDimRunNumber ("FAD_CONTROL/RUN_NUMBER", "I:42",
212 "Run numbers coming from FAD boards"
213 "|runNumbers[int]:current run number of each FAD board. 40=min, 41=max"),
214 fDimStatus ("FAD_CONTROL/STATUS", "S:42",
215 "Status of FAD boards"
216 "|status[bitpattern]:Status of each FAD board. Maybe buggy"),
217 fDimDNA ("FAD_CONTROL/DNA", "X:40",
218 "DNA of FAD boards"
219 "|DNA[hex]:Hex identifier of each FAD board"),
220 fDimTemperature ("FAD_CONTROL/TEMPERATURE", "S:1;F:160",
221 "DRS temperatures"
222 "|cnt[uint16]:Counter of averaged values"
223 "|temp[deg C]:average temp of all DRS chips"),
224 fDimPrescaler ("FAD_CONTROL/PRESCALER", "S:42",
225 "Trigger generator prescaler of fad boards"
226 "|prescaler[int]:Trigger generator prescaler value, for each board"),
227 fDimRefClock ("FAD_CONTROL/REFERENCE_CLOCK", "S:1;F:40",
228 "Reference clock of FAD boards"
229 "|cnt[uint16]:Counter of averaged values"
230 "|clk[Hz]:Averaged clock of ref clocks of FAD boards"),
231 fDimRoi ("FAD_CONTROL/REGION_OF_INTEREST", "S:2", "roi:|roi_rm:"),
232 fDimDac ("FAD_CONTROL/DAC", "S:336",
233 "DAC settings of each FAD board"
234 "|DAC[int]:DAC counts, sequentially DAC 0 board 0, 0/1, 0/2... (plus min max)"),
235 fDimDrsRuns ("FAD_CONTROL/DRS_RUNS", "I:1;I:3;I:1",
236 "|roi:Region of interest of secondary baseline"
237 "|run:Run numbers of DRS runs (0=none)"
238 "|night:Night as int of the first run (0 if none)"),
239 fDimDrsCalibration("FAD_CONTROL/DRS_CALIBRATION", "I:1;I:3;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:163840;F:163840",
240 "|roi:Region of interest of secondary baseline"
241 "|run:Run numbers of DRS runs (0=none)"),
242 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:5;X:3;I:1;I:2;C:40;I:40;I:40",
243 "Event Builder status for GUI display"
244 "|bufferInfo[int]:Events in buffer, incomp., comp., write, proc., tot."
245 "|memInfo[int]:total mem allocated, used mem, max memory"
246 "|deltaT[ms]:Time in ms for rates"
247 "|rateNew[int]:Number of new start events received"
248 "|numConn[int]:Number of connections per board"
249 "|rateBytes[int]:Bytes read during last cylce"
250 "|relBytes[int]:Relative number of total bytes received (received - released)"),
251 fDimFileFormat("FAD_CONTROL/FILE_FORMAT", "S:1", "|format[int]:Current file format"),
252 fDimIncomplete("FAD_CONTROL/INCOMPLETE", "X:1", "|incomplete[bits]:One bit per board"),
253 // It is important to instantiate them after the DimServices
254 fQueueStatistics1(std::bind(&EventBuilderWrapper::UpdateDimStatistics1, this, placeholders::_1)),
255 fQueueProcHeader( std::bind(&EventBuilderWrapper::procHeader, this, placeholders::_1)),
256 fQueueEvents( std::bind(&EventBuilderWrapper::UpdateDimEvents, this, placeholders::_1)),
257 fQueueRoi( std::bind(&EventBuilderWrapper::UpdateDimRoi, this, placeholders::_1)),
258 fQueueRawData( std::bind(&EventBuilderWrapper::UpdateDimRawData, this, placeholders::_1)),
259 fQueueEventData( std::bind(&EventBuilderWrapper::UpdateDimEventData, this, placeholders::_1)),
260 fQueueTempRefClk( std::bind(&EventBuilderWrapper::UpdateDimTempRefClk, this, placeholders::_1)),
261 fNightAsInt(0), fRunInProgress(-1),
262 fMaxEvent(make_pair(-FLT_MAX, array<float,1440*4>()))
263 {
264 if (This)
265 throw logic_error("EventBuilderWrapper cannot be instantiated twice.");
266
267 This = this;
268
269 fVecRoi.fill(0);
270
271 memset(fNumEvts.data(), 0, sizeof(fNumEvts));
272 fDimEvents.Update(fNumEvts);
273
274 for (size_t i=0; i<40; i++)
275 ConnectSlot(i, tcp::endpoint());
276 }
277
278 virtual ~EventBuilderWrapper()
279 {
280 Abort();
281
282 // FIXME: Used timed_join and abort afterwards
283 // What's the maximum time the eb need to abort?
284 fThreadMain.join();
285 }
286
287 map<uint32_t, FAD::RunDescription> fExpectedRuns;
288
289 mutex mtx_newrun;
290
291 uint32_t StartNewRun(int64_t maxtime, int64_t maxevt, const pair<string, FAD::Configuration> &ref)
292 {
293 if (maxtime<=0 || maxtime>24*60*60)
294 maxtime = 24*60*60;
295 if (maxevt<=0 || maxevt>INT32_MAX)
296 maxevt = INT32_MAX;
297
298 if (!InitRunNumber())
299 return 0;
300
301 const FAD::RunDescription descr =
302 {
303 uint32_t(maxtime),
304 uint32_t(maxevt),
305 fNightAsInt,
306 ref.first,
307 ref.second,
308 };
309
310 const lock_guard<mutex> lock(mtx_newrun);
311 fExpectedRuns[fRunNumber] = descr;
312 return fRunNumber++;
313 }
314
315 bool IsThreadRunning()
316 {
317 if (fThreadMain.get_id()==boost::this_thread::get_id())
318 return true;
319 return !fThreadMain.timed_join(boost::posix_time::microseconds(0));
320 }
321
322 void SetMaxMemory(unsigned int mb) const
323 {
324 g_maxMem = size_t(mb)*1000000;
325 }
326 void SetEventTimeout(uint16_t to) const
327 {
328 g_evtTimeout = to;
329 }
330
331 void StartThread(const vector<tcp::endpoint> &addr)
332 {
333 if (IsThreadRunning())
334 {
335 fMsg.Warn("Start - EventBuilder still running");
336 return;
337 }
338
339 //fLastMessage.clear();
340
341 for (size_t i=0; i<40; i++)
342 ConnectSlot(i, addr[i]);
343
344 fMsg.Message("Starting EventBuilder thread");
345
346 fThreadMain = boost::thread(StartEvtBuild);
347 }
348
349 void ConnectSlot(unsigned int i, const tcp::endpoint &addr)
350 {
351 if (i>39)
352 return;
353
354 fRunInProgress = -1;
355
356 if (addr==tcp::endpoint())
357 {
358 // In this order
359 g_port[i].sockDef = 0;
360
361 fDimIncomplete.setQuality(0);
362 fDimIncomplete.Update(uint64_t(0));
363 return;
364 }
365
366 struct sockaddr_in sockaddr; //IP for each socket
367 sockaddr.sin_family = AF_INET;
368 sockaddr.sin_addr.s_addr = htonl(addr.address().to_v4().to_ulong());
369 sockaddr.sin_port = htons(addr.port());
370 memcpy(&g_port[i].sockAddr, &sockaddr, sizeof(struct sockaddr_in));
371
372 // In this order
373 g_port[i].sockDef = 1;
374
375 fDimIncomplete.setQuality(0);
376 fDimIncomplete.Update(uint64_t(0));
377 }
378
379 void IgnoreSlot(unsigned int i)
380 {
381 if (i>39)
382 return;
383
384 if (g_port[i].sockAddr.sin_port==0)
385 return;
386
387 g_port[i].sockDef = -1;
388 }
389
390
391 void Abort()
392 {
393 fMsg.Message("Signal abort to EventBuilder thread...");
394 g_reset = 2;
395 }
396
397 void ResetThread(bool soft)
398 {
399 fMsg.Message("Signal reset to EventBuilder thread...");
400 g_reset = soft ? 101 : 102;
401 }
402
403 void Exit()
404 {
405 fMsg.Message("Signal exit to EventBuilder thread...");
406 g_reset = 1;
407 }
408
409 bool IsConnected(int i) const { return gi_NumConnect[i]==1; }
410 bool IsConnecting(int i) const { return gi_NumConnect[i]==0 && g_port[i].sockDef!=0; }
411 bool IsDisconnected(int i) const { return gi_NumConnect[i]==0 && g_port[i].sockDef==0; }
412 bool IsRunInProgress() const { return fRunInProgress>=0; }
413
414 void SetIgnore(int i, bool b) const { if (g_port[i].sockDef!=0) g_port[i].sockDef=b?-1:1; }
415 bool IsIgnored(int i) const { return g_port[i].sockDef==-1; }
416
417 void SetOutputFormat(FAD::FileFormat_t f)
418 {
419 const bool changed = f!=fFileFormat;
420
421 fFileFormat = f;
422 fDimFileFormat.Update(uint16_t(f));
423
424 string msg = "File format set to: ";
425 switch (f)
426 {
427 case FAD::kNone: msg += "kNone."; break;
428 case FAD::kDebug: msg += "kDebug."; break;
429 case FAD::kFits: msg += "kFits."; break;
430 case FAD::kZFits: msg += "kZFits."; break;
431 case FAD::kCfitsio: msg += "kCfitsio"; break;
432 case FAD::kRaw: msg += "kRaw"; break;
433 case FAD::kCalib:
434 DataCalib::Restart();
435 DataCalib::Update(fDimDrsCalibration, fDimDrsRuns);
436 fMsg.Message("Resetted DRS calibration.");
437 return;
438 }
439
440 if (changed)
441 fMsg.Message(msg);
442 }
443
444 virtual int ResetSecondaryDrsBaseline()
445 {
446 if (DataCalib::ResetTrgOff(fDimDrsCalibration, fDimDrsRuns))
447 {
448 fFileFormat = FAD::kCalib;
449 fDimFileFormat.Update(uint16_t(fFileFormat));
450 fMsg.Message("Resetted DRS calibration for secondary baseline.");
451 }
452 else
453 fMsg.Warn("Could not reset DRS calibration of secondary baseline.");
454
455 return 0;
456 }
457
458 void LoadDrsCalibration(const char *fname)
459 {
460 if (!DataCalib::ReadFits(fname, fMsg))
461 return;
462
463 fMsg.Info("Successfully loaded DRS calibration from "+string(fname));
464 DataCalib::Update(fDimDrsCalibration, fDimDrsRuns);
465 }
466
467 virtual int CloseOpenFiles() { CloseRunFile(); fRunInProgress = -1; return 0; }
468
469
470 // -------------- Mapped event builder callbacks ------------------
471
472 void UpdateRuns(const string &fname="")
473 {
474 uint32_t values[2] =
475 {
476 fLastOpened,
477 fLastClosed
478 };
479
480 vector<char> data(sizeof(values)+fname.size()+1);
481 memcpy(data.data(), values, sizeof(values));
482 strcpy(data.data()+sizeof(values), fname.c_str());
483 fDimRuns.setQuality((bool)fFile);
484 fDimRuns.Update(data);
485
486 if (!fname.empty())
487 fDimWriteStats.FileOpened(fname);
488 }
489
490 shared_ptr<DataProcessorImp> fFile;
491
492 bool UpdateDimEvents(const pair<Time,array<uint32_t,4>> &stat)
493 {
494 fDimEvents.setData(stat.second.data(), sizeof(uint32_t)*4);
495 fDimEvents.Update(stat.first);
496 return true;
497 }
498
499 bool runOpen(const EVT_CTRL2 &evt)
500 {
501 const uint32_t night = evt.runCtrl->night;
502 const uint32_t runid = evt.runNum>0 ? evt.runNum : time(NULL);
503
504 // If there is still an open file: close it
505 if (fFile)
506 runClose(*evt.runCtrl);
507
508 // Keep a copy of the currently valid drs calibration
509 // and associate it to the run control structure
510 evt.runCtrl->calib = make_shared<DrsCalibration>(DataCalib::GetCalibration());
511
512 // Crate the file
513 DataProcessorImp *file = 0;
514 switch (fFileFormat)
515 {
516 case FAD::kNone: file = new DataDump(fPath, night, runid, fMsg); break;
517 case FAD::kDebug: file = new DataDebug(fPath, night, runid, fMsg); break;
518 case FAD::kCfitsio: file = new DataWriteFits(fPath, night, runid, fMsg); break;
519 case FAD::kFits: file = new DataWriteFits2(fPath, night, runid, fMsg); break;
520 case FAD::kZFits: file = new DataWriteFits2(fPath, night, runid, *evt.runCtrl->calib, fMsg); break;
521 case FAD::kRaw: file = new DataWriteRaw(fPath, night, runid, fMsg); break;
522 case FAD::kCalib: file = new DataCalib(fPath, night, runid, *evt.runCtrl->calib, fDimDrsCalibration, fDimDrsRuns, fMsg); break;
523 }
524
525 try
526 {
527 // Try to open the file
528 FAD::RunDescription desc;
529 desc.name = evt.runCtrl->runType;
530
531 if (!file->Open(evt, desc))
532 return false;
533 }
534 catch (const exception &e)
535 {
536 fMsg.Error("Exception trying to open file: "+string(e.what()));
537 return false;
538 }
539
540 fLastOpened = runid;
541
542 // Signal that a file is open
543 fFile = shared_ptr<DataProcessorImp>(file);
544
545 // Now do all the calls which potentially block (dim)
546
547 // Time for update runs before time for update events
548 UpdateRuns(file->GetFileName());
549 fNumEvts[kEventId] = 0;
550 fNumEvts[kTriggerId] = 0;
551 fNumEvts[kCurrent] = 0;
552 fQueueEvents.emplace(Time(), fNumEvts);
553
554 ostringstream str;
555 str << "Opened: " << file->GetFileName() << " (" << file->GetRunId() << ")";
556 fMsg.Info(str);
557
558 return true;
559 }
560
561 bool runWrite(const EVT_CTRL2 &e)
562 {
563 /*
564 const size_t size = sizeof(EVENT)+1440*(evt.Roi+evt.RoiTM)*2;
565 vector evt(e.fEvent, e.fEvent+size);
566
567 const EVENT &evt = *reinterpret_cast<EVENT*>(evt.data());
568
569 int16_t *val = evt.Adc_Data;
570 const int16_t *off = e.runCtrl->zcalib.data();
571 for (const int16_t *start=evt.StartPix; start<evt.StartPix+1440; val+=1024, off+=1024, start++)
572 {
573 if (*start<0)
574 continue;
575
576 for (size_t i=0; i<roi; i++)
577 val[i] -= offset[(*start+i)%1024];
578 }*/
579
580 const EVENT &evt = *e.fEvent;
581 if (!fFile->WriteEvt(evt))
582 return false;
583
584 fNumEvts[kCurrent]++;
585 fNumEvts[kEventId] = evt.EventNum;
586 fNumEvts[kTriggerId] = evt.TriggerNum;
587 fNumEvts[kTotal]++;
588
589 static Time oldt(boost::date_time::neg_infin);
590 Time newt;
591 if (newt>oldt+boost::posix_time::seconds(1))
592 {
593 fQueueEvents.emplace(newt, fNumEvts);
594 oldt = newt;
595 }
596
597 return true;
598 }
599
600 void runClose(RUN_CTRL2 &run)
601 {
602 if (!fFile)
603 return;
604
605 // It can happen that runFinished was never called
606 // (e.g. runWrite failed)
607 if (fRunInProgress==fFile->GetRunId())
608 fRunInProgress = -1;
609
610 // Close the file
611 const bool rc = fFile->Close(NULL);
612
613 fLastClosed = fFile->GetRunId();
614
615 ostringstream str;
616 str << "Closed: " << fFile->GetFileName() << " (" << fFile->GetRunId() << ")";
617 if (!rc)
618 str << "... failed!";
619
620 // Signal that the file is closed
621
622 fFile.reset();
623
624 // Now do all the calls which can potentially block (dim)
625
626 CloseRun(fLastClosed);
627
628 // Time for update events before time for update runs
629 fQueueEvents.emplace(Time(), fNumEvts);
630 UpdateRuns();
631
632 // Do the potentially blocking call after all others
633 rc ? fMsg.Info(str) : fMsg.Error(str);
634
635 // If a Drs Calibration has just been finished, all following events
636 // should also be processed with this calibration.
637 // Note that this is a generally dangerous operation. Here, the previous
638 // DRS calibration shared_ptr gets freed and if it is the last in use,
639 // the memory will vanish. If another thread accesses that pointer,
640 // it _must_ make a copy of the shared_ptr first to ensure that
641 // the memory will stay in scope until the end of its operation.
642 const DrsCalibration &cal = DataCalib::GetCalibration();
643 if (!run.calib || run.calib->fStep != cal.fStep || run.calib->fRoi!=cal.fRoi)
644 run.calib = make_shared<DrsCalibration>(cal);
645 }
646
647 virtual void CloseRun(uint32_t /*runid*/) { }
648
649 bool UpdateDimRoi(const pair<Time, array<uint16_t,2>> &roi)
650 {
651 fDimRoi.setData(roi.second.data(), sizeof(uint16_t)*2);
652 fDimRoi.Update(roi.first);
653 return true;
654 }
655
656 bool UpdateDimTempRefClk(const tuple<Time, array<uint32_t,40>, array<int16_t,160>> &dat)
657 {
658 const auto delay = boost::posix_time::seconds(5);
659
660 const Time &tm = get<0>(dat);
661
662 const array<uint32_t,40> &clk = get<1>(dat);
663 const array<int16_t,160> &tmp = get<2>(dat);
664
665 // --------------- RefClock ---------------
666
667 // history, add current data to history
668 static list<pair<Time,array<uint32_t,40>>> listclk;
669 listclk.emplace_back(tm, clk);
670
671 // --------------- Temperatures ---------------
672
673 // history, add current data to history
674 static list<pair<Time,array<int16_t,160>>> listtmp;
675 listtmp.emplace_back(tm, tmp);
676
677 // ========== Update dim services once a second =========
678
679 static Time oldt(boost::date_time::neg_infin);
680 Time newt;
681
682 if (newt<oldt+delay)
683 return true;
684
685 oldt = newt;
686
687 // --------------- RefClock ---------------
688
689 // remove expired data from history
690 while (1)
691 {
692 auto it=listclk.begin();
693 if (it==listclk.end() || it->first+delay>tm)
694 break;
695 listclk.pop_front();
696 }
697
698 // Structure for dim service
699 struct Clock
700 {
701 uint16_t num;
702 float val[40];
703 Clock() { memset(this, 0, sizeof(Clock)); }
704 } __attribute__((__packed__));
705
706 // Calculate average and fll structure
707 vector<uint16_t> clknum(40);
708
709 Clock avgclk;
710 avgclk.num = listclk.size();
711 for (auto it=listclk.begin(); it!=listclk.end(); it++)
712 for (int i=0; i<40; i++)
713 if (it->second[i]!=UINT32_MAX)
714 {
715 avgclk.val[i] += it->second[i];
716 clknum[i]++;
717 }
718 for (int i=0; i<40; i++)
719 avgclk.val[i] *= 2.048/clknum[i];
720
721 // Update dim service
722 fDimRefClock.setData(avgclk);
723 fDimRefClock.Update(tm);
724
725 listclk.clear();
726
727 // --------------- Temperatures ---------------
728
729 // remove expired data from history
730 while (1)
731 {
732 auto it=listtmp.begin();
733 if (it==listtmp.end() || it->first+delay>tm)
734 break;
735 listtmp.pop_front();
736 }
737
738 // Structure for dim service
739 struct Temp
740 {
741 uint16_t num;
742 float val[160];
743 Temp() { memset(this, 0, sizeof(Temp)); }
744 } __attribute__((__packed__));
745
746 // Calculate average and fll structure
747 vector<uint32_t> tmpnum(160);
748
749 Temp avgtmp;
750 avgtmp.num = listtmp.size();
751 for (auto it=listtmp.begin(); it!=listtmp.end(); it++)
752 for (int i=0; i<160; i++)
753 if (it->second[i]!=INT16_MIN)
754 {
755 avgtmp.val[i] += it->second[i];
756 tmpnum[i]++;
757 }
758 for (int i=0; i<160; i++)
759 avgtmp.val[i] /= tmpnum[i]*16;
760
761 // Update dim service
762 fDimTemperature.setData(avgtmp);
763 fDimTemperature.Update(tm);
764
765 listtmp.clear();
766
767 return true;
768 }
769
770 bool eventCheck(const EVT_CTRL2 &evt)
771 {
772 const EVENT *event = evt.fEvent;
773
774 const Time tm(evt.time);
775
776 const array<uint16_t,2> roi = {{ event->Roi, event->RoiTM }};
777
778 if (roi!=fVecRoi)
779 {
780 fQueueRoi.emplace(tm, roi);
781 fVecRoi = roi;
782 }
783
784 const FAD::EventHeader *beg = reinterpret_cast<const FAD::EventHeader*>(evt.FADhead);
785 const FAD::EventHeader *end = reinterpret_cast<const FAD::EventHeader*>(evt.FADhead)+40;
786
787 // FIMXE: Compare with target configuration
788
789 // Copy data to array
790 array<uint32_t,40> clk;
791 array<int16_t,160> tmp;
792
793 for (int i=0; i<40; i++)
794 clk[i] = UINT32_MAX;
795
796 for (int i=0; i<160; i++)
797 tmp[i] = INT16_MIN;
798
799 //fill(clk.data(), clk.data()+ 40, UINT32_MAX);
800 //fill(tmp.data(), tmp.data()+160, INT16_MIN);
801
802 for (const FAD::EventHeader *ptr=beg; ptr!=end; ptr++)
803 {
804 // FIXME: Compare with expectations!!!
805 if (ptr->fStartDelimiter==0)
806 {
807 if (ptr==beg)
808 beg++;
809 continue;
810 }
811
812 clk[ptr->Id()] = ptr->fFreqRefClock;
813 for (int i=0; i<4; i++)
814 tmp[ptr->Id()*4+i] = ptr->fTempDrs[i];
815
816 if (beg->fStatus != ptr->fStatus)
817 {
818 fMsg.Error("Inconsistency in FAD status detected.... closing run.");
819 return false;
820 }
821
822 if (beg->fRunNumber != ptr->fRunNumber)
823 {
824 fMsg.Error("Inconsistent run number detected.... closing run.");
825 return false;
826 }
827
828 /*
829 if (beg->fVersion != ptr->fVersion)
830 {
831 Error("Inconsist firmware version detected.... closing run.");
832 CloseRunFile(runNr, 0, 0);
833 break;
834 }
835 */
836 if (beg->fEventCounter != ptr->fEventCounter)
837 {
838 fMsg.Error("Inconsistent FAD event number detected.... closing run.");
839 return false;
840 }
841
842 if (beg->fTriggerCounter != ptr->fTriggerCounter)
843 {
844 fMsg.Error("Inconsistent FTM trigger number detected.... closing run.");
845 return false;
846 }
847
848 // FIXME: Check with first event!
849 if (beg->fAdcClockPhaseShift != ptr->fAdcClockPhaseShift)
850 {
851 fMsg.Error("Inconsistent phase shift detected.... closing run.");
852 return false;
853 }
854
855 // FIXME: Check with first event!
856 if (memcmp(beg->fDac, ptr->fDac, sizeof(beg->fDac)))
857 {
858 fMsg.Error("Inconsistent DAC values detected.... closing run.");
859 return false;
860 }
861
862 if (beg->fTriggerType != ptr->fTriggerType)
863 {
864 fMsg.Error("Inconsistent trigger type detected.... closing run.");
865 return false;
866 }
867 }
868
869 fQueueTempRefClk.emplace(tm, clk, tmp);
870
871 // check REFCLK_frequency
872 // check consistency with command configuration
873 // how to log errors?
874 // need gotNewRun/closedRun to know it is finished
875
876 return true;
877 }
878
879 Time fLastDimRawData;
880 Time fLastDimEventData;
881
882 bool UpdateDimRawData(const vector<char> &v)
883 {
884 const EVENT *evt = reinterpret_cast<const EVENT*>(v.data());
885
886 fDimRawData.setData(v);
887 fDimRawData.setQuality(evt->TriggerType);
888 fDimRawData.Update(Time(evt->PCTime, evt->PCUsec));
889
890 return true;
891 }
892
893 bool UpdateDimEventData(const tuple<Time,uint32_t,array<float, 1440*4>> &tup)
894 {
895 fDimEventData.setQuality(get<1>(tup));
896 fDimEventData.setData(get<2>(tup));
897 fDimEventData.Update(get<0>(tup));
898
899 return true;
900 }
901
902 void applyCalib(const EVT_CTRL2 &evt, const size_t &size)
903 {
904 const EVENT *event = evt.fEvent;
905 const int16_t *start = event->StartPix;
906
907 // Get the reference to the run associated information
908 RUN_CTRL2 &run = *evt.runCtrl;
909
910 if (size==1) // If there is more than one event waiting (including this one), throw them away
911 {
912 Time now;
913
914 // ------------------- Copy event data to new memory --------------------
915 // (to make it thread safe; a static buffer might improve memory handling)
916 const uint16_t roi = event->Roi;
917
918 // ------------------- Apply full DRS calibration ------------------------
919 // (Is that necessray, or would a simple offset correct do well already?)
920
921 // This is a very important step. Making a copy of the shared pointer ensures
922 // that another thread (here: runClose) can set a new shared_ptr with new
923 // data without this thread being affected. If we just did run.calib->Apply
924 // the shared_pointer in use here might vanash during the processing, the
925 // memory is freed and we access invalid memory. It is not important
926 // which memory we acces (the old or the new one) because it is just for
927 // display purpose anyway.
928 const shared_ptr<DrsCalibration> cal = run.calib;
929
930 // There seems to be a problem using std::array... maybe the size is too big?
931 // array<float, (1440+160)*1024> vec2;
932 vector<float> vec((1440+160)*roi);
933 cal->Apply(vec.data(), event->Adc_Data, start, roi);
934
935 // ------------------- Appy DRS-step correction --------------------------
936 for (auto it=run.prevStart.begin(); it!=run.prevStart.end(); it++)
937 {
938 DrsCalibrate::CorrectStep(vec.data(), 1440, roi, it->data(), start, roi+10);
939 DrsCalibrate::CorrectStep(vec.data(), 1440, roi, it->data(), start, 3);
940 }
941
942 // ------------------------- Remove spikes --------------------------------
943 DrsCalibrate::RemoveSpikes3(vec.data(), roi);
944
945 // -------------- Update raw data dim sevice (VERY SLOW) -----------------
946 if (fQueueRawData.empty() && now>fLastDimRawData+boost::posix_time::seconds(5))
947 {
948 vector<char> data1(sizeof(EVENT)+vec.size()*sizeof(float));
949 memcpy(data1.data(), event, sizeof(EVENT));
950 memcpy(data1.data()+sizeof(EVENT), vec.data(), vec.size()*sizeof(float));
951 fQueueRawData.emplace(data1);
952
953 fLastDimRawData = now;
954 }
955
956 // ------------------------- Basic statistics -----------------------------
957 DrsCalibrate::SlidingAverage(vec.data(), roi, 10);
958
959 // If this is a cosmic event
960 array<float, 1440*4> stats; // Mean, RMS, Max, Pos
961 const float max = DrsCalibrate::GetPixelStats(stats.data(), vec.data(), roi);
962 if (evt.trgTyp==0 && max>fMaxEvent.first)
963 fMaxEvent = make_pair(max, stats);
964
965 // ------------------ Update dim service (statistics) ---------------------
966
967 if (fQueueEventData.empty() && now>fLastDimEventData+boost::posix_time::microseconds(3141593))
968 {
969 fQueueEventData.emplace(evt.time, evt.trgTyp, evt.trgTyp==0 ? fMaxEvent.second : stats);
970 if (evt.trgTyp==0)
971 fMaxEvent.first = -FLT_MAX;
972
973 fLastDimEventData = now;
974 }
975
976 // === SendFeedbackData(PEVNT_HEADER *fadhd, EVENT *event)
977 //
978 // if (!ptr->HasTriggerLPext() && !ptr->HasTriggerLPint())
979 // return;
980 //
981 // vector<float> data2(1440); // Mean, RMS, Max, Pos, first, last
982 // DrsCalibrate::GetPixelMax(data2.data(), data.data(), event->Roi, 0, event->Roi-1);
983 //
984 // fDimFeedbackData.Update(data2);
985 }
986
987 // Keep the start cells of the last five events for further corrections
988 // As a performance improvement we could also just store the
989 // pointers to the last five events...
990 // What if a new run is started? Do we mind?
991 auto &l = run.prevStart; // History for start cells of previous events (for step calibration)
992
993 if (l.size()<5)
994 l.emplace_front();
995 else
996 {
997 auto it = l.end();
998 l.splice(l.begin(), l, --it);
999 }
1000
1001 memcpy(l.front().data(), start, 1440*sizeof(int16_t));
1002 }
1003
1004 bool IsRunWaiting()
1005 {
1006 const lock_guard<mutex> lock(mtx_newrun);
1007 return fExpectedRuns.find(fRunNumber-1)!=fExpectedRuns.end();
1008 }
1009
1010 uint32_t GetRunNumber() const
1011 {
1012 return fRunNumber;
1013 }
1014
1015 bool IncreaseRunNumber(uint32_t run)
1016 {
1017 if (!InitRunNumber())
1018 return false;
1019
1020 if (run<fRunNumber)
1021 {
1022 ostringstream msg;
1023 msg <<
1024 "Run number " << run << " smaller than next available "
1025 "run number " << fRunNumber << " in " << fPath << " [" << fNightAsInt << "]";
1026 fMsg.Error(msg);
1027 return false;
1028 }
1029
1030 fRunNumber = run;
1031
1032 return true;
1033 }
1034
1035 void gotNewRun(RUN_CTRL2 &run)
1036 {
1037 // This is to secure iteration over fExpectedRuns
1038 const lock_guard<mutex> lock(mtx_newrun);
1039
1040 map<uint32_t,FAD::RunDescription>::iterator it = fExpectedRuns.begin();
1041 while (it!=fExpectedRuns.end())
1042 {
1043 if (it->first<run.runId)
1044 {
1045 ostringstream str;
1046 str << "runOpen - Missed run " << it->first << ".";
1047 fMsg.Info(str);
1048
1049 // Increase the iterator first, it becomes invalid with the next call
1050 const auto is = it++;
1051 fExpectedRuns.erase(is);
1052 continue;
1053 }
1054
1055 if (it->first==run.runId)
1056 break;
1057
1058 it++;
1059 }
1060
1061 if (it==fExpectedRuns.end())
1062 {
1063 ostringstream str;
1064 str << "runOpen - Run " << run.runId << " wasn't expected (maybe manual triggers)";
1065 fMsg.Warn(str);
1066
1067 // This is not ideal, but the best we can do
1068 run.night = fNightAsInt;
1069
1070 return;
1071 }
1072
1073 const FAD::RunDescription &conf = it->second;
1074
1075 run.runType = conf.name;
1076 run.maxEvt = conf.maxevt;
1077 run.closeTime = conf.maxtime + run.openTime;
1078 run.night = conf.night;
1079
1080 fExpectedRuns.erase(it);
1081
1082 // Now signal the fadctrl (configuration process that a run is in progress)
1083 // Maybe this could be done earlier, but we are talking about a
1084 // negligible time scale here.
1085 fRunInProgress = run.runId;
1086 }
1087
1088 void runFinished()
1089 {
1090 // This is called when the last event of a run (run time exceeded or
1091 // max number of events exceeded) has been received.
1092 fRunInProgress = -1;
1093 }
1094
1095 //map<boost::thread::id, string> fLastMessage;
1096
1097 void factOut(int severity, const char *message)
1098 {
1099 ostringstream str;
1100 str << "EventBuilder: " << message;
1101
1102 /*
1103 string &old = fLastMessage[boost::this_thread::get_id()];
1104
1105 if (str.str()==old)
1106 return;
1107 old = str.str();
1108 */
1109
1110 fMsg.Update(str, severity);
1111 }
1112
1113/*
1114 void factStat(int64_t *stat, int len)
1115 {
1116 if (len!=7)
1117 {
1118 fMsg.Warn("factStat received unknown number of values.");
1119 return;
1120 }
1121
1122 vector<int64_t> data(1, g_maxMem);
1123 data.insert(data.end(), stat, stat+len);
1124
1125 static vector<int64_t> last(8);
1126 if (data==last)
1127 return;
1128 last = data;
1129
1130 fDimStatistics.Update(data);
1131
1132 // len ist die Laenge des arrays.
1133 // array[4] enthaelt wieviele bytes im Buffer aktuell belegt sind; daran
1134 // kannst Du pruefen, ob die 100MB voll sind ....
1135
1136 ostringstream str;
1137 str
1138 << "Wait=" << stat[0] << " "
1139 << "Skip=" << stat[1] << " "
1140 << "Del=" << stat[2] << " "
1141 << "Tot=" << stat[3] << " "
1142 << "Mem=" << stat[4] << "/" << g_maxMem << " "
1143 << "Read=" << stat[5] << " "
1144 << "Conn=" << stat[6];
1145
1146 fMsg.Info(str);
1147 }
1148 */
1149
1150 bool UpdateDimStatistics1(const pair<Time,GUI_STAT> &stat)
1151 {
1152 fDimStatistics1.setData(&stat.second, sizeof(GUI_STAT));
1153 fDimStatistics1.Update(stat.first);
1154
1155 return true;
1156 }
1157
1158 void factStat(const GUI_STAT &stat)
1159 {
1160 fQueueStatistics1.emplace(Time(), stat);
1161 }
1162
1163 void factReportIncomplete(uint64_t rep)
1164 {
1165 fDimIncomplete.setQuality(1);
1166 fDimIncomplete.Update(rep);
1167 }
1168
1169 array<FAD::EventHeader, 40> fVecHeader;
1170
1171 template<typename T, class S>
1172 array<T, 42> Compare(const S *vec, const T *t)
1173 {
1174 const int offset = reinterpret_cast<const char *>(t) - reinterpret_cast<const char *>(vec);
1175
1176 const T *min = NULL;
1177 const T *val = NULL;
1178 const T *max = NULL;
1179
1180 array<T, 42> arr;
1181
1182 // bool rc = true;
1183 for (int i=0; i<40; i++)
1184 {
1185 const char *base = reinterpret_cast<const char*>(vec+i);
1186 const T *ref = reinterpret_cast<const T*>(base+offset);
1187
1188 arr[i] = *ref;
1189
1190 if (gi_NumConnect[i]==0)
1191 {
1192 arr[i] = 0;
1193 continue;
1194 }
1195
1196 if (!val)
1197 {
1198 min = ref;
1199 val = ref;
1200 max = ref;
1201 }
1202
1203 if (*ref<*min)
1204 min = ref;
1205
1206 if (*ref>*max)
1207 max = ref;
1208
1209 // if (*val!=*ref)
1210 // rc = false;
1211 }
1212
1213 arr[40] = val ? *min : 1;
1214 arr[41] = val ? *max : 0;
1215
1216 return arr;
1217 }
1218
1219 template<typename T>
1220 array<T, 42> CompareBits(const FAD::EventHeader *h, const T *t)
1221 {
1222 const int offset = reinterpret_cast<const char *>(t) - reinterpret_cast<const char *>(h);
1223
1224 T val = 0;
1225 T rc = 0;
1226
1227 array<T, 42> vec;
1228
1229 bool first = true;
1230
1231 for (int i=0; i<40; i++)
1232 {
1233 const char *base = reinterpret_cast<const char*>(&fVecHeader[i]);
1234 const T *ref = reinterpret_cast<const T*>(base+offset);
1235
1236 vec[i+2] = *ref;
1237
1238 if (gi_NumConnect[i]==0)
1239 {
1240 vec[i+2] = 0;
1241 continue;
1242 }
1243
1244 if (first)
1245 {
1246 first = false;
1247 val = *ref;
1248 rc = 0;
1249 }
1250
1251 rc |= val^*ref;
1252 }
1253
1254 vec[0] = rc;
1255 vec[1] = val;
1256
1257 return vec;
1258 }
1259
1260 template<typename T, size_t N>
1261 void Update(DimDescribedService &svc, const array<T, N> &data, const Time &t=Time(), int n=N)
1262 {
1263 svc.setData(const_cast<T*>(data.data()), sizeof(T)*n);
1264 svc.Update(t);
1265 }
1266
1267 template<typename T>
1268 void Print(const char *name, const pair<bool,array<T, 43>> &data)
1269 {
1270 cout << name << "|" << data.first << "|" << data.second[1] << "|" << data.second[0] << "<x<" << data.second[1] << ":";
1271 for (int i=0; i<40;i++)
1272 cout << " " << data.second[i+3];
1273 cout << endl;
1274 }
1275
1276 vector<uint> fNumConnected;
1277
1278 bool procHeader(const tuple<Time,bool,FAD::EventHeader> &dat)
1279 {
1280 const Time &t = get<0>(dat);
1281 const bool changed = get<1>(dat);
1282 const FAD::EventHeader &h = get<2>(dat);
1283
1284 const FAD::EventHeader old = fVecHeader[h.Id()];
1285 fVecHeader[h.Id()] = h;
1286
1287 if (old.fVersion != h.fVersion || changed)
1288 {
1289 const array<uint16_t,42> ver = Compare(&fVecHeader[0], &fVecHeader[0].fVersion);
1290
1291 array<float,42> data;
1292 for (int i=0; i<42; i++)
1293 {
1294 ostringstream str;
1295 str << (ver[i]>>8) << '.' << (ver[i]&0xff);
1296 data[i] = stof(str.str());
1297 }
1298 Update(fDimFwVersion, data, t);
1299 }
1300
1301 if (old.fRunNumber != h.fRunNumber || changed)
1302 {
1303 const array<uint32_t,42> run = Compare(&fVecHeader[0], &fVecHeader[0].fRunNumber);
1304 fDimRunNumber.setData(&run[0], 42*sizeof(uint32_t));
1305 fDimRunNumber.Update(t);
1306 }
1307
1308 if (old.fTriggerGeneratorPrescaler != h.fTriggerGeneratorPrescaler || changed)
1309 {
1310 const array<uint16_t,42> pre = Compare(&fVecHeader[0], &fVecHeader[0].fTriggerGeneratorPrescaler);
1311 fDimPrescaler.setData(&pre[0], 42*sizeof(uint16_t));
1312 fDimPrescaler.Update(t);
1313 }
1314
1315 if (old.fDNA != h.fDNA || changed)
1316 {
1317 const array<uint64_t,42> dna = Compare(&fVecHeader[0], &fVecHeader[0].fDNA);
1318 Update(fDimDNA, dna, t, 40);
1319 }
1320
1321 if (old.fStatus != h.fStatus || changed)
1322 {
1323 const array<uint16_t,42> sts = CompareBits(&fVecHeader[0], &fVecHeader[0].fStatus);
1324 Update(fDimStatus, sts, t);
1325 }
1326
1327 if (memcmp(old.fDac, h.fDac, sizeof(h.fDac)) || changed)
1328 {
1329 array<uint16_t, FAD::kNumDac*42> dacs;
1330
1331 for (int i=0; i<FAD::kNumDac; i++)
1332 {
1333 const array<uint16_t, 42> dac = Compare(&fVecHeader[0], &fVecHeader[0].fDac[i]);
1334 memcpy(&dacs[i*42], &dac[0], sizeof(uint16_t)*42);
1335 }
1336
1337 Update(fDimDac, dacs, t);
1338 }
1339
1340 return true;
1341 }
1342
1343 void debugHead(const FAD::EventHeader &h)
1344 {
1345 const uint16_t id = h.Id();
1346 if (id>39)
1347 return;
1348
1349 if (fNumConnected.size()!=40)
1350 fNumConnected.resize(40);
1351
1352 const vector<uint> con(gi_NumConnect, gi_NumConnect+40);
1353
1354 const bool changed = con!=fNumConnected || !IsThreadRunning();
1355
1356 fNumConnected = con;
1357
1358 fQueueProcHeader.emplace(Time(), changed, h);
1359 }
1360};
1361
1362EventBuilderWrapper *EventBuilderWrapper::This = 0;
1363
1364// ----------- Event builder callbacks implementation ---------------
1365bool runOpen(const EVT_CTRL2 &evt)
1366{
1367 return EventBuilderWrapper::This->runOpen(evt);
1368}
1369
1370bool runWrite(const EVT_CTRL2 &evt)
1371{
1372 return EventBuilderWrapper::This->runWrite(evt);
1373}
1374
1375void runClose(RUN_CTRL2 &run)
1376{
1377 EventBuilderWrapper::This->runClose(run);
1378}
1379
1380bool eventCheck(const EVT_CTRL2 &evt)
1381{
1382 return EventBuilderWrapper::This->eventCheck(evt);
1383}
1384
1385void gotNewRun(RUN_CTRL2 &run)
1386{
1387 EventBuilderWrapper::This->gotNewRun(run);
1388}
1389
1390void runFinished()
1391{
1392 EventBuilderWrapper::This->runFinished();
1393}
1394
1395void applyCalib(const EVT_CTRL2 &evt, const size_t &size)
1396{
1397 EventBuilderWrapper::This->applyCalib(evt, size);
1398}
1399
1400void factOut(int severity, const char *message)
1401{
1402 EventBuilderWrapper::This->factOut(severity, message);
1403}
1404
1405void factStat(const GUI_STAT &stat)
1406{
1407 EventBuilderWrapper::This->factStat(stat);
1408}
1409
1410void factReportIncomplete(uint64_t rep)
1411{
1412 EventBuilderWrapper::This->factReportIncomplete(rep);
1413}
1414
1415// ------
1416
1417void debugHead(void *buf)
1418{
1419 const FAD::EventHeader &h = *reinterpret_cast<FAD::EventHeader*>(buf);
1420 EventBuilderWrapper::This->debugHead(h);
1421}
1422
1423#endif
Note: See TracBrowser for help on using the repository browser.