Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Functions
JPrintAAnet.cc File Reference

Example program to print track fit results from Evt formatted data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JSupport/JMultipleFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to print track fit results from Evt formatted data.

Author
mdejong

Definition in file JPrintAAnet.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 77 of file JPrintAAnet.cc.

78 {
79  using namespace std;
80  using namespace JPP;
81 
82  JMultipleFileScanner<Evt> inputFile;
83  JLimit_t& numberOfEvents = inputFile.getLimit();
84  int debug;
85 
86  try {
87 
88  JParser<> zap("Example program to print track fit results from Evt formatted data.");
89 
90  zap['f'] = make_field(inputFile);
91  zap['n'] = make_field(numberOfEvents) = JLimit::max();
92  zap['d'] = make_field(debug) = 2;
93 
94  zap(argc, argv);
95  }
96  catch(const exception& error) {
97  FATAL(error.what() << endl);
98  }
99 
100 
101  while (inputFile.hasNext()) {
102 
103  cout << "event " << setw(10) << inputFile.getCounter() << endl;
104 
105  const Evt* evt = inputFile.next();
106 
107  if (has_reconstructed_jppmuon(*evt)) {
108 
109  const Trk trk = get_best_reconstructed_jppmuon(*evt);
110 
111  print(cout, "", trk);
112  print(cout, "->", *evt, trk.mother_id);
113  }
114  }
115 }
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Utility class to parse command line options.
Definition: JParser.hh:1698
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:21
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:45
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:15
int mother_id
MC id of the parent particle.
Definition: Trk.hh:29
bool has_reconstructed_jppmuon(const Evt &evt)
Test whether given event has a track with muon reconstruction.
const Trk & get_best_reconstructed_jppmuon(const Evt &evt)
Get best reconstructed muon.