int TTree_cut_and_branch () { // Connecting the input tree with 3 branches TFile fin ("simple.root"); TTree* tree_in = (TTree*) fin.Get ("tree"); // Saving the result of "input tree after some cut" TFile fout_cut ("simple_cut.root", "RECREATE"); TTree* tree_cut = tree_in->CopyTree ("det < 10") ; tree_cut->Write(); fout_cut.Close(); // Saving the result of "from input tree only some branch" tree_in->SetBranchStatus ("*", 0); tree_in->SetBranchStatus ("Time", 1); TFile fout_bran ("simple_bran.root", "RECREATE"); TTree* tree_bran = tree_in->CloneTree(); /* Caution: cloned tree is connected to the input one */ tree_bran->Write(); fout_bran.Close(); return 0; }