Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
io_ascii.hh
Go to the documentation of this file.
1 #ifndef IO_ASCII_INCLUDED
2 #define IO_ASCII_INCLUDED
3 
4 #include <string>
5 #include <istream>
6 #include <ostream>
7 #include <sstream>
8 
16 
17 #include "TDatabasePDG.h"
18 
19 namespace mc_keys
20 {
21 const char* const auto_t = "auto";
22 const char* const start_run_t = "start_run:";
23 const char* const start_event_t = "start_event:";
24 const char* const hit_t = "hit:";
25 const char* const hit_raw_t = "hit_raw:";
26 const char* const track_in_t = "track_in:";
27 const char* const track_t = "track:";
28 const char* const track_fit_t = "track_fit:";
29 const char* const neutrino_t = "neutrino:";
30 const char* const track_primary_t = "track_primary:";
31 const char* const track_bundle_t = "track_bundle:";
32 //const char* const primarylepton_t = "primarylepton:";
33 const char* const weights_t = "weights:";
34 const char* const w2list_t = "w2list:";
35 const char* const w3list_t = "w3list:";
36 const char* const hourangle_t = "hourangle:";
37 const char* const eventtime_t = "eventtime:";
38 const char* const center_on_can_t = "center_on_can:";
39 const char* const muon_decay_t = "muon_decay:";
40 const char* const end_event_t = "end_event:";
41 }
42 
43 namespace mc_usr_keys
44 {
45 // track-level quantities
46 const char* const energy_lost_in_can = "energy_lost_in_can";
47 
48 
49 // event-level corsika variables
50 const char* const muon_decay_x = "muon_decay_x";
51 const char* const muon_decay_y = "muon_decay_y";
52 const char* const muon_decay_z = "muon_decay_z";
53 
54 const char* const center_on_can_x = "center_on_can_x";
55 const char* const center_on_can_y = "center_on_can_y";
56 const char* const center_on_can_z = "center_on_can_z";
57 const char* const hourangle = "hourangle";
58 }
59 
60 
61 namespace io_stringutil
62 {
63 /**
64  * Check if string starts with given text.
65  *
66  * \param a input string
67  * \param b text
68  * \return true if string start with text; else false
69  */
70 inline bool startswith( const std::string& a, const std::string& b )
71 {
72  if ( a.find( b ) == 0 ) return true;
73  return false;
74 }
75 
76 /**
77  * Remove leading and trailing white spaces.
78  *
79  * \param s input string
80  * \return trimmed string
81  */
82 inline std::string trim(const std::string& s)
83 {
84  using namespace std;
85 
86  if ( s == "" ) return s;
87 
88  string::size_type i1;
89  string::size_type i2;
90 
91  for (i1 = 0; i1 < s.length(); i1++)
92  {
93  if ( !isspace (s[i1]) ) break;
94  }
95  for (i2 = s.length() - 1 ; i2 > i1 ; i2--)
96  {
97  if ( !isspace (s[i2]) ) break;
98  }
99  return s.substr( i1, i2 - i1 + 1 );
100 }
101 
102 }
103 
104 
105 /**
106  * Convert Geant3 to PDG particle type.
107  *
108  * \param geant3_code Geant3 code
109  * \return PDG code
110  */
111 inline int pdg_code( int geant3_code )
112 {
113  if ( geant3_code == -1 ) return -1; // used for k40 hits
114  if ( geant3_code < 0 ) return pdg_code( -geant3_code ); // used for scattered
115 
116  return TDatabasePDG::Instance()->ConvertGeant3ToPdg( geant3_code );
117 }
118 
119 /**
120  * Convert PDG to Geant3 particle type.
121  *
122  * \param pdg_code PDG code
123  * \return Geant3 code
124  */
125 inline int geant3_code( int pdg_code )
126 {
127  if (pdg_code == -1 ) return -1;
128  if (pdg_code == +311 ) return geant3_code( 130 ); // K0 -> K0long
129  if (pdg_code == -311 ) return geant3_code( 130 ); // K0bar -> K0long
130 
131  return TDatabasePDG::Instance()->ConvertPdgToGeant3( pdg_code );
132 }
133 
134 
135 /**
136  * Read a Vec(tor) from a stream.
137  *
138  * \param v vector
139  * \param is input stream
140  * \return true if correctly read; else false
141  */
142 inline bool read ( Vec& v, std::istream& is)
143 {
144  is >> v.x >> v.y >> v.z;
145  return !is.fail();
146 }
147 
148 /**
149  * Write a Vec(tor) to a stream.
150  *
151  * \param v vector
152  * \param os output stream
153  * \return true if correctly written; else false
154  */
155 inline bool write( const Vec& v, std::ostream& os)
156 {
157  os << v.x << ' ' << v.y << ' ' << v.z;
158  return !os.fail();
159 }
160 
161 /**
162  * Read a hit from a stream.
163  *
164  * \param h hit
165  * \param is input stream
166  * \param read_mc option to read also type and origin
167  * \return true if correctly read; else false
168  */
169 inline bool read ( Hit& h, std::istream& is, bool read_mc = false )
170 {
171  h.dom_id = 0; // need a proper det file to
172  h.channel_id = 0; // set these.
173 
174  is >> h.id >> h.pmt_id >> h.a >> h.t;
175  if ( !read_mc )
176  {
177  return !is.fail();
178  }
179  else
180  {
181  is >> h.type >> h.origin;
182  }
183 
184  // at this point, an additional pure_a and pure_t may be present,
185  // but we do not read them.
186 
187  return !is.fail();
188 }
189 
190 
191 /**
192  * Write a hit to a stream.
193  *
194  * \param h hit
195  * \param os output stream
196  * \param tag tag
197  * \return true if correctly written; else false
198  */
199 inline bool write( const Hit& h, std::ostream& os, const std::string& tag = mc_keys::hit_t)
200 {
201  int om_id = h.pmt_id; // todo: deal with this better.
202 
203  os << tag << ' ' << h.id << ' ' << om_id << ' ' << h.a << ' ' << h.t;
204  if ( tag != mc_keys::hit_raw_t ) {
205  os << ' ' << h.type << ' ' << h.origin; // not writing pure_a and pure_t
206  }
207  os << std::endl;
208  return !os.fail();
209 }
210 
211 
212 /**
213  * Read data.
214  *
215  * \param is input stream
216  * \return data
217  */
219 {
220  using namespace std;
221 
223 
224  string ss;
225  getline(is, ss);
226  istringstream il(ss);
227  for ( double x; il >> x ; ) r.push_back( x );
228 
229  return r;
230 }
231 
232 
233 /**
234  * Put value in front of data.
235  *
236  * \param vec data
237  * \param value value
238  */
239 template<typename T>
240 inline void push_front( std::vector<T>& vec, const T& value )
241 {
242  vec.insert( vec.begin(), value );
243 }
244 
245 
246 /**
247  * Read event from a stream.
248  *
249  * \param evt event
250  * \param is input stream
251  * \param skip_hits option to skip reading of hits
252  * \return true if correctly read; else false
253  */
254 inline bool read ( Evt& evt, std::istream& is, bool skip_hits = false )
255 {
256  using namespace std;
257 
258  string w;
259 
260  // find next start_event
261 
262  while ( w != mc_keys::start_event_t && is.good() ) is >> w;
263 
264  int mc_event_type; // dummy - this is always 1 in all files.
265  is >> evt.mc_id >> mc_event_type;
266 
267  Trk trk_nu, trk_primary;
268  bool have_trk_nu(false), have_trk_primary(false);
269 
270 
271  evt.mc_trks.clear();
272  evt.hits.clear();
273  evt.mc_hits.clear();
274 
275  string w_old;
276 
277  while ( is )
278  {
279  static Hit h;
280  static Trk t;
281 
282  is >> w;
283 
284  if (skip_hits && ( w == mc_keys::hit_t || w == mc_keys::hit_raw_t)) {
285  is.ignore( 1000, '\n' );
286  continue;
287  }
288 
289  if ( w == mc_keys::hit_t ) {
290 
291  read( h, is, true );
292  evt.mc_hits.push_back( h );
293 
294  } else if ( w == mc_keys::hit_raw_t ) {
295 
296  read( h, is, false);
297  evt.hits.push_back( h );
298 
299  } else if ( w == mc_keys::track_in_t ||
300  w == mc_keys::track_t ||
301  w == mc_keys::neutrino_t ||
303  w == mc_keys::track_primary_t ) {
304 
305  t.id = 0;
306  t.len = 0.0;
307  t.clearusr();
308  t.comment = w;
309 
310  string line;
311  getline( is, line );
312  istringstream ii(line);
313 
314  if ( w != mc_keys::track_bundle_t ) {
315  ii >> t.id;
316  } else {
317  ii >> t.len;
318  }
319 
320  ii >> t.pos >> t.dir >> t.E;
321 
322  if (!ii.fail()) {
323 
324  if ( w == mc_keys::track_in_t) {
325 
327 
328  ii >> t.t >> t.type;
329 
330  if (!ii.fail()) {
331 
332  t.type = pdg_code( t.type );
333 
334  ii >> t.len;
335 
336  if ( ii.fail() ) { // missing length is not an error
337  evt.mc_trks.push_back( t );
338  continue;
339  }
340 
341  double eloss = 0;
342  ii >> eloss;
343 
344  if ( ii.fail() ) { // missing eloss is not an error
345  evt.mc_trks.push_back( t );
346  continue;
347  }
348 
350 
351  evt.mc_trks.push_back( t );
352  }
353 
354  } else if ( w == mc_keys::track_t ) {
355 
356  ii >> t.t;
357 
358  evt.trks.push_back( t );
359 
360  } else if ( w == mc_keys::neutrino_t ) {
361 
363 
364  // the last item we will read is W2LIST_GSEAGEN_CC, make enough space;
365  if (evt.w2list.size() < W2LIST_GSEAGEN_CC+1 ) evt.w2list.resize(W2LIST_GSEAGEN_CC+1);
366 
367  ii >> t.t >>
368  evt.w2list[W2LIST_GSEAGEN_BX] >>
369  evt.w2list[W2LIST_GSEAGEN_BY] >>
371  t.type >>
373 
374  trk_nu = t;
375  have_trk_nu = true;
376 
377  } else if ( w == mc_keys::track_primary_t ) {
378 
380 
381  ii >> t.t >> trk_primary.type; // nucleus id (in pdg format or not?)
382 
383  trk_primary = t;
384  have_trk_primary = true;
385 
386  } else if ( w == mc_keys::track_bundle_t ) {
387 
388  t.type = PDG_MUONBUNDLE;
390 
391  evt.mc_trks.push_back( t );
392 
393  } else {
394 
395  ostream& out = Exception::getOstream();
396  out << "Unknown tag " << w << " for trk ";
397  t.print(out);
398  throw Exception(static_cast<ostringstream&>(out).str());
399  }
400  }
401 
402  if ( ii.fail() ) {
403  ostream& out = Exception::getOstream();
404  out << "Error reading trk ";
405  t.print(out);
406  throw Exception(static_cast<ostringstream&>(out).str());
407  }
408 
409  } else if ( w == mc_keys::weights_t) {
410 
411  evt.w = read_line_to_vector( is );
412 
413  } else if ( w == mc_keys::w2list_t) {
414 
415  auto v = read_line_to_vector( is );
416  evt.w2list.resize( std::max( evt.w2list.size(), v.size()));
417  std::copy( v.begin(), v.end() , evt.w2list.begin() );
418 
419  } else if ( w == mc_keys::w3list_t) {
420 
421  evt.w3list = read_line_to_vector( is );
422 
423  } else if ( w == mc_keys::hourangle_t ) {
424 
425  double ha;
426  is >> ha;
427  evt.setusr(mc_usr_keys::hourangle, ha );
428 
429  } else if ( w == mc_keys::center_on_can_t) {
430 
431  // in corsika files, there is the (undocumented?) center_on_can tag,
432  // which denoets the projection of the primary on the can. The direction
433  // of the center_on_can 'track' is by defintion the direction of the
434  // primary. We record the position in the usr data.
435 
437 
438  if ( v.size() > 3 ) {
442  }
443 
444  } else if ( w == mc_keys::eventtime_t ) {
445 
446  unsigned nsec, n16ns_ticks;
447  is >> nsec >> n16ns_ticks;
448  evt.mc_event_time.SetSec( nsec );
449  evt.mc_event_time.SetNanoSec( n16ns_ticks * 16 );
450 
451  } else if ( w == mc_keys::muon_decay_t) {
452 
453  // in km3sim files, there are additional tags, including this one
455  if ( v.size() > 4 )
456  {
457  evt.setusr(mc_usr_keys::muon_decay_x, v[2] );
458  evt.setusr(mc_usr_keys::muon_decay_y, v[3] );
459  evt.setusr(mc_usr_keys::muon_decay_z, v[4] );
460  }
461 
462  } else if ( w == mc_keys::end_event_t) {
463 
464  // finalize the mc_tracks -- as best we can.
465 
466  // If there is both a primary, and a neutrino, then the primary
467  // will go second (mc_trks[1]) with id=-1 and the neutrino will
468  // be mc_trks[0] with id=0. Unless they are same particle (identical
469  // pos,dir,E); in that case the primary is skipped.
470  // The primarylepton tag is not stored as a seperate Trk.
471 
472  if ( have_trk_primary && have_trk_nu ) {
473 
474  bool same = trk_nu.pos == trk_primary.pos &&
475  trk_nu.dir == trk_primary.dir &&
476  trk_nu.E == trk_primary.E;
477 
478  if (!same) {
479  trk_primary.id = -1;
480  push_front( evt.mc_trks, trk_primary);
481  }
482 
483  trk_nu.id = 0;
484  push_front( evt.mc_trks, trk_nu);
485 
486  } else if ( have_trk_primary ) {
487 
488  trk_primary.id = 0;
489  push_front( evt.mc_trks, trk_primary);
490 
491  } else if ( have_trk_nu ) {
492 
493  trk_nu.id = 0;
494  push_front( evt.mc_trks, trk_nu);
495  }
496 
497  return true;
498 
499  } else {
500  is.ignore( 1000, '\n' );
501  }
502 
503  w_old = w;
504  }
505 
506  if (!is.eof()) {
507  THROW(Exception, "Error while reading ascii event" << w << ' ' << evt.id);
508  }
509 
510  return false;
511 }
512 
513 
514 /**
515  * Write event to a stream.
516  *
517  * \param evt event
518  * \param os output stream
519  * \return true if correctly read; else false
520  */
521 inline bool write( const Evt& evt, std::ostream& os )
522 {
523  using namespace std;
524 
525  // set precision to 12 digits.
526  const int precision = 12;
527  auto old_flags = os.flags();
528  auto old_precision = os.precision( precision );
529  os.unsetf( std::ios_base::scientific | std::ios_base::fixed ); // default behaviour
530 
531  os << mc_keys::start_event_t << ' ' << evt.mc_id << ' ' << 1 << endl;
532 
533  for ( auto& trk : evt.mc_trks ) {
534 
535  const std::string& tag = trk.comment;
536 
537  os << tag << ' '
538  << (tag != mc_keys::track_bundle_t ? trk.id : trk.len) << ' '
539  << trk.pos << ' '
540  << trk.dir << ' '
541  << trk.E;
542 
543  if ( tag == mc_keys::track_in_t ) {
544 
545  os << ' ' << trk.t << ' ' << geant3_code(trk.type) << ' ' << trk.len;
546 
547  if ( trk.haveusr( mc_usr_keys::energy_lost_in_can ) ) {
548  os << ' ' << trk.getusr( mc_usr_keys::energy_lost_in_can );
549  }
550 
551  os << endl;
552 
553  } else if ( tag == mc_keys::track_primary_t ) {
554 
555  os << ' ' << trk.t << ' ' << trk.type << endl;
556 
557  } else if ( tag == mc_keys::neutrino_t ) {
558 
559  double bx(0), by(0);
560  int ichan(0), cc(0);
561 
562  if ( evt.w2list.size() > W2LIST_GSEAGEN_CC ) {
563  bx = evt.w2list[W2LIST_GSEAGEN_BX];
564  by = evt.w2list[W2LIST_GSEAGEN_BY];
565  ichan = evt.w2list[W2LIST_GSEAGEN_ICHAN];
566  cc = evt.w2list[W2LIST_GSEAGEN_CC];
567  }
568 
569  os << ' ' << trk.t
570  << ' ' << bx
571  << ' ' << by
572  << ' ' << ichan
573  << ' ' << trk.type
574  << ' ' << cc
575  << endl;
576 
577  } else {
578 
579  os << endl;
580  }
581  }
582 
583  for ( auto& trk : evt.trks ) {
584  os << mc_keys::track_fit_t << ' ' << trk.id << ' ' << trk.pos << ' ' << trk.dir << ' ' << trk.E << ' ' << trk.t << endl;
585  }
586 
587  for ( auto& hit : evt.mc_hits ) write ( hit, os, mc_keys::hit_t);
588  for ( auto& hit : evt.hits ) write ( hit, os, mc_keys::hit_raw_t);
589 
590  os << mc_keys::weights_t; for (auto& w : evt.w ) os << ' ' << w; os << endl;
591  os << mc_keys::w2list_t; for (auto& w : evt.w2list ) os << ' ' << w; os << endl;
592  os << mc_keys::w3list_t; for (auto& w : evt.w3list ) os << ' ' << w; os << endl;
593 
594  os << mc_keys::eventtime_t << evt.mc_event_time.GetSec() << " "
595  << evt.mc_event_time.GetNanoSec() / 16 << endl;
596 
597  os << mc_keys::end_event_t << endl;
598 
599  // restore os to how we found it.
600  os.flags( old_flags );
601  os.precision( old_precision );
602 
603  return true;
604 }
605 
606 
607 
608 /**
609  * Read header from a stream.
610  *
611  * The stream may be positioned at any point before the tag mc_keys::start_run_t,
612  * which marks the beginning of the header.
613  * Information before the header (if any) is disgarded.
614  *
615  * \param hdr header
616  * \param is input stream
617  * \return true if correctly read; else false
618  */
619 inline bool read( Head& hdr, std::istream& is )
620 {
621  using namespace std;
622 
623  string line;
624 
625  bool start = false;
626 
627  while (getline( is, line ))
628  {
630  {
631  break;
632  }
633 
635  {
636  start = true;
637  }
638 
640  {
641  THROW(Exception, "Unexpected tag " << mc_keys::start_event_t << " found while reading header at " << line << " (could mean the evt file has no header)");
642  }
643 
644  if (!start) continue;
645 
646  vector<string> v = splitstring( line, ':' );
647  if (v.size() < 2 )
648  {
649  std::cout << "Warning: line with empty tag found when reading header" << endl;
650  std::cout << " "<< line << endl;
651  std::cout << " will be skipped" << endl;
652  continue;
653  }
654 
655  // the following with unsure key in the map is unique by adding _1 _2 etc.
657 
658  }
659 
660  if (!start)
661  {
662  THROW(Exception, "Reading of MC header terminated before finding a start_run: tag. Please check your file");
663  }
664 
665  return start;
666 }
667 
668 
669 /**
670  * Write header to a stream.
671  *
672  * \param hdr header
673  * \param os output stream
674  * \return true if correctly written; else false
675  */
676 inline bool write( const Head& hdr, std::ostream& os )
677 {
678  hdr.print(os);
679  return true;
680 }
681 
682 #endif
void setusr(const std::string &key, double value)
Set user data item with given key.
Definition: AAObject.hh:95
const char *const energy_lost_in_can
Definition: io_ascii.hh:46
static const int W2LIST_GSEAGEN_BX
Bjorken x.
data_type w[N+1][M+1]
Definition: JPolint.hh:867
const char *const w2list_t
Definition: io_ascii.hh:34
const char *const center_on_can_y
Definition: io_ascii.hh:55
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
const char *const weights_t
Definition: io_ascii.hh:33
const char *const muon_decay_x
Definition: io_ascii.hh:50
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:19
double z
Definition: Vec.hh:14
int pdg_code(int geant3_code)
Convert Geant3 to PDG particle type.
Definition: io_ascii.hh:111
const char *const neutrino_t
Definition: io_ascii.hh:29
const char *const center_on_can_z
Definition: io_ascii.hh:56
Vec dir
track direction
Definition: Trk.hh:18
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
std::string comment
use as you like
Definition: Trk.hh:35
const char *const w3list_t
Definition: io_ascii.hh:35
int pmt_id
global PMT identifier as found in evt files
Definition: Hit.hh:20
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 muon_decay_t
Definition: io_ascii.hh:39
const char *const track_fit_t
Definition: io_ascii.hh:28
data_type r[M+1]
Definition: JPolint.hh:868
const char *const muon_decay_y
Definition: io_ascii.hh:51
is
Definition: JDAQCHSM.chsm:167
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double y
Definition: Vec.hh:14
int origin
track id of the track that created this hit (mc only)
Definition: Hit.hh:29
void clearusr()
Clear user data.
Definition: AAObject.hh:139
const char *const hourangle
Definition: io_ascii.hh:57
double a
hit amplitude (in p.e.)
Definition: Hit.hh:24
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
int geant3_code(int pdg_code)
Convert PDG to Geant3 particle type.
Definition: io_ascii.hh:125
const char *const eventtime_t
Definition: io_ascii.hh:37
static const int PDG_MUONBUNDLE
muon bundle reached the can level (mupage)
Definition: trkmembers.hh:38
static const int W2LIST_GSEAGEN_ICHAN
Interaction channel.
then JCalibrateToT a
Definition: JTuneHV.sh:107
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
do set_variable OUTPUT_DIRECTORY $WORKDIR T
const char *const hourangle_t
Definition: io_ascii.hh:36
void print(std::ostream &out=std::cout) const
Print header.
Definition: Head.hh:299
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
double len
length, if applicable [m]
Definition: Trk.hh:22
static const int TRK_ST_PRIMARYNEUTRINO
initial state neutrino (&#39;neutrino&#39; tag in evt files from gseagen and genhen).
Definition: trkmembers.hh:16
static const int TRK_ST_MUONBUNDLE
initial state muon bundle (mupage)
Definition: trkmembers.hh:18
static const int TRK_ST_PRIMARYCOSMIC
initial state cosmic ray (&#39;track_primary&#39; tag in evt files from corant).
Definition: trkmembers.hh:17
std::string set_line(std::string tag, std::string line, bool ensure_unique=true)
Set data with the given tag.
Definition: Head.hh:177
int id
Definition: Hit.hh:11
bool startswith(const std::string &a, const std::string &b)
Check if string starts with given text.
Definition: io_ascii.hh:70
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Definition: Head.hh:65
const char *const track_bundle_t
Definition: io_ascii.hh:31
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:24
int id
track identifier
Definition: Trk.hh:16
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition: Trk.hh:28
const char *const center_on_can_t
Definition: io_ascii.hh:38
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
static const int W2LIST_GSEAGEN_BY
Bjorken y.
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation (&#39;track_in&#39; tag in evt files)...
Definition: trkmembers.hh:15
const char *const center_on_can_x
Definition: io_ascii.hh:54
Vec pos
postion [m] of the track at time t
Definition: Trk.hh:17
const char *const track_in_t
Definition: io_ascii.hh:26
Definition: Hit.hh:8
const char *const track_t
Definition: io_ascii.hh:27
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:39
General exception.
Definition: Exception.hh:13
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
double t
hit time (from tdc+calibration or MC truth)
Definition: Hit.hh:23
int dom_id
module identifier from the data (unique in the detector).
Definition: Hit.hh:14
then fatal Wrong number of arguments fi set_variable ARCHIVE $argv[1] set_variable VERSION $argv[2] set_variable DIR $argv[3] source JAcousticsToolkit sh set_variable DETECTOR $DIR $ACOUSTICS_DETECTOR if[[!-f $DETECTOR]]
const char *const muon_decay_z
Definition: io_ascii.hh:52
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
void push_front(std::vector< T > &vec, const T &value)
Put value in front of data.
Definition: io_ascii.hh:240
const char *const hit_t
Definition: io_ascii.hh:24
int id
offline event identifier
Definition: Evt.hh:22
unsigned int channel_id
PMT channel id {0,1, .., 30} local to moduke.
Definition: Hit.hh:15
void print(std::ostream &out=std::cout) const
Print track.
Definition: Trk.hh:182
const char *const track_primary_t
Definition: io_ascii.hh:30
const char *const end_event_t
Definition: io_ascii.hh:40
std::vector< double > read_line_to_vector(std::istream &is)
Read data.
Definition: io_ascii.hh:218
std::vector< Hit > hits
list of hits
Definition: Evt.hh:38
const char *const start_run_t
Definition: io_ascii.hh:22
std::string trim(const std::string &s)
Remove leading and trailing white spaces.
Definition: io_ascii.hh:82
data_type v[N+1][M+1]
Definition: JPolint.hh:866
static std::ostream & getOstream()
Get output stream for conversion of exception.
Definition: Exception.hh:63
const char *const hit_raw_t
Definition: io_ascii.hh:25
std::vector< std::string > splitstring(const std::string &str, char delim= ' ')
Split string at delimiter.
Definition: Head.hh:44
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
const char *const start_event_t
Definition: io_ascii.hh:23
int type
particle type or parametrisation used for hit (mc only)
Definition: Hit.hh:28
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
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20
const char *const auto_t
Definition: io_ascii.hh:21