Read event from a stream.
255{
257
258 string w;
259
260
261
263
264 int mc_event_type;
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
274
275 string w_old;
276
277 while ( is )
278 {
281
282 is >> w;
283
285 is.ignore( 1000, '\n' );
286 continue;
287 }
288
290
293
295
297 evt.
hits.push_back( h );
298
304
309
310 string line;
312 istringstream ii(line);
313
316 } else {
318 }
319
321
322 if (!ii.fail()) {
323
325
327
329
330 if (!ii.fail()) {
331
333
335
336 if ( ii.fail() ) {
338 continue;
339 }
340
341 double eloss = 0;
342 ii >> eloss;
343
344 if ( ii.fail() ) {
346 continue;
347 }
348
350
352 }
353
355
357
358 evt.
trks.push_back( t );
359
361
363
364
366
373
374 trk_nu = t;
375 have_trk_nu = true;
376
378
380
381 ii >> t.
t >> trk_primary.
type;
382
383 trk_primary = t;
384 have_trk_primary = true;
385
387
390
392
393 } else {
394
396 out << "Unknown tag " << w << " for trk ";
398 throw Exception(
static_cast<ostringstream&
>(out).str());
399 }
400 }
401
402 if ( ii.fail() ) {
404 out << "Error reading trk ";
406 throw Exception(
static_cast<ostringstream&
>(out).str());
407 }
408
410
412
414
416 evt.
w2list.resize( std::max( evt.
w2list.size(), v.size()));
417 std::copy( v.begin(), v.end() , evt.
w2list.begin() );
418
420
422
424
425 double ha;
426 is >> ha;
428
430
431
432
433
434
435
437
438 if ( v.size() > 3 ) {
442 }
443
445
446 unsigned nsec, n16ns_ticks;
447 is >> nsec >> n16ns_ticks;
450
452
453
455 if ( v.size() > 4 )
456 {
460 }
461
463
464
465
466
467
468
469
470
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) {
481 }
482
485
486 } else if ( have_trk_primary ) {
487
490
491 } else if ( have_trk_nu ) {
492
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()) {
508 }
509
510 return false;
511}
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static std::ostream & getOstream()
Get output stream for conversion of exception.
void push_front(std::vector< T > &vec, const T &value)
Put value in front of data.
std::vector< double > read_line_to_vector(std::istream &is)
Read data.
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
const char *const w3list_t
const char *const neutrino_t
const char *const weights_t
const char *const center_on_can_t
const char *const eventtime_t
const char *const track_in_t
const char *const track_t
const char *const muon_decay_t
const char *const start_event_t
const char *const hourangle_t
const char *const track_bundle_t
const char *const end_event_t
const char *const w2list_t
const char *const track_primary_t
const char *const center_on_can_y
const char *const muon_decay_y
const char *const energy_lost_in_can
const char *const center_on_can_x
const char *const muon_decay_z
const char *const muon_decay_x
const char *const hourangle
const char *const center_on_can_z
void clearusr()
Clear user data.
void setusr(const std::string &key, double value)
Set user data item with given key.
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)
int mc_id
identifier of the MC event (as found in ascii or antcc file).
std::vector< Hit > hits
list of hits
std::vector< Hit > mc_hits
MC: list of MC truth hits.
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
int id
offline event identifier
TTimeStamp mc_event_time
MC: true generation time (UTC) of the event, (default: 01 Jan 1970 00:00:00)
std::vector< double > w3list
MC: atmospheric flux information.
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions)
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
void print(std::ostream &out=std::cout) const
Print track.
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
int type
MC: particle type in PDG encoding.
std::string comment
use as you like
double E
Energy [GeV] (either MC truth or reconstructed)
double t
track time [ns] (when the particle is at pos )
double len
length, if applicable [m]
Vec pos
postion [m] of the track at time t
static const int PDG_MUONBUNDLE
muon bundle reached the can level (mupage)
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation ('track_in' tag in evt files)....
static const int TRK_ST_MUONBUNDLE
initial state muon bundle (mupage)
static const int TRK_ST_PRIMARYCOSMIC
initial state cosmic ray ('track_primary' tag in evt files from corant).
static const int TRK_ST_PRIMARYNEUTRINO
initial state neutrino ('neutrino' tag in evt files from gseagen and genhen).
static const int W2LIST_GSEAGEN_BX
Bjorken x.
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
static const int W2LIST_GSEAGEN_ICHAN
Interaction channel.
static const int W2LIST_GSEAGEN_BY
Bjorken y.