Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JLine.cc File Reference

Auxiliary program to create TLine. More...

#include <string>
#include <iostream>
#include <vector>
#include "TROOT.h"
#include "TFile.h"
#include "TLine.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  JLine
 Auxiliary data structure for line. More...
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create TLine.

Author
mdejong

Definition in file JLine.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 56 of file JLine.cc.

57{
58 using namespace std;
59 using namespace JPP;
60
61 typedef JContainer< vector<JLine> > JParameters_t;
62
63 string outputFile;
64 JParameters_t parameters;
65 Color_t color = kBlack;
66 Style_t style = kSolid;
67 Width_t width = 2;
68 int debug;
69
70 try {
71
72 JProperties properties;
73
74 properties.insert(gmake_property(color));
75 properties.insert(gmake_property(style));
76 properties.insert(gmake_property(width));
77
78 JParser<> zap("Auxiliary program to create TLine.");
79
80 zap['o'] = make_field(outputFile);
81 zap['p'] = make_field(parameters, "x1 y1 x2 y2");
82 zap['@'] = make_field(properties, "line attributes") = JPARSER::initialised();
83 zap['d'] = make_field(debug) = 1;
84
85 zap(argc, argv);
86 }
87 catch(const exception &error) {
88 FATAL(error.what() << endl);
89 }
90
91
92 TFile out(outputFile.c_str(), "recreate");
93
94 for (size_t i = 0; i != parameters.size(); ++i) {
95
96 TLine* p = new TLine(parameters[i].x1, parameters[i].y1, parameters[i].x2, parameters[i].y2);
97
98 p->SetLineColor(color);
99 p->SetLineStyle(style);
100 p->SetLineWidth(width);
101
102 out.WriteTObject(p);
103 }
104
105 out.Write();
106 out.Close();
107}
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 gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition JContainer.hh:42
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68