Dear Rooters:
I have one problem about how to fill a file, I use MakeSelector to
generate two files: for example my.C and my.h, now I want to analyze some
events, and fill some histograms, then store all histograms to one root
file. The following is my code:
#include "my.h"
#include "TH2.h"
#include "TStyle.h"
#include "TCanvas.h"
void my::Begin(TTree *tree)
{
//create a root file to put some histograms
TFile *outfile = new TFile("histogram.root", "recreate");
Init(tree);
TString option = GetOption();
}
Bool_t my::ProcessCut(Int_t entry)
{
// Selection function
// entry is the entry number in the current Tree
// Read only the necessary branches to select entries.
// return as soon as a bad entry is detected.
// to read complete event, call fChain->GetTree()->GetEntry(entry)
return kTRUE;
}
void my::ProcessFill(Int_t entry)
{
// function called for selected entries only
// entry is the entry number in the current Tree
// read branches not processed in ProcessCut and fill histograms
// to read complete event, call fChain->GetTree()->GetEntry(entry)
my code here, it creates many histograms
}
void my::Terminate()
{
//write all histograms into the root file
outfile -> Write();
outfile -> Close();
}
Error message is:
No symbol outfile -> Write()
what is the problem? I think maybe I put TFile *outfile=new TFile() in the
wrong place, where should I put it? can anyone help me?
Jim
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:00 MET