50{
52
55 Long64_t numberOfEvents;
57
58 try {
59
60 JParser<> zap(
"Auxiliary program to convert binary data to ROOT formatted data.");
61
64 zap[
'n'] =
make_field(numberOfEvents) = numeric_limits<Long64_t>::max();
66
67 zap(argc, argv);
68 }
69 catch(const exception &error) {
70 FATAL(error.what() << endl);
71 }
72
73
74
77
78
80
82
85 }
86
88
89
92
93 Long64_t event_count = 0;
94
95 for (vector<string>::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
96
97 STATUS(
"File: " << *i << endl);
98
99 ifstream in(i->c_str());
100
101 for (
JStreamReader is(in); event_count < numberOfEvents; ++event_count) {
102
103 STATUS(
"event: " << setw(10) << event_count <<
'\r');
DEBUG(endl);
104
105 if (!(is >> preamble)) {
106 break;
107 }
108
109 DEBUG(
"length " << preamble.getLength() << endl);
110 DEBUG(
"type " << preamble.getDataType() << endl);
111
113
114 ERROR(
"File " << *i <<
" invalid length " << preamble.getLength() << endl);
115
116 break;
117 }
118
120
121 if (i != writer.end()) {
122
123 buffer.resize(preamble.getLength());
124
126
129
131
132 i->second->copy(bin);
133
134 } else {
135
137
138 ERROR(
"Illegal data type, skip" << endl);
139 }
140 }
142
143 in.close();
144 }
145
147}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Binary input based on std::istream.
Utility class to parse command line options.
virtual bool is_open() const override
Check is file is open.
Auxiliary class to copy input data to corresponding TTree.
virtual void open(const char *file_name) override
Open file.
void insert()
Insert (list of) data type(s).
virtual void close() override
Close file.
map_type::iterator iterator
Simple data structure for the DAQ preamble required for a correct calculation of the object size for ...
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
size_t getSizeof< JDAQPreamble >()
Get size of type.