Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JMonteCarloFileSupportkit.hh File Reference

Go to the source code of this file.

Classes

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

namespace  JSUPPORT
 Support classes and methods for experiment specific I/O.
 
namespace  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.
 
std::ostream & operator<< (std::ostream &out, const MultiHead &header)
 Write multi-header to output.
 
std::istream & operator>> (std::istream &in, Evt &evt)
 Read event from input.
 
std::ostream & operator<< (std::ostream &out, const Evt &evt)
 Write event to output.
 
std::istream & operator>> (std::istream &in, Hit &hit)
 Read hit from input.
 
std::ostream & operator<< (std::ostream &out, const Hit &hit)
 Write hit to output.
 
Head JSUPPORT::getHeader (const JMultipleFileScanner_t &file_list)
 Get Monte Carlo header.
 
Head JSUPPORT::getCommonHeader (const JMultipleFileScanner_t &file_list)
 Get common Monte Carlo header.
 
JMultiHead JSUPPORT::getMultiHeader (const JMultipleFileScanner_t &file_list)
 Get multi-header corresponding to a given file list.
 
template<class JFunction_t >
JMultipleFileScanner_t JSUPPORT::getAAnetFiles (const JMultipleFileScanner_t &input, JFunction_t test)
 Get list of files compatible with geven header.
 
JAANET::JEvtCategorySet JSUPPORT::getCategories (const JMultipleFileScanner_t &file_list)
 Get the unique event categories corresponding to a given list of MC files.
 

Function Documentation

◆ operator>>() [1/3]

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 40 of file JMonteCarloFileSupportkit.hh.

41{
42 header.clear();
43
44 read(header, in);
45
46 return in;
47}
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.

◆ operator<<() [1/3]

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 76 of file JMonteCarloFileSupportkit.hh.

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

◆ operator>>() [2/3]

std::istream & operator>> ( std::istream & in,
Evt & evt )
inline

Read event from input.

Parameters
ininput stream
evtevent
Returns
input stream

Definition at line 93 of file JMonteCarloFileSupportkit.hh.

94{
95 evt = Evt();
96
97 read(evt, in, false);
98
99 return in;
100}
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream & out,
const Evt & evt )
inline

Write event to output.

Parameters
outoutput stream
evtevent
Returns
output stream

Definition at line 110 of file JMonteCarloFileSupportkit.hh.

111{
112 using namespace std;
113 using namespace JPP;
114
115 const ios_base::fmtflags flags = out.flags();
116
117 out << setw(15) << scientific << setprecision(5);
118
119 if (getLongprint(out)) {
120
121 out << mc_keys::start_event_t << ' ' << evt.mc_id << ' ' << 1 << endl;
122
123 for (const auto& trk : evt.mc_trks) {
124
125 out << mc_keys::track_in_t << ' '
126 << trk.id << ' '
127 << trk.type << ' '
128 << trk.mother_id << ' '
129 << trk.pos << ' '
130 << trk.dir << ' '
131 << trk.len << ' '
132 << trk.E << ' '
133 << trk.t << ' '
134 << trk.status << ' '
135 << is_initialstate(trk)
136 << is_finalstate (trk)
137 << endl;
138 }
139
140 for (const auto& trk : evt.trks) {
141
142 out << mc_keys::track_fit_t << ' '
143 << trk.id << ' '
144 << trk.pos << ' '
145 << trk.dir << ' '
146 << trk.len << ' '
147 << trk.E << ' '
148 << trk.t << ' '
149 << trk.status << endl;
150 }
151
152 for (const auto& hit : evt.mc_hits) { write (hit, out, mc_keys::hit_t); }
153 for (const auto& hit : evt.hits) { write (hit, out, mc_keys::hit_raw_t); }
154
155 out << mc_keys::weights_t; for (const auto& w : evt.w) { out << ' ' << w;} out << endl;
156 out << mc_keys::w2list_t; for (const auto& w : evt.w2list) { out << ' ' << w;} out << endl;
157 out << mc_keys::w3list_t; for (const auto& w : evt.w3list) { out << ' ' << w;} out << endl;
158
159 out << mc_keys::eventtime_t << ' '
160 << evt.mc_event_time.GetSec() << ' '
161 << evt.mc_event_time.GetNanoSec() / 16 << endl;
162
163 out << mc_keys::end_event_t << endl;
164
165 } else {
166
167 write(evt, out << fixed);
168 }
169
170 out.flags(flags);
171
172 return out;
173}
bool getLongprint(std::ostream &out)
Get long print option.
Definition JManip.hh:121
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const char *const w3list_t
Definition io_ascii.hh:35
const char *const weights_t
Definition io_ascii.hh:33
const char *const eventtime_t
Definition io_ascii.hh:37
const char *const track_in_t
Definition io_ascii.hh:26
const char *const start_event_t
Definition io_ascii.hh:23
const char *const hit_t
Definition io_ascii.hh:24
const char *const end_event_t
Definition io_ascii.hh:40
const char *const track_fit_t
Definition io_ascii.hh:28
const char *const w2list_t
Definition io_ascii.hh:34
const char *const hit_raw_t
Definition io_ascii.hh:25
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
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition Evt.hh:24
std::vector< Hit > hits
list of hits
Definition Evt.hh:38
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition Evt.hh:48
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition Evt.hh:49
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
Definition Evt.hh:46
std::vector< double > w3list
MC: atmospheric flux information.
Definition Evt.hh:44
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 > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition Evt.hh:39

◆ operator>>() [3/3]

std::istream & operator>> ( std::istream & in,
Hit & hit )
inline

Read hit from input.

Parameters
ininput stream
hithit
Returns
input stream

Definition at line 183 of file JMonteCarloFileSupportkit.hh.

184{
185 hit = Hit();
186
187 read(hit, in, false);
188
189 return in;
190}
Definition Hit.hh:10

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream & out,
const Hit & hit )
inline

Write hit to output.

Parameters
outoutput stream
hithit
Returns
output stream

Definition at line 200 of file JMonteCarloFileSupportkit.hh.

201{
202 using namespace std;
203
204 const ios_base::fmtflags flags = out.flags();
205
206 write(hit, out << fixed);
207
208 out.flags(flags);
209
210 return out;
211}