1 #ifndef __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
2 #define __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
92 const ios_base::fmtflags flags = out.flags();
94 write(evt, out << fixed);
113 read(hit, in,
false);
131 const ios_base::fmtflags flags = out.flags();
133 write(hit, out << fixed);
141 namespace JSUPPORT {}
142 namespace JPP {
using namespace JSUPPORT; }
158 template<
class T,
template<
class>
class JFileReader_t>
168 template<
template<
class>
class JFileReader_t>
170 public JFileReader_t<Head>
177 JFileReader_t<
Head>(),
187 virtual void open(
const char* file_name)
override
206 return JFileReader_t<Head>::hasNext();
225 template<
template<
class>
class JFileReader_t>
227 public JFileReader_t<Evt>
235 virtual void open(
const char* file_name)
override
241 if (this->is_open()) {
245 static_cast<istream&
>(*this) >> buffer;
386 using namespace JLANG;
392 unsigned int count = 0;
396 for (const_iterator i = this->begin(); i != this->end(); ++i) {
398 scanner.
open(i->c_str());
400 if (scanner.hasNext()) {
402 const JHead buffer = *scanner.next();
406 else if (header.match(buffer))
409 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
417 copy(header,
object);
421 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " <<
count <<
" != " << this->size());
441 const Head* p = NULL;
443 if (!this->hasNext() || (p = this->next()) == NULL) {
486 template<
class JFunction_t>
493 for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
JMultipleFileScanner(const JMultipleFileScanner_t &file_list)
Copy constructor.
Object reading from ASCII file.
virtual void rewind() override
Rewind.
virtual bool hasNext() override
Check availability of next element.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JMonteCarloFileReader()
Default constructor.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
JHead & add(const JHead &header)
Addition of headers.
Template definition of Monte Carlo object reader for gzipped ASCII formatted file (i...
static bool merge
Allow merging of files w/o header.
T * open(const std::string &file_name)
Open file.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Template definition of Monte Carlo object reader for ASCII formatted file (i.e. '.evt')
std::ostream & rewind(std::ostream &out)
Rewind character.
virtual void open(const char *file_name) override
Open file.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Exception for null pointer operation.
const Head & getHeader()
Get Monte Carlo Header.
virtual bool setObject(Head &object) override
Set object.
JMultipleFileScanner()
Default constructor.
virtual void open(const char *file_name) override
Open file.
Template specialisation of JMultipleFileScanner for Monte Carlo header.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Template definition of Monte Carlo object reader.
Auxiliary base class for list of file names.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
General purpose class for object reading from a list of file names.
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Object reading from gzipped file.
Template implementation of stream output for single data type.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Object reading from file.
virtual void open(const char *file_name) override
Open file.
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, JFunction_t test)
Get list of files compatible with geven header.
Abstract object iterator with rewinding.
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
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Template definition of Monte Carlo stream output for single data type.