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