#include #include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.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/JCDFTable1D.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 muon 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 muon 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 JCDFTable1D JCDF1D_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); } JCDF1D_t integral(function, numberOfBins, safetyFactor); TFile out(outputFile.c_str(), "recreate"); TH1D h0("h0", NULL, 1000, function.intensity.getXmin(), function.intensity.getXmax()); for (int i = 1; i <= h0.GetNbinsX(); ++i) { const double R = h0.GetBinCenter(i); const double y = integral.getNPE(R); h0.SetBinContent(i, y); } out.Write(); out.Close(); }