#include #include #include "TROOT.h" #include "TFile.h" #include "TEllipse.h" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * Auxiliary data structure for ellipse. */ struct JEllipse { /** * Read ellipse from input stream. * * \param in input stream * \param ellipse ellipse * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JEllipse& ellipse) { if (in >> ellipse.x1 >> ellipse.y1 >> ellipse.r1) { if (in >> ellipse.r2) { if (in >> ellipse.phimin >> ellipse.phimax) { } else { ellipse.phimin = 0.0; ellipse.phimax = 360.0; } } else { ellipse.r2 = ellipse.r1; ellipse.phimin = 0.0; ellipse.phimax = 360.0; } } return in; } /** * Write ellipse to output stream. * * \param out output stream * \param ellipse ellipse * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JEllipse& ellipse) { out << ellipse.x1 << ' ' << ellipse.y1 << ' ' << ellipse.r1 << ' ' << ellipse.r2 << ' ' << ellipse.phimin << ' ' << ellipse.phimax; return out; } double x1; double y1; double r1; double r2; double phimin; double phimax; }; /** * \file * Auxiliary program to create TEllipse. * \author mdejong */ int main(int argc, char **argv) { using namespace std; string outputFile; JEllipse parameters; int debug; try { JParser<> zap("Auxiliary program to create TEllipse"); zap['o'] = make_field(outputFile); zap['p'] = make_field(parameters, "x y r1 [r2 [phimin phimax]]"); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } TFile out(outputFile.c_str(), "recreate"); TEllipse* p = new TEllipse(parameters.x1, parameters.y1, parameters.r1, parameters.r2, parameters.phimin, parameters.phimax); p->SetFillStyle(0); // hollow out.WriteTObject(p); out.Write(); out.Close(); }