1#ifndef __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
2#define __JSUPPORT__JMONTECARLOFILESUPPORTKIT__
78 for (MultiHead::const_iterator i = header.begin(); i != header.end(); ++i) {
115 const ios_base::fmtflags flags = out.flags();
117 out << setw(15) << scientific << setprecision(5);
123 for (
const auto& trk : evt.
mc_trks) {
128 << trk.mother_id <<
' '
140 for (
const auto& trk : evt.
trks) {
149 << trk.status << endl;
167 write(evt, out << fixed);
187 read(hit, in,
false);
204 const ios_base::fmtflags flags = out.flags();
206 write(hit, out << fixed);
234 template<
class T,
template<
class>
class JFileReader_t>
244 template<
template<
class>
class JFileReader_t>
246 public JFileReader_t<Head>
253 JFileReader_t<
Head>(),
263 virtual void open(
const char* file_name)
override
265 JFileReader_t<Head>::open(file_name);
282 return JFileReader_t<Head>::hasNext();
301 template<
template<
class>
class JFileReader_t>
303 public JFileReader_t<Evt>
311 virtual void open(
const char* file_name)
override
315 JFileReader_t<Evt>::open(file_name);
317 if (this->is_open()) {
321 static_cast<istream&
>(*this) >> buffer;
462 using namespace JLANG;
468 unsigned int count = 0;
472 for (const_iterator i = this->begin(); i != this->end(); ++i) {
482 else if (header.
match(buffer))
485 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): inconsistent headers.");
493 copy(header,
object);
495 if (count != 0 && count != this->size()) {
497 THROW(
JException,
"JMultipleFileScanner<Head>::setObject(): missing header(s): " << count <<
" != " << this->size());
517 const Head* p = NULL;
519 if (!this->
hasNext() || (p = this->
next()) == NULL) {
563 if (!file_list.empty()) {
569 for (
size_t i = 1; i != file_list.size(); ++i) {
596 for (MultiHead::const_iterator i = p->cbegin(); i != p->cend(); ++i) {
600 multiHeader.
insert(header);
620 template<
class JFunction_t>
627 for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
650 for (JMultipleFileScanner_t::const_iterator i = file_list.cbegin(); i != file_list.cend(); ++i) {
655 categories.insert(cats.begin(), cats.end());
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
bool getLongprint(std::ostream &out)
Get long print option.
Scanning of objects from multiple files according a format that follows from the extension of each fi...
JHead & add(const JHead &header)
Addition of headers.
void createUUID()
Create UUID if not already set.
JHead getMatch(const JHead &header) const
Get matching fields.
bool match(const JHead &header) const
Test match of headers.
Object reading from ASCII file.
Object reading from gzipped file.
Exception for null pointer operation.
Abstract object iterator with rewinding.
Template implementation of stream output for single data type.
Object reading from file.
Template definition of Monte Carlo object reader for ASCII formatted file (i.e. '....
virtual void open(const char *file_name) override
Open file.
virtual bool hasNext() override
Check availability of next element.
virtual void open(const char *file_name) override
Open file.
JMonteCarloFileReader()
Default constructor.
Template definition of Monte Carlo object reader.
Template definition of Monte Carlo object reader for gzipped ASCII formatted file (i....
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
JMonteCarloStreamObjectOutput(std::ostream &out)
Constructor.
Template definition of Monte Carlo stream output for single data type.
const Head & getHeader()
Get Monte Carlo Header.
JMultipleFileScanner()
Default constructor.
JMultipleFileScanner(const JMultipleFileScanner_t &file_list)
Copy constructor.
virtual bool setObject(Head &object) override
Set object.
static bool merge
Allow merging of files w/o header.
virtual void rewind() override
Rewind.
General purpose class for object reading from a list of file names.
virtual void rewind() override
Rewind.
virtual bool hasNext() override
Check availability of next element.
virtual const pointer_type & next() override
Get next element.
JFileScanner< T > scanner
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
bool is_initialstate(const Trk &track)
Test whether given track corresponds to an initial state particle.
void copy(const Head &from, JHead &to)
Copy header from from to to.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
JMultiHead getMultiHeader(const JMultipleFileScanner_t &file_list)
Get multi-header corresponding to a given file list.
JMultipleFileScanner_t getAAnetFiles(const JMultipleFileScanner_t &input, JFunction_t test)
Get list of files compatible with geven header.
Head getCommonHeader(const JMultipleFileScanner_t &file_list)
Get common Monte Carlo header.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
JAANET::JEvtCategorySet getCategories(const JMultipleFileScanner_t &file_list)
Get the unique event categories corresponding to a given list of MC files.
JWriter & operator<<(JWriter &out, const JDAQChronometer &chronometer)
Write DAQ chronometer to output.
JReader & operator>>(JReader &in, JDAQChronometer &chronometer)
Read DAQ chronometer from input.
const char *const w3list_t
const char *const weights_t
const char *const eventtime_t
const char *const track_in_t
const char *const start_event_t
const char *const end_event_t
const char *const track_fit_t
const char *const w2list_t
const char *const hit_raw_t
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)
int mc_id
identifier of the MC event (as found in ascii or antcc file).
std::vector< Hit > hits
list of hits
std::vector< Hit > mc_hits
MC: list of MC truth hits.
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
std::vector< double > w3list
MC: atmospheric flux information.
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions)
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Helper class for event categories.
Container for a set of event categories.
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
bool insert(const JHead &header)
Insert the given header.
void merge(const JHead &header)
Merge the given header into this object.
Auxiliary base class for list of file names.