#include #include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TH2D.h" #include "JTools/JFunction1D_t.hh" #include "JTools/JFunctionalMap_t.hh" #include "JPhysics/JCDFTable.hh" #include "JPhysics/JPDFTypes.hh" #include "JPhysics/JPDFToolkit.hh" #include "JSirene/JCDFTable2D.hh" #include "Jeep/JProperties.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Program to plot CDF of Cherenkov light from shower using interpolation tables. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; string inputFile; string outputFile; int numberOfBins = 200; //!< number of bins for average CDF integral of optical module double safetyFactor = 1.7; //!< safety factor for average CDF integral of optical module int debug; try { JProperties properties; properties.insert(gmake_property(numberOfBins)); properties.insert(gmake_property(safetyFactor)); JParser<> zap("Program to plot PDF of Cherenkov light from shower using interpolation tables."); zap['@'] = make_field(properties) = JPARSER::initialised(); zap['f'] = make_field(inputFile); zap['o'] = make_field(outputFile) = "cdf.root"; zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } typedef JHermiteSplineFunction1D_t JFunction1D_t; typedef JMAPLIST::maplist JMapList_t; typedef JCDFTable JCDF_t; typedef JCDFTable2D JCDF2D_t; JCDF_t function; try { NOTICE("loading input from file " << inputFile << "... " << flush); function.load(inputFile.c_str()); NOTICE("OK" << endl); } catch(const JException& error) { FATAL(error.what() << endl); } JCDF2D_t integral(function, numberOfBins, safetyFactor); TFile out(outputFile.c_str(), "recreate"); TH2D h0("h0", NULL, 200, function.intensity.getXmin(), function.intensity.getXmax(), 200, -1.0, +1.0); for (int ix = 1; ix <= h0.GetXaxis()->GetNbins(); ++ix) { for (int iy = 1; iy <= h0.GetYaxis()->GetNbins(); ++iy) { const double R = h0.GetXaxis()->GetBinCenter(ix); const double cd = h0.GetYaxis()->GetBinCenter(iy); const double y = integral.getNPE(R, cd); h0.SetBinContent(ix, iy, y); } } out.Write(); out.Close(); }