31 static const char WILDCARD =
'%';
34 using namespace KM3NETDAQ;
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) {
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);
333 const double T_ns = (total.getUpperLimit().getTimeNanoSecond() -
334 total.getLowerLimit().getTimeNanoSecond()) / numberOfFiles.total;
336 for (
double t1 = total.getLowerLimit().getTimeNanoSecond(); t1 < total.getUpperLimit().getTimeNanoSecond(); t1 += T_ns) {
344 JCopyMaster<JDAQTypes_t>
master(inputFile, selection);
346 const int width = (int) (
log10(ranges.size() + 1) + 1);
348 for (
size_t i = 0; i != ranges.size(); ++i) {
350 if (numberOfFiles.index == numberOfFiles.invalid || numberOfFiles.index == i) {
354 STATUS(
"Writing " << file_name <<
"... " << flush);
356 master.open(file_name.c_str());
358 master.put(
JMeta(argc, argv));
361 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.
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.
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})"
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.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Template interface of object output for single data type.
do echo n Creating graphics for string $STRING for((FLOOR=$FIRST_FLOOR;$FLOOR<=$LAST_FLOOR;FLOOR+=1))
virtual bool put(const T &object)=0
Object output.
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 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
JTriggerParameters getTriggerParameters(const JMultipleFileScanner_t &file_list)
Get trigger parameters.