Hi
This is my macro
[code]#include “Riostream.h”
//#include “iostream”
//#include “strings.h”
#include <TMath.h>
#include <TH2F.h>
#include <TH1F.h>
#include “iostream”
#include “stdio.h”
#include “stdlib.h”
#include “time.h”
#include “string”
#include “unistd.h”
#include “string.h”
#include “fstream”
#include “Riostream.h”
#include “TStyle.h”
#include “TFile.h”
#include “TTree.h”
#include “TH1F.h”
#include “TH2F.h”
#include “TH2.h”
#include “TF1.h”
#include “TMath.h”
#include “TLine.h”
#include “TPolyLine.h”
#include “TArc.h”
#include “TMatrixD.h”
#include “TMinuit.h”
#include “TMath.h”
#include “TChain.h”
#include
#include
void dat_straw() {
TString dir = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
ifstream in;
//in.open(Form("/home/j/calib_good/ch2_1",dir.Data()));
in.open(Form("/home/j/output_1GeV_90deg/output_1GeV_90deg/straw",dir.Data()));
float x,y;
const int i=8;
float x[i],y[i];
//float dx[i],dy[i];
int nlines = 0;
TFile *f = new TFile(“asdfbc.root”,“RECREATE”);
TH2F *h1 = new TH2F(“h1”,“FLASH ADC Calibration”,400,0,19,7.9,11.5);
TH2F *h2 = new TH2F(“h2”,“x distribution”,200,0,800,0,3000);
h1->SetBit(TH2::kCanRebin);
h2->SetBit(TH2::kCanRebin);
/*
TCanvas *c1 = new TCanvas(“c1”,“show profile”,600,900);
c1->Divide(1,2);
c1->cd(1);
h1->Draw();
c1->cd(2);
TProfile *prof = h1->ProfileX();
prof->Fit(“pol1”);
*/
TNtuple *ntuple = new TNtuple(“ntuple”,“data from ascii file”,“x:y”);
while (1) {
in >> x[i] >> y[i];
if (!in.good()) break;
if (nlines < 5) printf(“x=%f, y=%f”,x[i],y[i]);
//for (i=0; i=6; i++)
//h1 ->gr(7,x,y,dx,dy);
//h1->Fill(x,y);
//h2->Fill(x,y);
ntuple->Fill(x[i],y[i]);
nlines++;
}
;
TCanvas *c1 = new TCanvas(“c12”,“show profile”,600,450);
float dx[i] = (0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1);
float dy[i]= (0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1);
TGraphErrors *gr = new TGraphErrors(i,x,y,dx,dy);
gr->SetTitle(“Resolution vs Number of straws”);
gr->GetXaxis()->SetTitle(“Number of straws”);
gr->GetYaxis()->SetTitle(“Resolution [%]”);
gr-draw(“ALP”);
// h1->SetTitle(“Resolution vs Number of straws”);
// h1->GetXaxis()->SetTitle(“Number of straws”);
// h1->GetYaxis()->SetTitle(“Resolution [%]”);
//h1->Draw();
//c1->cd(2);
//c1->cd(3);
//h2->Draw();
//h1->UseCurrentStyle();
// TProfile *prof = h1->ProfileX();
//h2->Fit(“pol1”);
//h2->GetParameters();
//TF1 *fit = h2->GetFunction(“pol1”);
//fit->draw();
//double chi2 = fit->GetChisquare();
//double p0 = fit->GetParameter(0);
//double p1 = fit->GetParameter(1);
in.close();
f->Write();
}[/code]
and when run… I get
root [0] .x dat_straw.C
Error: Can't call TGraphErrors::TGraphErrors(i,x,y,dx,dy) in current scope /home/j/root/macros/dat_straw.C:81:
Possible candidates are...
(in TGraphErrors)
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(void);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(Int_t n);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(Int_t n,const Float_t* x,const Float_t* y,const Float_t* ex=0,const Float_t* ey=0);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(Int_t n,const Double_t* x,const Double_t* y,const Double_t* ex=0,const Double_t* ey=0);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(const TVectorF& vx,const TVectorF& vy,const TVectorF& vex,const TVectorF& vey);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(const TVectorD& vx,const TVectorD& vy,const TVectorD& vex,const TVectorD& vey);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(const TGraphErrors& gr);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(const TH1* h);
/home/j/root/lib/libHist.so -1:-1 0 public: TGraphErrors TGraphErrors::TGraphErrors(const char* filename,const char* format="%lg %lg %lg %lg",Option_t* option="");
(in TGraph)
*** Interpreter error recovered ***
x=11.000000, y=11.850000x=12.000000, y=10.420000x=13.000000, y=9.974000x=14.000000, y=9.426000x=15.000000, y=8.931000root
cant find the problem sadly
thanks for help
Jacek