Jpp
Functions
JPrintFit.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include "TROOT.h"
#include "TFile.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "km3net-dataformat/offline/io_ascii.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JHeadToolkit.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JTrigger/JTimeConverter.hh"
#include "JSupport/JParallelFileScanner.hh"
#include "JSupport/JTreeScanner.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.hh"
#include "JFit/JEvt.hh"
#include "JFit/JEvtToolkit.hh"
#include "JFit/JFitParameters.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 Auxiliary program to print fit results;. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Auxiliary program to print fit results;.

Definition at line 83 of file JPrintFit.cc.

84 {
85  using namespace std;
86  using namespace JPP;
87  using namespace KM3NETDAQ;
88 
89  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
90  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
91 
92  JParallelFileScanner_t inputFile;
93  JLimit_t& numberOfEvents = inputFile.getLimit();
95  size_t numberOfFits;
96  int debug;
97 
98  try {
99 
100  JParser<> zap("Auxiliary program to print fit results.");
101 
102  zap['f'] = make_field(inputFile);
103  zap['n'] = make_field(numberOfEvents) = JLimit::max();
105  zap['N'] = make_field(numberOfFits) = 1;
106  zap['d'] = make_field(debug) = 2;
107 
108  zap(argc, argv);
109  }
110  catch(const exception& error) {
111  FATAL(error.what() << endl);
112  }
113 
114 
115 
116  const int WIDTH = 16;
117 
118  JTreeScanner<Evt> mc(inputFile);
119 
120  JPosition3D center(0,0,0);
121 
122  try {
123  center = get<JPosition3D>(getHeader(inputFile));
124  } catch(const exception& error) {}
125 
126 
127  while (inputFile.hasNext()) {
128 
129  cout << "event: " << setw(10) << inputFile.getCounter() << endl;
130 
131  multi_pointer_type ps = inputFile.next();
132 
133  JDAQEvent* tev = ps;
134  JEvt* evt = ps;
135 
136  if (quality_sorter.is_valid()) {
137  sort(evt->begin(), evt->end(), quality_sorter);
138  }
139 
140  JTimeConverter converter;
141 
142 
143  if (mc.getEntries() != 0) {
144 
145  Evt* event = mc.getEntry(tev->getCounter());
146 
147  if (event != NULL) {
148 
149  converter = JTimeConverter(*event, *tev);
150 
151  if (has_neutrino(*event)) {
152 
153  JTrack ta = getTrack(get_neutrino(*event));
154 
155  ta.add(center);
156 
157  cout << LEFT(WIDTH) << "neutrino" << ' ' << ta << endl;
158  }
159 
160  vector<Trk>::const_iterator track = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_muon);
161 
162  if (track != event->mc_trks.end()) {
163 
164  JTrack ta = getTrack(*track);
165 
166  ta.add(center);
167 
168  cout << LEFT(WIDTH) << "muon" << ' ' << ta << endl;
169  }
170  }
171  }
172 
173  cout << "number of fits " << setw(4) << right << evt->size() << endl;
174 
175  for (size_t i = 0; i != min(evt->size(), numberOfFits); ++i) {
176 
177  const JFit& fit = (*evt)[i];
178 
179  JTrack tb = getTrack(fit);
180 
181  tb.sub(converter.putTime());
182 
183  cout << LEFT(WIDTH) << "fit" << ' ' << tb << ' ' << fit.getQ() << ' ' << fit.getE() << endl;
184  cout << fit.getHistory() << endl;
185  }
186  }
187 }
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition: JDAQEvent.hh:30
JSUPPORT::JLimit
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
KM3NETDAQ::JDAQTriggerCounter::getCounter
JTriggerCounter_t getCounter() const
Get trigger counter.
Definition: JDAQTriggerCounter.hh:99
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
JTRIGGER::JTimeConverter::putTime
double putTime() const
Get Monte Carlo minus DAQ/trigger hit time.
Definition: JTimeConverter.hh:77
std::vector
Definition: JSTDTypes.hh:12
JFIT::JFit::getE
double getE() const
Get energy.
Definition: JEvt.hh:153
Evt
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
JTRIGGER::JTimeConverter
Auxiliary class to convert DAQ/trigger hit time to/from Monte Carlo hit time.
Definition: JTimeConverter.hh:36
JAANET::getTrack
JTrack3E getTrack(const Trk &track)
Get track.
Definition: JAAnetToolkit.hh:256
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JFIT::JEvt
Data structure for set of track fit results.
Definition: JEvt.hh:293
JAANET::is_muon
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Definition: JAAnetToolkit.hh:367
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JFIT::JFit::getQ
double getQ() const
Get quality.
Definition: JEvt.hh:151
JSUPPORT::getHeader
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Definition: JMonteCarloFileSupportkit.hh:458
JFIT::JQualitySorter
General purpose sorter of fit results.
Definition: JEvtToolkit.hh:239
debug
int debug
debug level
Definition: JSirene.cc:59
JSUPPORT::JTreeScanner< Evt >
WIDTH
Auxiliary data structure for alignment of data.
Definition: JPrint.hh:267
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JAANET::get_neutrino
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
Definition: JAAnetToolkit.hh:438
JSUPPORT::JLimit::getLimit
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
JAANET::has_neutrino
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
Definition: JAAnetToolkit.hh:427
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
JSUPPORT::JParallelFileScanner
General purpose class for parallel reading of objects from a single file or multiple files.
Definition: JParallelFileScanner.hh:31
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JSIRENE::JTrack
Muon trajectory.
Definition: JSireneToolkit.hh:303
JLANG::LEFT
Definition: JTwosome.hh:18
JFIT::JFit
Data structure for track fit results.
Definition: JEvt.hh:31
JFIT::JHistory::getHistory
const JHistory & getHistory() const
Get history.
Definition: JHistory.hh:225
JAANET::quality_sorter
Reconstruction type dependent comparison of track quality.
Definition: JAAnetToolkit.hh:670