Dear experts,
for my analysis I need to apply a decay tree fit that constrains a set of starting points. Since for each event there could be more than one starting point, the fit has to run more than once. The result is stored as a list in my TTree, e.g.:
root [3] t->Show(0)
...
Lb_TAU = 0.000282896
Lb_dtflambda_PV_key = 0, 1, 2
...
Lb_dtflambda_Lambda0_pplus_PE = 17280.6, 17242.5, 25549.6
i.e. some entries are single values (such as Lb_TAU) and others are arrays (Lb_dtflambda_PV_key and Lb_dtflambda_Lambda0_pplus_PE) obeying the mapping
PV_key 0 <-> Lambda0_pplus_PE 17280.6
PV_key 1 <-> Lambda0_pplus_PE 17242.5
PV_key 2 <-> Lambda0_pplus_PE 25549.6
In fact I am only interested in values with Lb_dtflambda_PV_key == 0 but I don’t know how to filter for that without naming all >100 variables in this tree manually. To be clear: I know how to copy specific values of a TTree via TTree::SetBranchAddress but–as far as I know–it is necessary that I do this explicitly for each value of my TTree. In my case there are >100 of these variables. Is there some kind of wildcard available?
Another way could be to somehow expand and flattern the TTree, thus copying all events for each entry of Lb_dtflambda_PV_key i.e.
Lb_TAU = 0.000282896
Lb_dtflambda_PV_key = 0
Lb_dtflambda_Lambda0_pplus_PE = 17280.6
...
Lb_TAU = 0.000282896
Lb_dtflambda_PV_key = 1
Lb_dtflambda_Lambda0_pplus_PE = 17242.5
...
Lb_TAU = 0.000282896
Lb_dtflambda_PV_key = 2
Lb_dtflambda_Lambda0_pplus_PE = 25549.6
...
I already tried to copy the tree with a TCut, but somehow this cut was ignored:
void test() {
TTree *t = (TTree*) _file0->Get("sig");
TFile *f = TFile::Open("filtered.root", "RECREATE");
TCut cut = "Lb_dtf_PV_key == 0";
TTree *t2 = t->CopyTree(cut);
t2->Write();
f->Close();
}
which I don’t understand since TTree::Draw("…", cut) works with this cut.
Can someone help me either expanding my TTree or making TTree::CopyTree(TCut) work?
Thank you for your help.