Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JPrintAAnet.cc File Reference

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

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JReconstruction/JEvtToolkit.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 83 of file JPrintAAnet.cc.

84{
85 using namespace std;
86 using namespace JPP;
87
89 JLimit_t& numberOfEvents = inputFile.getLimit();
90 vector<string> keys;
91 int debug;
92
93 try {
94
95 JParser<> zap("Example program to print track fit results from Evt formatted data.");
96
97 zap['f'] = make_field(inputFile);
98 zap['n'] = make_field(numberOfEvents) = JLimit::max();
99 zap['k'] = make_field(keys, "print optional weights: " << get_keys(getWeight)) = JPARSER::initialised();
100 zap['d'] = make_field(debug) = 2;
101
102 zap(argc, argv);
103 }
104 catch(const exception& error) {
105 FATAL(error.what() << endl);
106 }
107
108
109 while (inputFile.hasNext()) {
110
111 cout << "event " << setw(10) << inputFile.getCounter() << endl;
112
113 const Evt* evt = inputFile.next();
114
115 if (has_reconstructed_jppmuon(*evt)) {
116
117 const Trk trk = get_best_reconstructed_jppmuon(*evt);
118
119 print(cout, "", trk);
120 print(cout, "->", *evt, trk.mother_id);
121
122 for (const auto& key : keys) {
123 cout << ' ' << SCIENTIFIC(12,3) << getWeight(trk, key, 0.0);
124 }
125
126 cout << endl;
127 }
128
129 if (debug >= debug_t) {
130 for (const Trk& i : evt->trks) {
131 print(cout, "", i);
132 cout << endl;
133 }
134 }
135 }
136}
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:74
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2107
Utility class to parse command line options.
Definition JParser.hh:1664
General purpose class for object reading from a list of file names.
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, T __begin, T __end, const bool useColors=true, const JFormat_t &formatting=JFormat_t(18, 3, std::ios::fixed))
Print test summary.
@ debug_t
debug
Definition JMessage.hh:29
array_type< JKey_t > get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JRECONSTRUCTION::JWeight getWeight
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition Evt.hh:39
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:66
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary data structure for floating point format specification.
Definition JManip.hh:488
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
int mother_id
id of the parent MC particle or of the reconstructed track at the previous stage
Definition Trk.hh:29
const Trk & get_best_reconstructed_jppmuon(const Evt &evt)
Get best reconstructed muon.
bool has_reconstructed_jppmuon(const Evt &evt)
Test whether given event has a track with muon reconstruction.