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();
88 header->domStatus(2) |
93 for (collection_type::const_iterator i = collection->second.begin(); i != collection->second.end(); ++i) {
98 frame.add(size, data);
101 timeslice.push_back(frame);
104 this->erase(this->begin());
117 static inline bool compare(
const buffer_type&
first,
const buffer_type& second)
119 return (((
const CLBCommonHeader*) first .data())->udpSequenceNumber() <
137 int main(
int argc,
char **argv)
141 using namespace KM3NETDAQ;
153 JParser<> zap(
"Auxiliary program to convert CLB data to KM3NETDAQ::JDAQTimeslice data.");
155 zap[
'f'] =
make_field(inputFile,
"input file).");
157 zap[
'n'] =
make_field(numberOfEvents) = numeric_limits<int>::max();
164 catch(
const exception& error) {
165 FATAL(error.what() << endl);
179 uint32_t run = numeric_limits<uint32_t>::max();
182 ifstream
in(inputFile.c_str(), ios::binary);
184 for (
int count = 0;
count != numberOfEvents &&
in.read((
char*) &size,
sizeof(uint32_t)); ++
count) {
188 buffer_type buffer(size);
190 if (
in.read(buffer.data(), size)) {
196 if (run == numeric_limits<uint32_t>::max()) {
211 while (data.size() >
queue) {
217 WARNING(
"Run numbers differ " << run <<
' ' << header->
runNumber() <<
" -> skip data." << endl);
227 while (!data.empty()) {
static const JBits DAQ_UDP_RECEIVED_PACKETS(0, 15)
Mask of UDP received packets.
Utility class to parse command line options.
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
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.
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 JBits DAQ_UDP_SEQUENCE_NUMBER(16, 31)
Mask of UDP sequence number.
do set_variable DETECTOR_TXT $WORKDIR detector
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Data frame of one optical module.
uint64_t inMilliSeconds() const
#define DEBUG(A)
Message macros.