Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JFootprint.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 
4 #include "TROOT.h"
5 #include "TFile.h"
6 #include "TH1D.h"
7 #include "TH2D.h"
8 
10 
11 #include "JROOT/JManager.hh"
12 
13 #include "JAcoustics/JEvt.hh"
14 #include "JAcoustics/JSupport.hh"
15 
16 #include "Jeep/JPrint.hh"
17 #include "Jeep/JParser.hh"
18 #include "Jeep/JMessage.hh"
19 
20 
21 /**
22  * \file
23  *
24  * Auxiliary program to plot average tilt angles.
25  * \author mdejong
26  */
27 int main(int argc, char **argv)
28 {
29  using namespace std;
30  using namespace JPP;
31 
33  JLimit_t& numberOfEvents = inputFile.getLimit();
34  string outputFile;
35  int debug;
36 
37  try {
38 
39  JParser<> zap("Auxiliary program to plot average tilt angles.");
40 
41  zap['f'] = make_field(inputFile, "input file (output of JKatoomba)");
42  zap['n'] = make_field(numberOfEvents) = JLimit::max();
43  zap['o'] = make_field(outputFile) = "parramatta.root";
44  zap['d'] = make_field(debug) = 2;
45 
46  zap(argc, argv);
47  }
48  catch(const exception &error) {
49  FATAL(error.what() << endl);
50  }
51 
52  JManager<int, TH2D> H2(new TH2D("string[%]", NULL, 500, -50.0, +50.0, 500, -50.0, +50.0));
53 
54  while (inputFile.hasNext()) {
55 
56  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
57 
58  const JEvt* evt = inputFile.next();
59 
60  for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
61  H2 ->Fill(i->tx*1.0e3, i->ty*1.0e3); // [mrad]
62  H2[i->id]->Fill(i->tx*1.0e3, i->ty*1.0e3); // [mrad]
63  }
64  }
65  STATUS(endl);
66 
67  TFile out(outputFile.c_str(), "recreate");
68 
69  out << H2
70  << *H2;
71 
72  out.Write();
73  out.Close();
74 }
75 
Utility class to parse command line options.
Definition: JParser.hh:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
#define STATUS(A)
Definition: JMessage.hh:63
ROOT TTree parameter settings.
Dynamic ROOT object management.
string outputFile
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
Definition: JManager.hh:43
I/O formatting auxiliaries.
Acoustic event fit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
Definition: JManager.hh:295
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...
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:84
Acoustic event fit.
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62