Jpp  18.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Functions
JMonteCarloFileSupportkit.hh File Reference
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "km3net-dataformat/offline/io_ascii.hh"
#include "JLang/JASCIIFileReader.hh"
#include "JLang/JGZFileReader.hh"
#include "JLang/JStreamObjectOutput.hh"
#include "JLang/JAbstractObjectIterator.hh"
#include "JLang/JObjectOutput.hh"
#include "JLang/JException.hh"
#include "JLang/JManip.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JHeadToolkit.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JSupport/JMonteCarloFileReader.hh"
#include "JSupport/JMonteCarloFileWriter.hh"
#include "JSupport/JMultipleFileScanner.hh"

Go to the source code of this file.

Classes

class  JSUPPORT::JMonteCarloFileReader< T, JFileReader_t >
 Template definition of Monte Carlo object reader. More...
 
class  JSUPPORT::JMonteCarloFileReader< Head, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Head. More...
 
class  JSUPPORT::JMonteCarloFileReader< Evt, JFileReader_t >
 Template specialisation of JMonteCarloFileReader for Event. More...
 
class  JSUPPORT::JMonteCarloASCIIFileReader< Head >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JSUPPORT::JMonteCarloASCIIFileReader< Evt >
 Template implementation of Monte Carlo object reader for ASCII formatted file (i.e. '.evt') More...
 
class  JSUPPORT::JMonteCarloGZFileReader< Head >
 Template implementation of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JSUPPORT::JMonteCarloGZFileReader< Evt >
 Template implementation of Monte Carlo object reader for gzipped ASCII formatted file (i.e. '.gz') More...
 
class  JSUPPORT::JMonteCarloStreamObjectOutput< Head >
 Template specialisation of JMonteCarloStreamObjectOutput for Head. More...
 
class  JSUPPORT::JMonteCarloStreamObjectOutput< Evt >
 Template specialisation of JMonteCarloStreamObjectOutput for Evt. More...
 
class  JSUPPORT::JMultipleFileScanner< Head >
 Template specialisation of JMultipleFileScanner for Monte Carlo header. More...
 

Namespaces

 JSUPPORT
 Support classes and methods for experiment specific I/O.
 
 JPP
 This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 

Functions

std::istream & operator>> (std::istream &in, Head &header)
 Read header from input. More...
 
std::ostream & operator<< (std::ostream &out, const MultiHead &header)
 Write multi-header to output. More...
 
std::istream & operator>> (std::istream &in, Evt &evt)
 Read event from input. More...
 
std::ostream & operator<< (std::ostream &out, const Evt &evt)
 Write event to output. More...
 
std::istream & operator>> (std::istream &in, Hit &hit)
 Read hit from input. More...
 
std::ostream & operator<< (std::ostream &out, const Hit &hit)
 Write hit to output. More...
 
Head JSUPPORT::getHeader (const JMultipleFileScanner_t &file_list)
 Get Monte Carlo header. More...
 
template<class JFunction_t >
JMultipleFileScanner_t JSUPPORT::getAAnetFiles (const JMultipleFileScanner_t &input, JFunction_t test)
 Get list of files compatible with geven header. More...
 

Function Documentation

std::istream& operator>> ( std::istream &  in,
Head header 
)
inline

Read header from input.

Author
mdejong
Parameters
ininput stream
headerheader
Returns
input stream

Definition at line 38 of file JMonteCarloFileSupportkit.hh.

39 {
40  header.clear();
41 
42  read(header, in);
43 
44  return in;
45 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
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
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const MultiHead header 
)
inline

Write multi-header to output.

Parameters
outoutput stream
headerheader
Returns
output stream

Definition at line 74 of file JMonteCarloFileSupportkit.hh.

75 {
76  for (MultiHead::const_iterator i = header.begin(); i != header.end(); ++i) {
77  write(*i, out);
78  }
79 
80  return out;
81 }
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Definition: io_ascii.hh:155
std::istream& operator>> ( std::istream &  in,
Evt evt 
)
inline

Read event from input.

Parameters
ininput stream
evtevent
Returns
input stream

Definition at line 91 of file JMonteCarloFileSupportkit.hh.

