Where “lepton_n” is a variable from the original tree. This works fine as long as the function I’m calling takes floats or ints as arguments, however I would like to be able to use a function that requires vector*'s as input.
However attempting to pass vector*'s gives me the error:
[quote]however I would like to be able to use a function that requires vector*'s as input.[/quote]In part due to the semantic issue with the implicit loop implemented by TTree::Draw/TTreeFormula only function that takes simple type as argument are supported in this context.
Instead, you will need to use a different mechanism to generate a TEntryList selecting the entry and then attach this entry and call CopyTree without any explicit selection.fChain->SetEntryList(entry_list);
TTree* newTree = fChain->CopyTree(); // This will copy only the entry included in the EntryList.
To generate the entryList you can use TTree::Draw in its MakeProxy mode (passing a script name rather than an expression). See the TTree::Draw and TTree::MakeProxy documentation for more details.