10 #include "TGraphErrors.h" 
   38 int main(
int argc, 
char **argv)
 
   51     JParser<> zap(
"Auxiliary program to create TGraph from input file with ASCII data.");
 
   62   catch(
const exception &error) {
 
   63     FATAL(error.what() << endl);
 
   73     const string gname = (title != 
"" ? title : 
getFilename(*file_name));
 
   75     ifstream in(file_name->c_str());
 
   77     while (in.peek() == 
'#') {
 
   78       in.ignore(numeric_limits<streamsize>::max(), 
'\n');
 
   91           istringstream is(buffer);
 
   93           for (
string key; is >> key; ) {
 
   94             column.push_back(key);
 
  100         in.ignore(numeric_limits<streamsize>::max(), 
'\n');
 
  105     Double_t 
x, 
y, ex, ey;
 
  114       for (
string buffer; 
getline(in,buffer); ) {
 
  116         istringstream is(buffer);
 
  118         if (is >> 
x)  X .push_back(
x);
 
  119         if (is >> 
y)  Y .push_back(
y);
 
  120         if (is >> ex) EX.push_back(ex);
 
  121         if (is >> ey) EY.push_back(ey);
 
  124       if (X.size() != Y.size()) {
 
  125         FATAL(
"Number of points " << X.size() <<  
' ' << Y.size() << endl);
 
  129       TGraph* graph = NULL;
 
  133         graph = 
new TGraph(X.size(), X.data(), Y.data());
 
  137         if (X.size() != EX.size()) {
 
  138           FATAL(
"Number of x points " << X.size() <<  
' ' << EX.size() << endl);
 
  143           EX.resize(X.size(), 0.0);
 
  146         if (Y.size() != EY.size()) {
 
  147           FATAL(
"Number of y points " << Y.size() <<  
' ' << EY.size() << endl);
 
  150         graph = 
new TGraphErrors(X.size(), X.data(), Y.data(), EX.data(), EY.data());
 
  155         graph->SetName(gname.c_str());
 
  159         DEBUG(
"TGraph " << graph->GetName() << endl);
 
  169       for (
string buffer; 
getline(in,buffer); ) {
 
  171         istringstream is(buffer);
 
  179           for ( ; is >> 
y; ++i) { 
 
  188           if (i+1 != column.size()) {
 
  189             FATAL(
"Number of colums " << i+1 <<  
' ' << column.size() << endl);
 
  194       for (
size_t i = 0; i != Y.size(); ++i) {  
 
  196         TGraph* graph = 
new TGraph(X.size(), X.data(), Y[i].data());
 
  200         os << gname << 
"[" << column[i+1] << 
"]";
 
  202         graph->SetName(os.str().c_str());
 
  206         DEBUG(
"TGraph " << graph->GetName() << endl);
 
int main(int argc, char **argv)
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
 
void setLimits(TGraph &g1)
Set limits of TGraph.
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).