Re: [ROOT] Disable branches in TChain

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu May 02 2002 - 12:35:49 MEST


Jan Erik,

I cannot reproduce this problem. Could you tell me where I can take
the strict minimum to reproduce the problem:
  - two small data files making your TChain
  - your code generated by MakeClass

Rene Brun

Jan Erik Sundermann wrote:
> 
>         Hi Rene,
> 
> I checked the version of my root installation and tried again with the
> CVS version from 01 May. But unfortunately the problems I had with
> disabled branches did not vanish.
> 
>         Best regards,
> 
>                 Jan Erik.
> 
> On Tue, 30 Apr 2002, Rene Brun wrote:
> 
> > Hi Jan Erik,
> >
> > Are you really using the version from CVS ?
> >
> > On April 21st I fixed a problem in TChain::SetBranchStatus
> > appearing when
> >   -all branches were disabled
> >   -then some branches activated but not the top level branch.
> >    (seems to be your case)
> >
> > Could you check and let me know?
> >
> > Rene Brun
> >
> > Jan Erik Sundermann wrote:
> > >
> > >         Hello rooters,
> > >
> > > the advised recipe in TChain->MakeClass() to disable braches for reading
> > > always fails in my code. I was trying both
> > >
> > >         fChain->SetBranchStatus("*", 0);
> > >         fChain->SetBranchStatus("event", 1);
> > >         fChain->SetBranchStatus("platform", 1);
> > >         (...)
> > >
> > > and alternatively
> > >
> > >         b_event->GetEntry(entry);
> > >         b_platform->GetEntry(entry);
> > >         (...)
> > > In the first case all enabled branches allways return 0. In the second
> > > case everythings works fine until the loop reaches entry 1353 (maybe the
> > > begin of a new file in the chain). Then the entries remain constant.
> > > I use the by TChain::MakeClass() generated code skeleton and the current
> > > version from CVS. Attached below are the important parts of the code i
> > > use.
> > >
> > > What am i doing wrong?
> > >
> > >         Bye,
> > >
> > >                 Jan Erik.
> > >
> > > --------------------------------------------
> > >
> > > void
> > > brecontp_doubleevents::Loop() {
> > >
> > >   fChain->SetBranchStatus("*", 0);
> > >   fChain->SetBranchStatus("platform", 1);
> > >   fChain->SetBranchStatus("partition", 1);
> > >   fChain->SetBranchStatus("upperID", 1);
> > >   fChain->SetBranchStatus("lowerID", 1);
> > >   fChain->SetBranchStatus("runNumber", 1);
> > >   fChain->SetBranchStatus("nB0", 1);
> > >   fChain->SetBranchStatus("nChB", 1);
> > >
> > >   if (fChain == 0) return;
> > >   Int_t nentries = Int_t(fChain->GetEntriesFast());
> > >
> > >
> > >   for (Int_t entry1=0; entry1 < nentries; entry1++) {
> > >
> > >     Int_t ientry = LoadTree(entry1);
> > >     if (ientry < 0) break;
> > >
> > >     fChain->GetEntry(entry1);
> > >
> > > // or alternatively ...
> > >
> > > //    b_event->GetEntry(entry1);
> > > //    b_platform->GetEntry(entry1);
> > > //    b_partition->GetEntry(entry1);
> > > //    b_upperID->GetEntry(entry1);
> > > //    b_lowerID->GetEntry(entry1);
> > > //    b_runNumber->GetEntry(entry1);
> > > //    b_nB0->GetEntry(entry1);
> > > //    b_nChB->GetEntry(entry1);
> > >
> > >     long platform1 = platform;
> > >     long partition1 = partition;
> > >     long upperID1 = upperID;
> > >     long lowerID1 = lowerID;
> > >     long event1 = event;
> > >     long runnumber1 = runNumber;
> > >     long nB01 = nB0;
> > >     long nChB1 = nChB;
> > >
> > >     for (Int_t entry2 = entry1+1; entry2 < nentries; entry2++) {
> > >
> > >       Int_t jentry = LoadTree(entry2);
> > >       if (jentry < 0) break;
> > >       fChain->GetEntry(entry2);
> > >
> > > // or alternatively ...
> > >
> > > //    b_event->GetEntry(entry2);
> > > //    b_platform->GetEntry(entry2);
> > > //    b_partition->GetEntry(entry2);
> > > //    b_upperID->GetEntry(entry2);
> > > //    b_lowerID->GetEntry(entry2);
> > > //    b_runNumber->GetEntry(entry2);
> > > //    b_nB0->GetEntry(entry2);
> > > //    b_nChB->GetEntry(entry2);
> > >
> > >     }
> > >   }
> > >
> > >   fChain->SetBranchStatus("*", 1);
> > >
> > > }
> >



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:52 MET