I am trying to draw a histogram from ntuple, I followed this example: root.cern.ch/root/html/tutorials … ic2.C.html
I am confused as to why it is saying that
Error: Symbol “c1” is not defined in current scope gain64.c:34:
*** Interpreter error recovered ***
Here is my code. Million thanks in advance.
[code]#include <stdio.h>
#include “TFile.h”
#include “TTree.h”
#include “TGraphErrors.h”
#include “TCanvas.h”
void gain64 (void)
{
const char *data_file = "gain.txt";
TFile *f =TFile::Open(gain_file, "RECREATE");
const char *gain_file = "gain.root";
int i=1;
float date1;
TTree *ntuple1 = new TTree("ntuple1", "data from ascii file");
ntuple1->ReadFile(data_file, "date1/f:c1/f:c2/f:c3/f:c4/f:c5/f:c6/f:c7/f:c8/f:c9/f:c10/f:c11/f:c12/f:c13/f:c14/f:c15/f:c16/f:c17/f:c18/f:c19/f:c20/f:c21/f:c22/f:c23/f:c24/f:c25/f:c26/f:c27/f:c28/f:c29/f:c30/f:c31/f:c32/f:c33/f:c34/f:c35/f:c36/f:c37/f:c38/f:c39/f:c40/f:c41/f:c42/f:c43/f:c44/f:c45/f:c46/f:c47/f:c48/f:c49/f:c50/f:c51/f:c52/f:c53/f:c54/f:c55/f:c56/f:c57/f:c58/f:c59/f:c60/f:c61/f:c62/f:c63/f:c64/f");
ntuple1->Write();
cout<<date1;
delete f;
TCanvas *c = new TCanvas("c1", "A Simple Graph Example", 200, 10, 700, 500);
c->SetGrid();
c->DrawFrame(-5,0,5,100);
ntuple1->Draw(“c1”);
c->Modified(); c->Update();
}[/code]