1 #ifndef __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
2 #define __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
75 for (MultiHead::const_iterator i = header.begin(); i != header.end(); ++i) {
112 const ios_base::fmtflags flags = out.flags();
114 write(evt, out << fixed);
133 read(hit, in,
false);
151 const ios_base::fmtflags flags = out.flags();
153 write(hit, out << fixed);
161 namespace JSUPPORT {}
162 namespace JPP {
using namespace JSUPPORT; }
178 template<
class T,
template<
class>
class JFileReader_t>
188 template<
template<
class>
class JFileReader_t>
190 public JFileReader_t<Head>
197 JFileReader_t<
Head>(),
207 virtual void open(
const char* file_name)
override
226 return JFileReader_t<Head>::hasNext();
245 template<
template<
class>
class JFileReader_t>
247 public JFileReader_t<Evt>
255 virtual void open(
const char* file_name)
override
261 if (this->is_open()) {
265 static_cast<istream&
>(*this) >> buffer;
406 using namespace JLANG;
412 unsigned int count = 0;
416 for (const_iterator i = this->begin(); i != this->end(); ++i) {
418 scanner.
open(i->c_str());
420 if (scanner.hasNext()) {
422 const JHead buffer = *scanner.next();
426 else if (header.match(buffer))
429 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
437 copy(header,
object);
439 if (count != 0 && count != this->size()) {
441 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
461 const Head* p = NULL;
463 if (!this->hasNext() || (p = this->next()) == NULL) {
506 template<
class JFunction_t>
513 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.