Errors in the root macro

I wrote this macro to take a histogram from root ouput directory. I don’t know where the error come from? Plese suggest. Here is the code:
#include “TLegend.h”
#include “TLine.h”
#include “TGraph.h”
#include “TGraphErrors.h”
#include “TStyle.h”
#include “TString.h”
#include “TLatex.h”
#include “TPave.h”
#include “TPaveText.h”
#include “TROOT.h”
void lepton_pt_muon()
{
TFile *myfile=TFile::Open("/storage/local/home/atlas/msohail/trigger_analysis/submitDir/hist-signal.root",“READ”);
TH1F myhist = (TH1F)myfile->Get(“XhhSM_PRE_muon_Pt_after”);
TCanvas *c1 = new TCanvas();
myhist->SetLineWidth(4);
myhist->Draw(“HIST”);
}

The errors are

Processing lepton_pt_muon.C++…
Info in TUnixSystem::ACLiC: creating shared library /storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon_C.so
In file included from input_line_12:9:
/storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon.C:13:15: error: incomplete type ‘TFile’
named in nested name specifier
TFile *myfile=TFile::Open("/storage/local/home/atlas/msohail/trigger_analysis/submitDir/hist-signal.root",“READ”);
^~~~~~~
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TUUID.h:39:7: note:
forward declaration of ‘TFile’
class TFile;
^
In file included from input_line_12:9:
/storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon.C:14:29: error: member access into
incomplete type ‘TFile’
TH1F myhist = (TH1F)myfile->Get(“XhhSM_PRE_muon_Pt_after”);
^
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TUUID.h:39:7: note:
forward declaration of ‘TFile’
class TFile;
^
In file included from input_line_12:9:
/storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon.C:15:19: error: allocation of incomplete
type ‘TCanvas’
TCanvas *c1 = new TCanvas();
^~~~~~~
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TROOT.h:41:7: note:
forward declaration of ‘TCanvas’
class TCanvas;
^
In file included from input_line_12:9:
/storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon.C:17:7: error: member access into
incomplete type ‘TH1F’
myhist->SetLineWidth(4);
^
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TGraph.h:46:7: note:
forward declaration of ‘TH1F’
class TH1F;
^
In file included from input_line_12:9:
/storage/local/home/atlas/msohail/trigger_analysis/macro/./lepton_pt_muon.C:18:7: error: member access into
incomplete type ‘TH1F’
myhist->Draw(“HIST”);
^
/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/root/6.04.16-x86_64-slc6-gcc49-opt/include/TGraph.h:46:7: note:
forward declaration of ‘TH1F’
class TH1F;
^
Error in : Dictionary generation failed!

The errors are quite clear, aren’t they.

#include "TFile.h"
#include "TH1.h"
#include "TCanvas.h"

After putting those header files, now the ouput is this:
root -l -b -q pt.C++
root [0]
Processing pt.C++…
Info in TUnixSystem::ACLiC: creating shared library /storage/local/home/atlas/msohail/trigger_analysis/macro/./pt_C.so

To let you know that the histogram is there
as I can draw by gDirectory->Get(“histogram_name”).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.