source: trunk/FACT++/src/DataWriteRaw.h@ 14992

Last change on this file since 14992 was 14700, checked in by tbretz, 12 years ago
Not only the run number needs to be propagated for consistency but also the night. Otherwise we might check the night, configure the FADs and when we start the run it has changed already. Since it is at day time this is not a likely scenario but should be avoided nevertheless.
File size: 2.2 KB
Line 
1#ifndef FACT_DataWriteRaw
2#define FACT_DataWriteRaw
3
4#include "DataProcessorImp.h"
5
6class DataWriteRaw : public DataProcessorImp
7{
8 std::ofstream fOut;
9
10 off_t fPosTail;
11
12 uint32_t fCounter;
13
14
15 // WRITE uint32_t 0xFAC77e1e (FACT Tele)
16 // ===
17 // WRITE uint32_t TYPE(>0) == 1
18 // WRITE uint32_t ID(>0) == 0
19 // WRITE uint32_t VERSION(>0) == 1
20 // WRITE uint32_t LENGTH
21 // -
22 // WRITE uint32_t TELESCOPE ID
23 // WRITE uint32_t RUNID
24 // ===
25 // WRITE uint32_t TYPE(>0) == 2
26 // WRITE uint32_t ID(>0) == 0
27 // WRITE uint32_t VERSION(>0) == 1
28 // WRITE uint32_t LENGTH
29 // -
30 // WRITE HEADER
31 // ===
32 // [ 40 TIMES
33 // WRITE uint32_t TYPE(>0) == 3
34 // WRITE uint32_t ID(>0) == 0..39
35 // WRITE uint32_t VERSION(>0) == 1
36 // WRITE uint32_t LENGTH
37 // -
38 // WRITE BOARD-HEADER
39 // ]
40 // ===
41 // WRITE uint32_t TYPE(>0) == 4
42 // WRITE uint32_t ID(>0) == 0
43 // WRITE uint32_t VERSION(>0) == 1
44 // WRITE uint32_t LENGTH
45 // -
46 // WRITE FOOTER (empty)
47 // ===
48 // [ N times
49 // WRITE uint32_t TYPE(>0) == 10
50 // WRITE uint32_t ID(>0) == counter
51 // WRITE uint32_t VERSION(>0) == 1
52 // WRITE uint32_t LENGTH HEADER
53 // -
54 // WRITE HEADER+DATA
55 // ]
56 // ===
57 // WRITE uint32_t TYPE ==0
58 // WRITE uint32_t VERSION==0
59 // WRITE uint32_t LENGTH ==0
60 // ===
61 // Go back and write footer
62
63 void WriteBlockHeader(uint32_t type, uint32_t ver, uint32_t cnt, uint32_t len);
64
65 template<typename T>
66 void WriteValue(const T &t);
67
68
69public:
70 DataWriteRaw(const std::string &path, uint64_t night, uint32_t id, MessageImp &imp) : DataProcessorImp(path, night, id, imp), fPosTail(0) { }
71 ~DataWriteRaw() { if (fOut.is_open()) Close(); }
72
73 enum
74 {
75 kEndOfFile = 0,
76 kIdentifier = 1,
77 kRunHeader,
78 kBoardHeader,
79 kRunSummary,
80 kEvent,
81 };
82
83 bool Open(const RUN_HEAD *h, const FAD::RunDescription &d);
84 bool WriteEvt(EVENT *evt);
85 bool Close(RUN_TAIL *tail= 0);
86};
87
88#endif
Note: See TracBrowser for help on using the repository browser.