Error in <TApplication::ExecuteFile>:macro not found in path

I am trying to run this simple macro, which executes a linux script

[code]#include “Riostream.h”
void HistogramFromAscii(char * file_in, char * file_out) {
// Read data from an ascii file and create a root file with an histogram and an ntuple.
// see a variant of this macro in basic2.C
//Author: Rene Brun

// read file $ROOTSYS/tutorials/tree/basic.dat
// this file has 3 columns of float data

TString fileIn(file_in);
TString fileOut(file_out);
gSystem->Exec(TString::Format(“./entriesInOneColumn%s%s”,fileIn.Data(),fileOut.Data()));

gROOT->SetStyle(“Plain”);
gStyle->SetOptStat(1111);
gStyle->SetOptFit(1111);

TCanvas *c = new TCanvas(“c”, “c”);
c->SetFillColor(5);
c->SetFrameFillColor(10);

TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
dir.ReplaceAll(“HistogramFromAscii.C”,“”);
dir.ReplaceAll(“/./”,“/”);
ifstream in;
in.open(Form(“%srun009Pro.txt”,dir.Data()));

Float_t x,y;
Int_t nlines = 0;
//TFile *f = new TFile(“HistogramFromAscii.root”,“RECREATE”);
TH1F *h1 = new TH1F(“h1”,“Histogram From Ascii”,4096,1,4096);
//TNtuple *ntuple = new TNtuple(“ntuple”,“data from ascii file”,“x:y:z”);

while (1) {
in >> x >> y;
if (!in.good()) break;
if (nlines < 5) printf(“x=%8f, y=%8f\n”,x,y);
h1->Fill(x,y);
//ntuple->Fill(x,y,z);
nlines++;
}
printf(“Found %d points\n”,nlines);

in.close();
h1->SetLineColor(6);
h1->Draw();

//c->SetLogy();
//c->SaveAs(“alpha_in_Si.pdf”);

}[/code]

The script I am trying to execute is the following

[code]#!/bin/bash

awk ‘f{print ++x,$1} /4096/{f=1}’ RS=" | *\n" $1 >$2[/code]

I execute the macro using

.x 'HistogramFromAscii.C("run001 run001Pro")'

but I get the error

Any idea on what might be the problem?

1 Like

The problem is that it must be executed using another way.

In my case typing the following on terminal worked