Simple fit problem

Hello I am rather new to root and I have been having trouble with the Fit() function. I have a 1d histogram that is gaussian with a small amount of noise and I am trying to fit a gaus to it. When i type ebeam.Fit(“gaus”) in the root comand line it brings up a fitted histogram, but when I trying and do the same thing in the code it does not work. here is the code

[code]#define Analyze_cxx
#include “Analyze.h”
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>

void Analyze::Loop()
if (fChain == 0) return;
TCanvas *c1 = new TCanvas(“c1”,“poo”,900,800);

TH1* ebeamHist = new TH1D(“ebeam”,“Histogram of ebeam”,100,149,151);

Long64_t nentries = fChain->GetEntriesFast();

Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;

Any ideas?