92 {
93  evt = Evt();
94 
95  read(evt, in, false);
96 
97  return in;
98 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
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
Definition: JCanberra.sh:46
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20
std::ostream& operator<< ( std::ostream &  out,
const Evt evt 
)
inline

Write event to output.

Parameters
outoutput stream
evtevent
Returns
output stream

Definition at line 108 of file JMonteCarloFileSupportkit.hh.

109 {
110  using namespace std;
111  using namespace JPP;
112 
113  const ios_base::fmtflags flags = out.flags();
114 
115  if (getLongprint(out)) {
116 
117  out << mc_keys::start_event_t << ' ' << evt.mc_id << ' ' << 1 << endl;
118 
119  for (const auto& trk : evt.mc_trks) {
120 
121  out << mc_keys::track_in_t << ' '
122  << trk.id << ' '
123  << trk.pos << ' '
124  << trk.dir << ' '
125  << trk.E << ' '
126  << trk.t << ' '
127  << is_initialstate(trk)
128  << is_finalstate (trk)
129  << endl;
130  }
131 
132  for (const auto& trk : evt.trks) {
133 
134  out << mc_keys::track_fit_t << ' '
135  << trk.id << ' '
136  << trk.pos << ' '
137  << trk.dir << ' '
138  << trk.E << ' '
139  << trk.t << endl;
140  }
141 
142  for (const auto& hit : evt.mc_hits) { write (hit, out, mc_keys::hit_t); }
143  for (const auto& hit : evt.hits) { write (hit, out, mc_keys::hit_raw_t); }
144 
145  out << mc_keys::weights_t; for (const auto& w : evt.w) { out << ' ' << w;} out << endl;
146  out << mc_keys::w2list_t; for (const auto& w : evt.w2list) { out << ' ' << w;} out << endl;
147  out << mc_keys::w3list_t; for (const auto& w : evt.w3list) { out << ' ' << w;} out << endl;
148 
149  out << mc_keys::eventtime_t << ' '
150  << evt.mc_event_time.GetSec() << ' '
151  << evt.mc_event_time.GetNanoSec() / 16 << endl;
152 
153  out << mc_keys::end_event_t << endl;
154 
155  } else {
156 
157  write(evt, out << fixed);
158  }
159 
160  out.flags(flags);
161 
162  return out;
163 }
data_type w[N+1][M+1]
Definition: JPolint.hh:778
const char *const w2list_t
Definition: io_ascii.hh:34
const char *const weights_t
Definition: io_ascii.hh:33
const char *const w3list_t
Definition: io_ascii.hh:35
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions) ...
Definition: Evt.hh:42
const char *const track_fit_t
Definition: io_ascii.hh:28
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
const char *const eventtime_t
Definition: io_ascii.hh:37
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition: Evt.hh:24
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
Definition: Evt.hh:46
bool getLongprint(std::ostream &out)
Get long print option.
Definition: JManip.hh:121
bool is_initialstate(const Trk &track)
Test whether given track corresponds to an initial state particle.
const char *const track_in_t
Definition: io_ascii.hh:26
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:39
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Definition: io_ascii.hh:155
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:48
const char *const hit_t
Definition: io_ascii.hh:24
const char *const end_event_t
Definition: io_ascii.hh:40
std::vector< Hit > hits
list of hits
Definition: Evt.hh:38
const char *const hit_raw_t
Definition: io_ascii.hh:25
const char *const start_event_t
Definition: io_ascii.hh:23
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions) ...
Definition: Evt.hh:43
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:49
std::vector< double > w3list
MC: atmospheric flux information.
Definition: Evt.hh:44
std::istream& operator>> ( std::istream &  in,
Hit hit 
)
inline

Read hit from input.

Parameters
ininput stream
hithit
Returns
input stream

Definition at line 173 of file JMonteCarloFileSupportkit.hh.

174 {
175  hit = Hit();
176 
177  read(hit, in, false);
178 
179  return in;
180 }
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
Definition: Hit.hh:8
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
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const Hit hit 
)
inline

Write hit to output.

Parameters
outoutput stream
hithit
Returns
output stream

Definition at line 190 of file JMonteCarloFileSupportkit.hh.

191 {
192  using namespace std;
193 
194  const ios_base::fmtflags flags = out.flags();
195 
196  write(hit, out << fixed);
197 
198  out.flags(flags);
199 
200  return out;
201 }
bool write(const Vec &v, std::ostream &os)
Write a Vec(tor) to a stream.
Definition: io_ascii.hh:155