33int main(
int argc, 
char **argv)
 
   44    JParser<> zap(
"Auxiliary program to create TGraph2D from input file with ASCII data.");
 
   53  catch(
const exception &error) {
 
   54    FATAL(error.what() << endl);
 
   62  for (vector<string>::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) {
 
   64    const string gname = (title != 
"" ? title : getFilename(*file_name));
 
   66    ifstream in(file_name->c_str());
 
   68    while (in.peek() == 
'#') {
 
   69      in.ignore(numeric_limits<streamsize>::max(), 
'\n');
 
   72    Double_t x, y, z, ex, ey, ez;
 
   81    for (
string buffer; getline(in,buffer); ) {
 
   83      istringstream is(buffer);
 
   85      if (is >> x)  X .push_back(x);
 
   86      if (is >> y)  Y .push_back(y);
 
   87      if (is >> z)  Z .push_back(z);
 
   88      if (is >> ex) EX.push_back(ex);
 
   89      if (is >> ey) EY.push_back(ey);
 
   90      if (is >> ez) EZ.push_back(ez);
 
   93    if (X.size() != Y.size() || X.size() != Z.size()) {
 
   94      FATAL(
"Number of points " << X.size() <<  
' ' << Y.size() << 
' ' << Z.size() << endl);
 
   97    TGraph2D* graph = NULL;
 
  101      graph = 
new TGraph2D(X.size(), X.data(), Y.data(), Z.data());
 
  105      if (X.size() != EX.size()) {
 
  106        FATAL(
"Number of x points " << X.size() <<  
' ' << EX.size() << endl);
 
  111        EX.resize(X.size(), 0.0);
 
  112        EY.resize(Y.size(), 0.0);
 
  115      if (Y.size() != EY.size()) {
 
  116        FATAL(
"Number of y points " << Y.size() <<  
' ' << EY.size() << endl);
 
  119      if (Z.size() != EZ.size()) {
 
  120        FATAL(
"Number of z points " << Z.size() <<  
' ' << EZ.size() << endl);
 
  123      graph = 
new TGraph2DErrors(X.size(), X.data(), Y.data(), Z.data(), EX.data(), EY.data(), EZ.data());
 
  128      graph->SetName(gname.c_str());
 
  132      DEBUG(
"TGraph " << graph->GetName() << endl);