Hi Richard,
Yes, this is possible. Example:
void makeList() {
TFile *f1 = new TFile("hsimple.root");
TTree *ntuple = (TTree*) f1->Get("ntuple");
ntuple->Draw(">>elist","py>2");
TEventList *elist = (TEventList*)gDirectory->Get("elist");
TFile ef("elist.root","recreate");
elist.Write();
}
void makeSmall() {
TFile *f = new TFile("elist.root");
TEventList *elist = (TEventList*)f->Get("elist");
TFile *f1 = new TFile("hsimple.root");
TTree *ntuple = (TTree*) f1->Get("ntuple");
ntuple->SetEventList(elist);
TFile *f2 = new TFile("small.root","recreate");
TTree *small = ntuple->CopyTree("");
small->Write();
small->Print();
}
Rene Brun
Dubois, Richard wrote:
>
> Is it possible to use event lists to selectively grab entries in a tree/file and copy them to a new file? Something like
>
> create event list from old tree, do oldtree->SetEventList
>
> then clone/copy entries to a new tree, but only the ones specified in the event list? I tried just that from the copytree example in the tutorials, but got a full copy of oldtree...
>
> The basic idea is that we have 400 MB of files, we want to select out about 25 MB and simply create a new file with just the 25 MB.
>
> Thanks,
>
> Richard
> --
> Richard Dubois
> Stanford Linear Accelerator Center
> 650-926-3824
> 650-926-8616 (FAX)
> richard@slac.stanford.edu
> http://www.slac.stanford.edu/~richard
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:56 MET