27 const uint32_t TDC = 1414808643;
40 public std::map<uint64_t, timeslice_type>
61 using namespace KM3NETDAQ;
67 for (timeslice_type::iterator collection = this->begin()->second.begin(); collection != this->begin()->second.end(); ++collection) {
69 sort(collection->second.begin(), collection->second.end(), compare);
76 JDAQUTCExtended(header->timeStamp().sec(), header->timeStamp().tics()));
78 if (timeslice.empty()) {
82 const uint32_t number_of_packets = collection->second.size();
83 const uint32_t sequence_number = header->udpSequenceNumber();
92 for (collection_type::const_iterator i = collection->second.begin(); i != collection->second.end(); ++i) {
97 frame.add(size, data);
100 timeslice.push_back(frame);
103 this->erase(this->begin());
116 static inline bool compare(
const buffer_type&
first,
const buffer_type& second)
118 return (((
const CLBCommonHeader*) first .data())->udpSequenceNumber() <
136 int main(
int argc,
char **argv)
140 using namespace KM3NETDAQ;
152 JParser<> zap(
"Auxiliary program to convert CLB data to KM3NETDAQ::JDAQTimeslice data.");
154 zap[
'f'] =
make_field(inputFile,
"input file).");
156 zap[
'n'] =
make_field(numberOfEvents) = numeric_limits<int>::max();
163 catch(
const exception& error) {
164 FATAL(error.what() << endl);
178 uint32_t run = numeric_limits<uint32_t>::max();
181 ifstream
in(inputFile.c_str(), ios::binary);
183 for (
int count = 0;
count != numberOfEvents &&
in.read((
char*) &size,
sizeof(uint32_t)); ++
count) {
187 buffer_type buffer(size);
189 if (
in.read(buffer.data(), size)) {
195 if (run == numeric_limits<uint32_t>::max()) {
210 while (data.size() >
queue) {
216 WARNING(
"Run numbers differ " << run <<
' ' << header->
runNumber() <<
" -> skip data." << endl);
226 while (!data.empty()) {
static const JBits DAQ_UDP_RECEIVED_PACKETS(0, 15)
Mask of UDP received packets.
Utility class to parse command line options.
ROOT TTree parameter settings.
int write(const int value) const
Write given value as bit mask.
Recording of objects on file according a format that follows from the file name extension.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
int write(const int value) const
Write given value as bit mask.
Data structure for UTC time.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const JBit DAQ_UDP_TRAILER(31)
UDP trailer.
General purpose messaging.
Utility class to parse command line options.
static const JBit DAQ_WHITE_RABBIT(31)
White Rabbit status.
static const JBits DAQ_UDP_SEQUENCE_NUMBER(16, 31)
Mask of UDP sequence number.
Data frame of one optical module.
uint64_t inMilliSeconds() const
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])