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:51 MET