Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Classes | Functions
JEllipse.cc File Reference

Auxiliary program to create TEllipse. More...

#include <string>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TEllipse.h"
#include "Jeep/JContainer.hh"
#include "Jeep/JProperties.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  JEllipse
 Auxiliary data structure for ellipse. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create TEllipse.

Author
mdejong

Definition in file JEllipse.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 86 of file JEllipse.cc.

87{
88 using namespace std;
89 using namespace JPP;
90
91 typedef JContainer< vector<JEllipse> > JParameters_t;
92
93 string outputFile;
94 JParameters_t parameters;
95 struct {
97 Style_t style = 0; // hollow
98 } fill;
99 struct {
102 Width_t width = 1;
103 } line;
104 int debug;
105
106 try {
107
108 JProperties properties(JEquationParameters("=", "\n", "", "#"));
109
110 properties.insert(zmake_property(fill.color));
111 properties.insert(zmake_property(fill.style));
112 properties.insert(zmake_property(line.color));
113 properties.insert(zmake_property(line.style));
114 properties.insert(zmake_property(line.width));
115
116 JParser<> zap("Auxiliary program to create TEllipse");
117
118 zap['o'] = make_field(outputFile);
119 zap['p'] = make_field(parameters, "x y r1 [r2 [phimin phimax]]");
120 zap['@'] = make_field(properties, "ellipse attributes") = JPARSER::initialised();
121 zap['d'] = make_field(debug) = 1;
122
123 zap(argc, argv);
124 }
125 catch(const exception &error) {
126 FATAL(error.what() << endl);
127 }
128
129
130 TFile out(outputFile.c_str(), "recreate");
131
132 for (size_t i = 0; i != parameters.size(); ++i) {
133
134 TEllipse* p = new TEllipse(parameters[i].x1, parameters[i].y1, parameters[i].r1, parameters[i].r2, parameters[i].phimin, parameters[i].phimax);
135
136 p->SetFillColor(fill.color);
137 p->SetFillStyle(fill.style);
138 p->SetLineColor(line.color);
139 p->SetLineStyle(line.style);
140 p->SetLineWidth(line.width);
141
142 out.WriteTObject(p);
143 }
144
145 out.Write();
146 out.Close();
147}
string outputFile
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
#define zmake_property(A)
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68