Jpp  18.0.0-rc.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
Data structure for graph data.
Definition: JGraph.hh:21
#define STATUS(A)
Definition: JMessage.hh:63
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
Auxiliary data structure to build TGraph.
Definition: JGraph.hh:42
string outputFile
bool has_reconstructed_jppmuon(const Evt &evt)
Test whether given event has a track with muon reconstruction.
bool has_jppmuon_gandalf(const Trk &track)
Test whether given track has muon gandalf fit in history.
double getW(const Trk &track, const size_t index, const double value)
Get track information.
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
const Trk & get_best_reconstructed_jppmuon(const Evt &evt)
Get best reconstructed muon.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define FATAL(A)
Definition: JMessage.hh:67
static const int JPP_COVERAGE_ORIENTATION
coverage of dynamic orientation calibration from any Jpp application
TTimeStamp t
UTC time of the timeslice, or the event_time for MC. (default: 01 Jan 1970 00:00:00) ...
Definition: Evt.hh:33
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition: Trk.hh:26
General purpose class for object reading from a list of file names.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
int debug
debug level
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
Double_t g1(const Double_t x)
Function.
Definition: JQuantiles.cc:25
static const int JPP_COVERAGE_POSITION
coverage of dynamic position calibration from any Jpp application