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

Auxiliary program to create TBox. More...

#include <string>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TBox.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  JBox
 Auxiliary data structure for box. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create TBox.

Author
mdejong

Definition in file JBox.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 60 of file JBox.cc.

61{
62 using namespace std;
63 using namespace JPP;
64
65 typedef JContainer< vector<JBox> > JParameters_t;
66
67 string outputFile;
68 JParameters_t parameters;
69 struct {
71 Style_t style = 0; // hollow
72 } fill;
73 struct {
76 Width_t width = 1;
77 } line;
78 int debug;
79
80 try {
81
82 JProperties properties(JEquationParameters("=", "\n", "", "#"));
83
84 properties.insert(zmake_property(fill.color));
85 properties.insert(zmake_property(fill.style));
86 properties.insert(zmake_property(line.color));
87 properties.insert(zmake_property(line.style));
88 properties.insert(zmake_property(line.width));
89
90 JParser<> zap("Auxiliary program to create TBox");
91
93 zap['p'] = make_field(parameters, "x1 y1 x2 y2");
94 zap['@'] = make_field(properties, "box attributes") = JPARSER::initialised();
95 zap['d'] = make_field(debug) = 1;
96
97 zap(argc, argv);
98 }
99 catch(const exception &error) {
100 FATAL(error.what() << endl);
101 }
102
103
104 TFile out(outputFile.c_str(), "recreate");
105
106 for (size_t i = 0; i != parameters.size(); ++i) {
107
108 TBox* p = new TBox(parameters[i].x1, parameters[i].y1, parameters[i].x2, parameters[i].y2);
109
110 p->SetFillColor(fill.color);
111 p->SetFillStyle(fill.style);
112 p->SetLineColor(line.color);
113 p->SetLineStyle(line.style);
114 p->SetLineWidth(line.width);
115
116 out.WriteTObject(p);
117 }
118
119 out.Write();
120 out.Close();
121}
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