40 struct JCopyInterface {
44 virtual ~JCopyInterface()
83 for ( ; i != in.end() && i->getTimesliceStart() < range.
getLowerLimit(); ++i) {}
84 for ( ; i != in.end() && i->getTimesliceStart() <= range.
getUpperLimit(); ++i) { out.
put(*i); }
98 template<
class JTypelist_t>
100 public std::vector< JSinglePointer<JCopyInterface> >,
101 public JFileRecorder<JTYPELIST<JTriggerTypes_t, JMeta>::typelist>
122 for (
iterator i = this->begin(); i != this->end(); ++i) {
137 template<
class JHead_t,
class JTail_t>
151 void add(
JType<T> type,
const std::string& input_file)
153 if (selection(type)) {
157 push_back(
new JCopy<T>(input_file, *
this));
174 template<
class JTypelist_t>
183 static const char SEPARATOR =
'/';
200 friend inline std::istream&
operator>>(std::istream& in, JSplit&
object)
208 const string::size_type pos = buffer.find(SEPARATOR);
210 if (pos != string::npos) {
212 if (!(istringstream(buffer.substr(0,pos)) >>
object.index)) { in.setstate(ios::badbit); }
213 if (!(istringstream(buffer.substr(pos+1)) >>
object.total)) { in.setstate(ios::badbit); }
217 object.index = invalid;
219 istringstream(buffer) >>
object.total;
233 friend inline std::ostream&
operator<<(std::ostream& out,
const JSplit&
object)
237 if (
object.index != invalid)
238 return out <<
object.index << SEPARATOR <<
object.total;
240 return out <<
object.total;
244 static constexpr
size_t invalid = std::numeric_limits<size_t>::max();
271 int main(
int argc,
char **argv)
278 std::string inputFile;
280 JSplit numberOfFiles;
287 JParser<> zap(
"Auxiliary program to split DAQ data into multiple output files.");
295 "Precede name of data structure by a '+' or '-' "
296 "to add or remove data types in the output, respectively."
302 catch(
const exception& error) {
303 FATAL(error.what() << endl);
307 if ((numberOfFiles.total == 0 && ranges.empty()) ||
308 (numberOfFiles.total != 0 && !ranges.empty())) {
309 FATAL(
"Invalid splitting " << numberOfFiles <<
' ' << ranges.size() <<
"; use either option -N or -r." << endl);
314 if (pos == string::npos) {
319 getUTCTimeRange<JDAQEvent> (inputFile));
322 FATAL(
"No (valid) summary or event data in input file " << inputFile <<
' ' << total << endl);
325 NOTICE(
"Total UTC time range " << total << endl);
327 if (!ranges.empty()) {
329 sort(ranges.begin(), ranges.end(), compare);
343 JCopyMaster<JDAQTypes_t> master(inputFile, selection);
345 const int width = (int) (log10(ranges.size() + 1) + 1);
347 for (
size_t i = 0; i != ranges.size(); ++i) {
349 if (numberOfFiles.index == numberOfFiles.invalid || numberOfFiles.index == i) {
353 STATUS(
"Writing " << file_name <<
' ' << ranges[i] <<
"... " << flush);
355 master.open(file_name.c_str());
357 master.put(
JMeta(argc, argv));
360 master.copy(ranges[i]);
int main(int argc, char **argv)
Recording of objects on file according a format that follows from the file name extension.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_STRING(A)
Make string.
Scanning of objects from a single file according a format that follows from the extension of each fil...
ROOT TTree parameter settings of various packages.
Template interface of object output for single data type.
virtual bool put(const T &object)=0
Object output.
Utility class to parse command line options.
Template definition for direct access of elements in ROOT TChain.
Data structure for UTC time.
static double getTick()
Get number of nano-seconds per tick.
void copy(const Head &from, JHead &to)
Copy header from from to to.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JTOOLS::JRange< JDAQUTCExtended > JDAQUTCTimeRange
Type definition for DAQ UTC time range.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
KM3NeT DAQ data structures and auxiliaries.
static const char WILDCARD
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
Auxiliary data structure for sequence of same character.
Auxiliary class for a type holder.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for ROOT class selection.