Jpp  18.2.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
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

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 }
Utility class to parse command line options.
Definition: JParser.hh:1514
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Definition: JProperties.hh:497
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level