#include #include #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" /** * \file * * Auxiliary program to plot average tilt angles. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JAbstractHistogram JHistogram_t; typedef JTYPELIST::typelist typelist; JMultipleFileScanner inputFile; JLimit_t& numberOfEvents = inputFile.getLimit(); string outputFile; JHistogram_t X; JHistogram_t Y; double Z; int debug; try { JParser<> zap("Auxiliary program to plot average tilt angles."); zap['f'] = make_field(inputFile, "input file (output of JKatoomba[.sh]/JFremantle[.sh])"); zap['n'] = make_field(numberOfEvents) = JLimit::max(); zap['o'] = make_field(outputFile) = "footprint.root"; zap['x'] = make_field(X) = JHistogram_t(500, -100.0, +100.0); zap['y'] = make_field(Y) = JHistogram_t(500, -100.0, +100.0); zap['Z'] = make_field(Z, "detector height (for 2nd order tilt correction)") = 0.0; zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } Z *= 0.5; // half height JManager H2(new TH2D("string[%]", NULL, X.getNumberOfBins(), X.getLowerLimit(), X.getUpperLimit(), Y.getNumberOfBins(), Y.getLowerLimit(), Y.getUpperLimit())); JObjectMultiplexer in(inputFile); for (counter_type counter = 0; in.hasNext() && counter != inputFile.getLimit(); ++counter) { STATUS("event: " << setw(10) << counter << '\r'); DEBUG(endl); const JEvt* evt = in.next(); for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) { const double tx = (i->tx + i->tx2 * Z) * 1.0e3; // [mrad] const double ty = (i->ty + i->ty2 * Z) * 1.0e3; // [mrad] H2 ->Fill(tx, ty); H2[i->id]->Fill(tx, ty); } } STATUS(endl); TFile out(outputFile.c_str(), "recreate"); out << H2 << *H2; out.Write(); out.Close(); }