source: trunk/FACT++/src/DataProcessorImp.cc@ 11834

Last change on this file since 11834 was 11726, checked in by tbretz, 13 years ago
File size: 2.0 KB
Line 
1#include "DataProcessorImp.h"
2
3#include "FAD.h"
4
5using namespace std;
6
7
8// --------------------------------------------------------------------------
9//
10//! This creates an appropriate file name for a particular run number and type
11//! @param runNumberq the run number for which a filename is to be created
12//! @param runType an int describing the kind of run. 0=Data, 1=Pedestal, 2=Calibration, 3=Calibrated data
13//! @param extension a string containing the extension to be appened to the file name
14//
15string DataProcessorImp::FormFileName(uint32_t runid, const string &extension)
16{
17 ostringstream name;
18 name << Time().NightAsInt() << '_' << setfill('0') << setw(3) << runid << '.' << extension;
19 return name.str();
20}
21
22// =======================================================================
23
24bool DataDump::Open(RUN_HEAD* h)
25{
26 fFileName = "/dev/null";
27
28 ostringstream str;
29 str << this << " - "
30 << "OPEN_FILE #" << GetRunId() << ":"
31 << " Ver=" << h->Version
32 << " Typ=" << h->RunType
33 << " Nb=" << h->NBoard
34 << " Np=" << h->NPix
35 << " NTm=" << h->NTm
36 << " roi=" << h->Nroi;
37
38 Debug(str);
39
40 fTime = Time();
41
42 return true;
43}
44
45bool DataDump::WriteEvt(EVENT *e)
46{
47 const Time now;
48 if (now-fTime<boost::posix_time::seconds(5))
49 return true;
50
51 fTime = now;
52
53 ostringstream str;
54 str << this << " - EVENT #" << e->EventNum << " / " << e->TriggerNum;
55 Debug(str);
56
57 return true;
58}
59
60bool DataDump::Close(RUN_TAIL *)
61{
62 ostringstream str;
63 str << this << " - CLOSE FILE #" << GetRunId();
64
65 Debug(str);
66
67 return true;
68}
69
70// =======================================================================
71
72bool DataDebug::WriteEvt(EVENT *e)
73{
74 cout << "WRITE_EVENT #" << GetRunId() << " (" << e->EventNum << ")" << endl;
75 cout << " Typ=" << e->TriggerType << endl;
76 cout << " roi=" << e->Roi << endl;
77 cout << " trg=" << e->SoftTrig << endl;
78 cout << " tim=" << e->PCTime << endl;
79
80 return true;
81}
82
Note: See TracBrowser for help on using the repository browser.