#include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "JPhysics/JPDF.hh" #include "JPhysics/Antares.hh" #include "JPhysics/KM3NeT.hh" #include "JTools/JSpline.hh" #include "JTools/JQuantiles.hh" #include "JTools/JAbstractHistogram.hh" #include "JGeometry3D/JAngle3D.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * Scaling of absorption and scattering length. */ double absorptionLengthFactor; double scatteringLengthFactor; inline double getAbsorptionLength(const double lambda) { return absorptionLengthFactor * NAMESPACE::getAbsorptionLength(lambda); } inline double getScatteringLength(const double lambda) { return scatteringLengthFactor * NAMESPACE::getScatteringLength(lambda); } /** * \file * * Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile. * \author mdejong */ int main(int argc, char **argv) { using namespace std; using namespace JPP; typedef JAbstractHistogram JHistogram_t; string outputFile; int numberOfPoints; double epsilon; double E; double D; double cd; JAngle3D dir; vector function; JHistogram_t histogram; int debug; try { JParser<> zap("Auxiliary program to draw PDF of Cherenkov light from EM-shower including shower profile."); zap['o'] = make_field(outputFile) = "pde.root"; zap['n'] = make_field(numberOfPoints, "points for integration") = 25; zap['e'] = make_field(epsilon, "precision for integration") = 1.0e-10; zap['A'] = make_field(absorptionLengthFactor, "scaling factor") = 1.0; zap['S'] = make_field(scatteringLengthFactor, "scaling factor") = 1.0; zap['E'] = make_field(E, "shower energy [GeV]"); zap['R'] = make_field(D, "distance [m]"); zap['c'] = make_field(cd, "cosine emission angle"); zap['D'] = make_field(dir, "(theta, phi) of PMT [rad]"); zap['F'] = make_field(function, "PDF type"); zap['H'] = make_field(histogram, "histogram binning") = JHistogram_t(); zap['d'] = make_field(debug) = 0; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } const JPDF_C pdf(NAMESPACE::getPhotocathodeArea(), NAMESPACE::getQE, NAMESPACE::getAngularAcceptance, getAbsorptionLength, getScatteringLength, NAMESPACE::getScatteringProbability, NAMESPACE::getAmbientPressure(), getMinimalWavelength(), getMaximalWavelength(), numberOfPoints, epsilon); if (outputFile == "") { for (double dt; cin >> dt; ) { for (vector::const_iterator F = function.begin(); F != function.end(); ++F) { cout << setw(2) << *F << ' ' << SCIENTIFIC(7,1) << E << ' ' << FIXED(5,1) << D << ' ' << FIXED(5,2) << cd << ' ' << FIXED(5,2) << dir.getTheta() << ' ' << FIXED(5,2) << dir.getPhi() << ' ' << FIXED(5,1) << dt << ' ' << SCIENTIFIC(9,3) << pdf.getLightFromEMshower(*F, E, D, cd, dir.getTheta(), dir.getPhi(), dt) * E << endl; } } return 0; } TFile out(outputFile.c_str(), "recreate"); const double t0 = D * getIndexOfRefraction() / C; // time [ns] //const double t0 = 0.0; // time [ns] if (!histogram.is_valid()) { if (function.size() == 1 && function[0] == DIRECT_LIGHT_FROM_EMSHOWER) { histogram = JHistogram_t(t0 - 20.0, t0 + 50.0); histogram.setBinWidth(0.1); } else { histogram = JHistogram_t(t0 - 20.0, t0 + 500.0); histogram.setBinWidth(0.5); } } TH1D h0("h0", NULL, histogram.getNumberOfBins(), histogram.getLowerLimit(), histogram.getUpperLimit()); JSplineFunction1D_t f1; for (int i = 1; i <= h0.GetNbinsX(); ++i) { const double dt = h0.GetBinCenter(i) - t0; double value = 0.0; for (vector::const_iterator F = function.begin(); F != function.end(); ++F) { value += pdf.getLightFromEMshower(*F, E, D, cd, dir.getTheta(), dir.getPhi(), dt); } h0.SetBinContent(i, value); f1[dt] = value; } f1.compile(); JQuantiles quantiles(f1); DEBUG("int " << quantiles.getIntegral() << endl); DEBUG("x " << quantiles.getX() << endl); DEBUG("y " << quantiles.getY() << endl); DEBUG("FWHM " << quantiles.getFWHM() << endl); out.Write(); out.Close(); }