1 #ifndef __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
2 #define __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
77 for (MultiHead::const_iterator
i = header.begin();
i != header.end(); ++
i) {
114 const ios_base::fmtflags flags = out.flags();
120 for (
const auto& trk : evt.
mc_trks) {
135 for (
const auto& trk : evt.
trks) {
161 write(evt, out << fixed);
181 read(hit, in,
false);
198 const ios_base::fmtflags flags = out.flags();
200 write(hit, out << fixed);
208 namespace JSUPPORT {}
209 namespace JPP {
using namespace JSUPPORT; }
227 template<
class T,
template<
class>
class JFileReader_t>
237 template<
template<
class>
class JFileReader_t>
239 public JFileReader_t<Head>
246 JFileReader_t<
Head>(),
256 virtual void open(
const char* file_name)
override
275 return JFileReader_t<Head>::hasNext();
294 template<
template<
class>
class JFileReader_t>
296 public JFileReader_t<Evt>
304 virtual void open(
const char* file_name)
override
310 if (this->is_open()) {
314 static_cast<istream&
>(*this) >> buffer;
455 using namespace JLANG;
461 unsigned int count = 0;
465 for (const_iterator
i = this->begin();
i != this->end(); ++
i) {
467 scanner.
open(
i->c_str());
469 if (scanner.hasNext()) {
471 const JHead buffer = *scanner.next();
475 else if (header.match(buffer))
478 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
486 copy(header,
object);
488 if (count != 0 && count != this->size()) {
490 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
510 const Head* p = NULL;
512 if (!this->hasNext() || (p = this->next()) == NULL) {
561 for (MultiHead::const_iterator
i = multiHeader1.cbegin();
i != multiHeader1.cend(); ++
i) {
563 multiHeader0.insert(header);
567 multiHeader0.merge();
583 template<
class JFunction_t>
590 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.
const char *const w2list_t
std::istream & operator>>(std::istream &in, std::vector< int > &object)
Read std::vector<int> from input.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
const char *const weights_t
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
const char *const w3list_t
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions) ...
JMonteCarloFileReader()
Default constructor.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
const char *const track_fit_t
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.
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
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.
const char *const eventtime_t
Exception for null pointer operation.
int mc_id
identifier of the MC event (as found in ascii or antcc file).
JMultiHead getMultiHeader(const JMultipleFileScanner_t &file_list)
Get multi-header corresponding to a given file list.
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
bool getLongprint(std::ostream &out)
Get long print option.
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.
JHead & add(const JHead &header)
Addition of headers.
bool is_initialstate(const Trk &track)
Test whether given track corresponds to an initial state particle.
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...
const char *const track_in_t
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.
std::ostream & operator<<(std::ostream &out, const std::vector< int > &object)
Write std::vector<int> to output.
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
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.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
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.
const char *const end_event_t
std::vector< Hit > hits
list of hits
const char *const hit_raw_t
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
const char *const start_event_t
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions) ...
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
std::vector< double > w3list
MC: atmospheric flux information.
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.