Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JFootprint.cc File Reference

Auxiliary program to plot average tilt angles. More...

#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TH2D.h"
#include "JSupport/JMultipleFileScanner.hh"
#include "JTools/JAbstractHistogram.hh"
#include "JROOT/JManager.hh"
#include "JAcoustics/JEvt.hh"
#include "JAcoustics/JSuperEvt.hh"
#include "JAcoustics/JSupport.hh"
#include "JLang/JObjectMultiplexer.hh"
#include "Jeep/JPrint.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

Auxiliary program to plot average tilt angles.

Author
mdejong

Definition in file JFootprint.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 32 of file JFootprint.cc.

33 {
34  using namespace std;
35  using namespace JPP;
36 
37  typedef JAbstractHistogram<Double_t> JHistogram_t;
38 
39  typedef JTYPELIST<JEvt, JSuperEvt>::typelist typelist;
40 
42  JLimit_t& numberOfEvents = inputFile.getLimit();
43  string outputFile;
44  JHistogram_t X;
45  JHistogram_t Y;
46  double Z;
47  int debug;
48 
49  try {
50 
51  JParser<> zap("Auxiliary program to plot average tilt angles.");
52 
53  zap['f'] = make_field(inputFile, "input file (output of JKatoomba[.sh]/JFremantle[.sh])");
54  zap['n'] = make_field(numberOfEvents) = JLimit::max();
55  zap['o'] = make_field(outputFile) = "footprint.root";
56  zap['x'] = make_field(X) = JHistogram_t(500, -100.0, +100.0);
57  zap['y'] = make_field(Y) = JHistogram_t(500, -100.0, +100.0);
58  zap['Z'] = make_field(Z, "detector height (for 2nd order tilt correction)") = 0.0;
59  zap['d'] = make_field(debug) = 2;
60 
61  zap(argc, argv);
62  }
63  catch(const exception &error) {
64  FATAL(error.what() << endl);
65  }
66 
67  Z *= 0.5; // half height
68 
69  JManager<int, TH2D> H2(new TH2D("string[%]", NULL,
70  X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(),
71  Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit()));
72 
74 
75  for (counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) {
76 
77  STATUS("event: " << setw(10) << counter << '\r'); DEBUG(endl);
78 
79  const JEvt* evt = in.next();
80 
81  for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
82 
83  const double tx = (i->tx + i->tx2 * Z) * 1.0e3; // [mrad]
84  const double ty = (i->ty + i->ty2 * Z) * 1.0e3; // [mrad]
85 
86  H2 ->Fill(tx, ty);
87  H2[i->id]->Fill(tx, ty);
88  }
89  }
90  STATUS(endl);
91 
92  TFile out(outputFile.c_str(), "recreate");
93 
94  out << H2
95  << *H2;
96 
97  out.Write();
98  out.Close();
99 }
Utility class to parse command line options.
Definition: JParser.hh:1514
#define STATUS(A)
Definition: JMessage.hh:63
Long64_t counter_type
Type definition for counter.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
Auxiliary class for multiplexing object iterators.
Simple data structure for histogram binning.
string outputFile
Type list.
Definition: JTypeList.hh:22
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
Acoustic event fit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define FATAL(A)
Definition: JMessage.hh:67
General purpose class for object reading from a list of file names.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
no fit printf nominal n $STRING awk v X
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
int debug
debug level
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62