Jpp  19.1.0
the software that should make you happy
Functions
JAAnetDynamics.cc File Reference

Example program to monitor dynamical calibration of Evt formatted data. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TGraph.h"
#include "km3net-dataformat/offline/Evt.hh"
#include "km3net-dataformat//definitions/reconstruction.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JROOT/JGraph.hh"
#include "JROOT/JRootToolkit.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 monitor dynamical calibration of Evt formatted data.

Author
mdejong

Definition in file JAAnetDynamics.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 30 of file JAAnetDynamics.cc.

31 {
32  using namespace std;
33  using namespace JPP;
34  using namespace KM3NETDAQ;
35 
36  JMultipleFileScanner<Evt> inputFile;
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 }
string outputFile
#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:69
#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
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.
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
Definition: JSTDTypes.hh:14
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
Data structure for graph data.
Definition: JGraph.hh:21
void put(const Double_t x, const Double_t y)
Put data.
Definition: JGraph.hh:28
Auxiliary data structure to build TGraph.
Definition: JGraph.hh:44
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
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.
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.