{ gROOT->ProcessLine(".L sample_bx_classes.C+"); TFile* p_root_file = new TFile ("samplerootfile.root", "RECREATE"); // create BxEvent BxEvent* p_root_event = new BxEvent(); // create and branch TTree TTree* p_root_tree = new TTree ("bxtree", "Borexino Events Tree (generated by echidna)"); p_root_tree->Branch ("events", "BxEvent", &p_root_event); for(int i = 0; i< 10; i++) { std::cout << "event " << i << std::endl; p_root_event->Assign(i); p_root_tree->Fill (); } p_root_tree->Print (); p_root_tree->Write (); p_root_file->Close (); }