1 #ifndef __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
2 #define __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
76 for (MultiHead::const_iterator
i = header.begin();
i != header.end(); ++
i) {
113 const ios_base::fmtflags flags = out.flags();
119 for (
const auto& trk : evt.
mc_trks) {
132 for (
const auto& trk : evt.
trks) {
157 write(evt, out << fixed);
177 read(hit, in,
false);
194 const ios_base::fmtflags flags = out.flags();
196 write(hit, out << fixed);
204 namespace JSUPPORT {}
205 namespace JPP {
using namespace JSUPPORT; }
221 template<
class T,
template<
class>
class JFileReader_t>
231 template<
template<
class>
class JFileReader_t>
233 public JFileReader_t<Head>
240 JFileReader_t<
Head>(),
250 virtual void open(
const char* file_name)
override
269 return JFileReader_t<Head>::hasNext();
288 template<
template<
class>
class JFileReader_t>
290 public JFileReader_t<Evt>
298 virtual void open(
const char* file_name)
override
304 if (this->is_open()) {
308 static_cast<istream&
>(*this) >> buffer;
449 using namespace JLANG;
455 unsigned int count = 0;
459 for (const_iterator
i = this->begin();
i != this->end(); ++
i) {
461 scanner.
open(
i->c_str());
463 if (scanner.hasNext()) {
465 const JHead buffer = *scanner.next();
469 else if (header.match(buffer))
472 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
480 copy(header,
object);
482 if (count != 0 && count != this->size()) {
484 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
504 const Head* p = NULL;
506 if (!this->hasNext() || (p = this->next()) == NULL) {
549 template<
class JFunction_t>
556 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
#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
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.
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).
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.
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.