Jpp  17.3.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
13 #include "JAAnet/JAAnetToolkit.hh"
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  */
30 int main(int argc, char **argv)
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:1517
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
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:1993
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Scanning of objects from multiple files according a format that follows from the extension of each fi...
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.
Utility class to parse command line options.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
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