#include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" #include "JPhysics/JPDF.hh" #include "JPhysics/Antares.hh" #include "JPhysics/KM3NeT.hh" #include "JPhysics/JTransformer.hh" #include "JTools/JSpline.hh" #include "JTools/JQuantiles.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); } /** * Use attenutation. */ bool useAttenuation; /** * Get attenuation length. * * \param lambda wavelength of photon [nm] * \return attenuation length [m] */ inline double getAttenuationLength(const double lambda) { static const double f = 0.17; const double l_abs = getAbsorptionLength(lambda); const double ls = getScatteringLength(lambda) / f; double y = 1.0 / l_abs; if (useAttenuation) y += 1.0 / ls; return 1.0 / y; } typedef std::pair orientation; std::istream& operator>>(std::istream& in, orientation& x) { return in >> x.first >> x.second; } std::ostream& operator<<(std::ostream& out, const orientation& x) { return out << x.first << ' ' << x.second; } /** * Auxiliary program to draw PDF. */ int main(int argc, char **argv) { using namespace std; string outputFile; int numberOfPoints; double epsilon; double E; double D; double cd; orientation dir; vector function; int debug; try { JParser<> zap; zap['o'] = make_field(outputFile) = "pdg.root"; zap['n'] = make_field(numberOfPoints) = 25; zap['e'] = make_field(epsilon) = 1.0e-10; zap['A'] = make_field(absorptionLengthFactor) = 1.0; zap['S'] = make_field(scatteringLengthFactor) = 1.0; zap['E'] = make_field(E) = 1.0; zap['R'] = make_field(D); zap['c'] = make_field(cd); zap['D'] = make_field(dir); zap['F'] = make_field(function); zap['U'] = make_field(useAttenuation); zap['d'] = make_field(debug) = 0; zap['F'] = JPARSER::not_initialised(); if (zap.read(argc, argv) != 0) return 1; } catch(const exception &error) { FATAL(error.what() << endl); } const double theta = dir.first; const double phi = dir.second; using namespace JPHYSICS; using namespace JTOOLS; // set global parameters const double P_atm = 240.0; // ambient pressure [Atm] const double wmin = 320.0; // minimal wavelength [nm] const double wmax = 610.0; // maximal wavelength [nm] const JPDF_C pdf(NAMESPACE::getPhotocathodeArea(), NAMESPACE::getQE, NAMESPACE::getAngularAcceptance, getAttenuationLength, getScatteringLength, NAMESPACE::p00075, P_atm, wmin, wmax, numberOfPoints, epsilon); TFile out(outputFile.c_str(), "recreate"); const double t0 = D * getIndexOfRefraction() / C; // time [ns] //const double t0 = 0.0; // time [ns] double xmin = t0 - 10.0; double xmax = t0 + 1000.0; int nx = (int) ((xmax - xmin) / 0.5); if (function.size() == 1 && function[0] == 13) { xmin = t0 - 10.0; xmax = t0 + 20.0; nx = (int) ((xmax - xmin) / 0.1); } TH1D h0("h0", NULL, nx, xmin, xmax); 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 j = function.begin(); j != function.end(); ++j) { switch (*j) { case 13: value += pdf.getDirectLightFromEMshower (D, cd, theta, phi, dt) * E; break; case 14: value += pdf.getScatteredLightFromEMshower(D, cd, theta, phi, dt) * E; break; default: ERROR("Illegal function " << *j << endl); break; } } 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(); }