Hello ROOTers,
I'm trying to create a root file containing only one histogram with 100 bins and errors bars using a variable I have in a lot of others root files. Does someone knows how to do this? I wrote the script below, but it's not working...
void separ()
{
gROOT->Reset();
TChain *chain = new TChain("sim");
chain->Add("/home/michelle/Documents/NEWERFILES/newer46.root"); chain->Add("/home/michelle/Documents/NEWERFILES/newer47.root"); [...]
chain->SetBranchStatus("*",0);
chain->SetBranchStatus("varzen",1);
TTree *varzen = 0;
chain->SetBranchAddress("varzen",&varzen);
TFile *var = new TFile("var.root","recreate");
TTree *tree_moon = chain->CloneTree(0);
TH1F *hvar = new TH1F("hvar","var",100,0.0,10.0);
tree_moon->Branch("hvar",&hvar);
for (Int_t i=0; i < chain->GetEntries(); i++)
{ chain->GetEvent(i); hvar->Fill(varzen->GetEntries()); tree_moon->Fill();
tree_moon->Print();
var->Write();
delete chain;
delete var;
}
When I compile it I have the error:
*** Break *** segmentation violation
Root > Function separ() busy flag cleared
Thanks in advance,
This archive was generated by hypermail 2.2.0 : Thu Mar 17 2011 - 23:50:02 CET