-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Description
Check duplicate issues.
- Checked for duplicates
Description
If a TChain is created with a name different than the TTree it holds, then FindBranch fails to find any branch if the name of the chain is passed. This is evident also by calling TChain::Scan
$: ./example
Error in <TTreeFormula::Compile>: Bad numerical expression : "stepzerochain.value"
************************
* Row * stepzeroc *
************************
* 0 * *
* 1 * *
* 2 * *
* 3 * *
************************
Looking for branch 'stepzerochain.value' produces pointer 0x0
Reproducer
#include <TChain.h>
#include <TFile.h>
#include <TTree.h>
#include <memory>
#include <iostream>
void write_data(const char *name, const char *treename, int first, int last)
{
auto file = std::make_unique<TFile>(name, "RECREATE");
auto tree = std::make_unique<TTree>(treename, treename);
int value{};
tree->Branch("value", &value);
for (value = first; value < last; ++value)
{
tree->Fill();
}
file->Write();
}
void run()
{
// The TTree name is different than the name of the TChain that wraps it.
write_data("stepzero_0.root", "events_zero", 3, 7);
auto chain0 = std::make_unique<TChain>("stepzerochain");
chain0->Add("stepzero_0.root?#events_zero");
chain0->Scan("stepzerochain.value");
std::cout << "Looking for branch 'stepzerochain.value' produces pointer " << chain0->FindBranch("stepzerochain.value") << "\n";
}
int main()
{
run();
}ROOT version
Any
Installation method
any
Operating system
any
Additional context
any
Metadata
Metadata
Assignees
Labels
bugexperimentAffects an experiment / reported by its software & computimng expertsAffects an experiment / reported by its software & computimng expertsin:TTree
Type
Projects
Status
No status