Hi Antonio,
TTree::CloneTree is currently not able to copy the branch addresses
correctly in case the source tree is initialized in MakeClass mode.
I think that the following lines should fix the problem.
Let me know
After the line
TTree *newtree = (TTree*)fChain->GetTree()->CloneTree(0);
add
newtree->SetMakeClass(1);
fChain->GetTree()->CopyAddresses(newtree);
Rene Brun
On Sat, 23 Nov 2002, Antonio SIDOTI wrote:
> Dear Rooters,
> I am following the suggestions described in
> http://root.cern.ch/root/roottalk/roottalk02/0481.html to filter out a
> chain.
> I want to filter in Loop method that has been generated by MakeClass.
>
> void MyClass::Loop(){
> bool pass = false;
> fChain->SetBranchStatus("*",1); // enable all branches
>
> Int_t nentries = Int_t(fChain->GetEntries());
> fChain->GetEntry(0);
> TFile *newFile = new TFile("small.root","recreate");
> TTree *newtree = (TTree*)fChain->GetTree()->CloneTree(0);
> for (Int_t jentry=0; jentry<nentries;jentry++) {
> Int_t ientry = LoadTree(jentry);
> pass = false;
> for(Int_t itk1=0; itk1< numTk; ++itk1){
> for(Int_t itk2=itk1+1; itk2< numTk; ++itk2){
> if(itk1==itk2) continue;
> pass = Select(itk1,itk2);
> }
> }
> if(pass){
> cout << "Passed!\n";
> newtree->Fill();
> }
> }
> newFile->cd();
> newtree->Write();
> }
>
> My problem is that as soon as I try to fill the newtree I got a
> Segmaentation violation:
>
> *** Break *** segmentation violation
> Root > Function Loop() busy flag cleared
>
> What I am doing wrong?
> Thanks a lot,
> Antonio
>
> P.S. I am using 3.03/07
>
> -------------------------------------------------------------
> sidoti antonio: PostDoc(AdR) - University Pisa and INFN
> e-mail: antonio.sidoti@pi.infn.it
> sidoti@fnal.gov
> www: http://higgs.tn.infn.it/~sidoti/
> Tel: +39 + 050 880 456
> Fax: +39 + 050 880 317-318
> -------------------------------------------------------------
> "A program is a device used to convert data into error messages."
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:20 MET