Jpp
Functions
JPrintFit.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include "TROOT.h"
#include "TFile.h"
#include "evt/Head.hh"
#include "evt/Evt.hh"
#include "evt/io_ascii.hh"
#include "evt/io_jpp.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JHeadToolkit.hh"
#include "JDAQ/JDAQEvent.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 84 of file JPrintFit.cc.

85 {
86  using namespace std;
87  using namespace JPP;
88  using namespace KM3NETDAQ;
89 
90  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
91  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
92 
93  JParallelFileScanner_t inputFile;
94  JLimit_t& numberOfEvents = inputFile.getLimit();
95  JQualitySorter quality_sorter;
96  size_t numberOfFits;
97  int debug;
98 
99  try {
100 
101  JParser<> zap("Auxiliary program to print fit results.");
102 
103  zap['f'] = make_field(inputFile);
104  zap['n'] = make_field(numberOfEvents) = JLimit::max();
105  zap['L'] = make_field(quality_sorter) = JPARSER::initialised();
106  zap['N'] = make_field(numberOfFits) = 1;
107  zap['d'] = make_field(debug) = 2;
108 
109  zap(argc, argv);
110  }
111  catch(const exception& error) {
112  FATAL(error.what() << endl);
113  }
114 
115 
116 
117  const int WIDTH = 16;
118 
119  JTreeScanner<Evt> mc(inputFile);
120 
121  JPosition3D center(0,0,0);
122 
123  try {
124  center = get<JPosition3D>(getHeader(inputFile));
125  } catch(const exception& error) {}
126 
127 
128  while (inputFile.hasNext()) {
129 
130  cout << "event: " << setw(10) << inputFile.getCounter() << endl;
131 
132  multi_pointer_type ps = inputFile.next();
133 
134  JDAQEvent* tev = ps;
135  JEvt* evt = ps;
136 
137  if (quality_sorter.is_valid()) {
138  sort(evt->begin(), evt->end(), quality_sorter);
139  }
140 
141  JTimeConverter converter;
142 
143 
144  if (mc.getEntries() != 0) {
145 
146  Evt* event = mc.getEntry(tev->getCounter());
147 
148  if (event != NULL) {
149 
150  converter = JTimeConverter(*event, *tev);
151 
152  if (has_neutrino(*event)) {
153 
154  JTrack ta = getTrack(get_neutrino(*event));
155 
156  ta.add(center);
157 
158  cout << LEFT(WIDTH) << "neutrino" << ' ' << ta << endl;
159  }
160 
161  vector<Trk>::const_iterator track = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_muon);
162 
163  if (track != event->mc_trks.end()) {
164 
165  JTrack ta = getTrack(*track);
166 
167  ta.add(center);
168 
169  cout << LEFT(WIDTH) << "muon" << ' ' << ta << endl;
170  }
171  }
172  }
173 
174  cout << "number of fits " << setw(4) << right << evt->size() << endl;
175 
176  for (size_t i = 0; i != min(evt->size(), numberOfFits); ++i) {
177 
178  const JFit& fit = (*evt)[i];
179 
180  JTrack tb = getTrack(fit);
181 
182  tb.sub(converter.putTime());
183 
184  cout << LEFT(WIDTH) << "fit" << ' ' << tb << ' ' << fit.getQ() << ' ' << fit.getE() << endl;
185  cout << fit.getHistory() << endl;
186  }
187  }
188 }
KM3NETDAQ::JDAQEvent
DAQ Event.
Definition: JDAQEvent.hh:34
KM3NETDAQ::JDAQTriggerCounter::getCounter
JTriggerCounter_t getCounter() const
Get trigger counter.
Definition: JDAQTriggerCounter.hh:98
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition: JParser.hh:63
std::vector
Definition: JSTDTypes.hh:12
JSUPPORT::JLimit_t
JLimit JLimit_t
Type definition of limit.
Definition: JLimit.hh:215
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
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
JSUPPORT::getHeader
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Definition: JMonteCarloFileSupportkit.hh:425
debug
int debug
debug level
Definition: JSirene.cc:59
WIDTH
Auxiliary data structure for alignment of data.
Definition: JPrint.hh:267
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
std
Definition: jaanetDictionary.h:36
KM3NETDAQ
KM3NeT DAQ data structures and auxiliaries.
Definition: DataQueue.cc:39
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JLANG::LEFT
Definition: JTwosome.hh:18