34 using namespace KM3NETDAQ;
40 struct JCopyInterface {
44 virtual ~JCopyInterface()
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>
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) {
315 FATAL(
"Output file name " <<
outputFile <<
" does not contain wild card '" << WILDCARD <<
"'" << endl);
319 getUTCTimeRange<JDAQEvent> (inputFile));
321 if (!total.is_valid()) {
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);
335 for (
long double t1 = total.getLowerLimit().getTimeNanoSecond(); t1 < (
long double) total.getUpperLimit().getTimeNanoSecond(); t1 += T_ns) {
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]);
Utility class to parse command line options.
then echo Test string reversed by master(hit< return > to continue)." $DIR/JProcess -c "$DIR/JEcho" -rC fi if (( 1 ))
int main(int argc, char *argv[])
ROOT TTree parameter settings of various packages.
Recording of objects on file according a format that follows from the file name extension.
Auxiliary class for ROOT class selection.
static double getTick()
Get number of nano-seconds per tick.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for a type holder.
Data structure for UTC time.
Template definition for direct access of elements in ROOT TChain.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
#define MAKE_STRING(A)
Make string.
static const char WILDCARD
Scanning of objects from a single file according a format that follows from the extension of each fil...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
double getTimeDifference(const JDAQChronometer &first, const JDAQChronometer &second)
Get time difference between two chronometers.
General purpose messaging.
JTOOLS::JRange< JDAQUTCExtended > JDAQUTCTimeRange
Type definition for DAQ UTC time range.
Auxiliary data structure for sequence of same character.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
Template interface of object output for single data type.
virtual bool put(const T &object)=0
Object output.
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.
do echo n Creating graphics for string $STRING for((FLOOR=$FIRST_FLOOR;$FLOOR<=$LAST_FLOOR;FLOOR+=1))