Is there any way to get from fReader a list with b1 and b2 strings?
Use case scenario:
PROOF is processing a TChain with a very large number of files, but a few of the TTrees included in those files didn’t have the expected branches, so in that case I’d like to skip the file and inform the user that a file has been skipped. However if I use fReader.SetEntry(nEntry) (in TSelector::Process) the process fails and crash. So I’d like to have the option to check that all the branches (large) are contained in the TTree during TSelector::Init(TTree *tree), for that I can use TTree::FindBranch but as the number of branches is large I’d like to retrieve the list of registered values from fReader. Is there a way to do that?
I don’t think you can list the value readers of a tree reader. Perhaps @pcanal or @Axel have an idea.
Does the application crash in fReader.SetEntry itself or at a later point? If it crashes only later, you could check the result of SetEntry, which should be different from 0 if a branch is missing. You could also use a helper function in the definition of the TTreeReaderValue in order to collect the branch name, like so
@Axel, is there a way to do this? and to register/deregister values from TTreeReader? I see there are some private methods to do it (1) but wondering if those methods can be exposed publicly for future development. This would be very useful for CMS, with NanoAOD (plain root files) which do not have a fixed structure across datasets (sets of root files), see (2), being able to register/deregister values prior to TTree processing would be a nice feature to have. The way I’m handling this right now is kind of hacky, registering a branch that may not exist and use it to reset the value if the branch is present. If you see this is feasible, with your guidance I can help with the implementation. Let me know what you think