Jpp 21.0.0
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)
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 << 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 << setw( 3) << trk.id << ' '
127 << setw(10) << trk.type << ' '
128 << setw( 3) << trk.mother_id << ' '
129 << FIXED(12,3) << trk.pos.x << ' '
130 << FIXED(12,3) << trk.pos.y << ' '
131 << FIXED(12,3) << trk.pos.z << ' '
132 << FIXED( 7,4) << trk.dir.x << ' '
133 << FIXED( 7,4) << trk.dir.y << ' '
134 << FIXED( 7,4) << trk.dir.z << ' '
135 << FIXED( 7,1) << trk.len << ' '
136 << SCIENTIFIC(12,3) << trk.E << ' '
137 << SCIENTIFIC(12,3) << trk.t << ' '
138 << setw( 4) << trk.status << ' '
139 << is_initialstate(trk)
140 << is_finalstate (trk)
141 << endl;
142 }
143
144 for (const auto& trk : evt.trks) {
145
146 out << mc_keys::track_fit_t << ' '
147 << setw(3) << trk.id << ' '
148 << FIXED(12,3) << trk.pos.x << ' '
149 << FIXED(12,3) << trk.pos.y << ' '
150 << FIXED(12,3) << trk.pos.z << ' '
151 << FIXED( 7,4) << trk.dir.x << ' '
152 << FIXED( 7,4) << trk.dir.y << ' '
153 << FIXED( 7,4) << trk.dir.z << ' '
154 << FIXED( 7,1) << trk.len << ' '
155 << SCIENTIFIC(12,3) << trk.E << ' '
156 << FIXED(10,1) << trk.t << ' '
157 << setw(3) << trk.status << endl;
158 }
159
160 for (const auto& hit : evt.mc_hits) { write (hit, out, mc_keys::hit_t); }
161 for (const auto& hit : evt.hits) { write (hit, out, mc_keys::hit_raw_t); }
162
163 out << mc_keys::weights_t; for (const auto& w : evt.w) { out << ' ' << w;} out << endl;
164 out << mc_keys::w2list_t; for (const auto& w : evt.w2list) { out << ' ' << w;} out << endl;
165 out << mc_keys::w3list_t; for (const auto& w : evt.w3list) { out << ' ' << w;} out << endl;
166
167 out << mc_keys::eventtime_t << ' '
168 << evt.mc_event_time.GetSec() << ' '
169 << evt.mc_event_time.GetNanoSec() / 16 << endl;
170
171 out << mc_keys::end_event_t << endl;
172
173 } else {
174
175 write(evt, out << fixed);
176 }
177
178 out.flags(flags);
179
180 return out;
181}
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
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488

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

192{
193 hit = Hit();
194
195 read(hit, in, false);
196
197 return in;
198}
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 208 of file JMonteCarloFileSupportkit.hh.

209{
210 using namespace std;
211
212 const ios_base::fmtflags flags = out.flags();
213
214 write(hit, out << fixed);
215
216 out.flags(flags);
217
218 return out;
219}