1 #ifndef __JTREE_BRANCH_ADDRESSES_H__ 
    2 #define __JTREE_BRANCH_ADDRESSES_H__ 
   10 #include "TDataMember.h" 
   24   while ((
object = next()) != 
nullptr) {
 
   25     names.emplace_back(object->GetName());
 
   54     TObjArray* branches = tree.GetListOfBranches();
 
   56     if (branches->GetEntries() == 1) {
 
   57       tree.SetBranchAddress(branches->First()->GetName(), &this->address);
 
   62     TClass* t_class = TClass::GetClass<T>();
 
   63     if (t_class == 
nullptr) {
 
   67     auto branch_names = 
to_vector(tree.GetListOfBranches());
 
   68     auto all_member_names = 
to_vector(t_class->GetListOfRealData());
 
   73     std::copy_if(all_member_names.begin(), all_member_names.end(), std::back_inserter(member_names),
 
   74                  [](
const std::string& member_name)
 
   75                  { return !JRootClass::is_tobject_member(member_name.c_str()); });
 
   77     std::sort(branch_names.begin(), branch_names.end());
 
   78     std::sort(member_names.begin(), member_names.end());
 
   82     if (std::includes(branch_names.begin(), branch_names.end(), member_names.begin(),
 
   83                       member_names.end())) {
 
   87       auto* base = 
reinterpret_cast<uint8_t*
>(this->
address);
 
   89       for (
const auto& member_name : member_names) {
 
   90         auto* member = 
static_cast<TDataMember*
>(t_class->GetDataMember(member_name.c_str()));
 
   91         tree.SetBranchAddress(member_name.c_str(),
 
   92                               reinterpret_cast<void*
>(base + member->GetOffset()));
 
  100                                          << 
JEEPZ() << member_names << 
"\nBranches in tree\n" 
  101                                          << 
JEEPZ() << branch_names);
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
I/O formatting auxiliaries.
 
Class responsible to setup TTree branch addresses for reading objects of type T.
 
void setBranchAddress(TTree &tree)
 
Auxiliary classes and methods for ROOT I/O.
 
std::vector< std::string > to_vector(TCollection *col)
 
Auxiliary data structure for streaming of STL containers.
 
Auxiliary classd for address handling within TTree or TChain.