TTree: Declear arbitrary number of variables for adding TBranches with a loop

@pcanal

Let me simplify the question:

I have a root file with a TTree called Events inside, on which are some variables of different names including nElectron and Electron_*.

I want to build a TTree called Selected that saved all the variables named Electron_* in Events, but only the entries where nElectron are not zero.

How should I do that? Given that the variables with a name begin with "Electron_" differs between input files, I cannot define each of them manually (as below).

std::vector<Float_t> vElectron_pt;
vElectron_pt.clear();
Selected.Branch("Electron_pt", &vElectron, "Electron_pt/F", __SIZEOF_FLOAT__*nElectron)

How can I declare a variable to have addresses to fill into the position where &vElectron_pt is?