Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAAnetDynamics.cc
Go to the documentation of this file.
1
2#include <string>
3#include <iostream>
4#include <iomanip>
5
6#include "TROOT.h"
7#include "TFile.h"
8#include "TGraph.h"
9
12
14
15#include "JROOT/JGraph.hh"
16#include "JROOT/JRootToolkit.hh"
17
19#include "JSupport/JSupport.hh"
20
21#include "Jeep/JParser.hh"
22#include "Jeep/JMessage.hh"
23
24/**
25 * \file
26 *
27 * Example program to monitor dynamical calibration of Evt formatted data.
28 * \author mdejong
29 */
30int main(int argc, char **argv)
31{
32 using namespace std;
33 using namespace JPP;
34 using namespace KM3NETDAQ;
35
37 JLimit_t& numberOfEvents = inputFile.getLimit();
38 string outputFile;
39 int debug;
40
41 try {
42
43 JParser<> zap("Example program to monitor dynamical calibration of Evt formatted data.");
44
45 zap['f'] = make_field(inputFile);
46 zap['n'] = make_field(numberOfEvents) = JLimit::max();
47 zap['o'] = make_field(outputFile) = "dynamics.root";
48 zap['d'] = make_field(debug) = 2;
49
50 zap(argc, argv);
51 }
52 catch(const exception& error) {
53 FATAL(error.what() << endl);
54 }
55
56
57 JGraph_t gn;
58 JGraph_t g0;
59 JGraph_t g1;
60
61 while (inputFile.hasNext()) {
62
63 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
64
65 const Evt* evt = inputFile.next();
66
67 if (has_reconstructed_jppmuon(*evt)) {
68
69 const Trk& trk = get_best_reconstructed_jppmuon(*evt);
70 const bool gandalf = has_jppmuon_gandalf(trk);
71
72 DEBUG("coverage "
73 << FIXED(15,0) << evt->t.AsDouble() << ' '
74 << setw(2) << trk.rec_stages.size() << ' '
75 << FIXED(4,2) << getW(trk, JPP_COVERAGE_ORIENTATION, 0.0) << ' '
76 << FIXED(4,2) << getW(trk, JPP_COVERAGE_ORIENTATION, 0.0) << endl);
77
78 if (!gandalf) {
79 gn.put(evt->t.AsDouble(), 0.0);
80 }
81
82 g0.put(evt->t.AsDouble(), getW(trk, JPP_COVERAGE_ORIENTATION, 0.0));
83 g1.put(evt->t.AsDouble(), getW(trk, JPP_COVERAGE_POSITION, 0.0));
84 }
85 }
86 STATUS(endl);
87
88
89 TFile out(outputFile.c_str(), "recreate");
90
91 out << JGraph(gn, "G[!gandalf]");
92 out << JGraph(g0, "G[orientation]");
93 out << JGraph(g1, "G[position]");
94
95 out.Write();
96 out.Close();
97}
int main(int argc, char **argv)
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
string outputFile
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Double_t g1(const Double_t x)
Function.
Definition JQuantiles.cc:25
ROOT TTree parameter settings of various packages.
Utility class to parse command line options.
Definition JParser.hh:1698
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.
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
double getW(const Trk &track, const size_t index, const double value)
Get track information.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00)
Definition Evt.hh:33
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Auxiliary data structure to build TGraph.
Definition JGraph.hh:44
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
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition Trk.hh:15
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition Trk.hh:26
bool has_jppmuon_gandalf(const Trk &track)
Test whether given track has muon gandalf fit in history.
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.