Class responsible to setup TTree branch addresses for reading objects of type T.  
 More...
#include <JTreeBranchAddresses.hh>
template<typename T>
class JROOT::JTreeBranchAddresses< T >
Class responsible to setup TTree branch addresses for reading objects of type T. 
Definition at line 39 of file JTreeBranchAddresses.hh.
 
◆ setBranchAddress()
Definition at line 53 of file JTreeBranchAddresses.hh.
   55     TObjArray* branches = tree.GetListOfBranches();
 
   57     if (branches->GetEntries() == 1) {
 
   58       tree.SetBranchAddress(branches->First()->GetName(), &this->address);
 
   63     TClass* t_class = TClass::GetClass<T>();
 
   64     if (t_class == 
nullptr) {
 
   65       THROW(JException, 
"Could not get class " << 
typeid(T).name());
 
   68     auto branch_names = 
to_vector(tree.GetListOfBranches());
 
   69     auto all_member_names = 
to_vector(t_class->GetListOfRealData());
 
   74     std::copy_if(all_member_names.begin(), all_member_names.end(), std::back_inserter(member_names),
 
   75                  [](
const std::string& member_name)
 
   76                  { return !JRootClass::is_tobject_member(member_name.c_str()); });
 
   78     std::sort(branch_names.begin(), branch_names.end());
 
   79     std::sort(member_names.begin(), member_names.end());
 
   83     if (std::includes(branch_names.begin(), branch_names.end(), member_names.begin(),
 
   84                       member_names.end())) {
 
   88       auto* base = 
reinterpret_cast<uint8_t*
>(this->
address);
 
   90       for (
const auto& member_name : member_names) {
 
   91         auto* member = 
static_cast<TDataMember*
>(t_class->GetDataMember(member_name.c_str()));
 
   92         tree.SetBranchAddress(member_name.c_str(),
 
   93                               reinterpret_cast<void*
>(base + member->GetOffset()));
 
  100     THROW(JException, 
"Members of type " << 
typeid(T).name() << 
"\n" 
  101                                          << 
JEEP::JEEPZ() << member_names << 
"\nBranches in tree\n" 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
std::vector< std::string > to_vector(TCollection *col)
 
Auxiliary data structure for streaming of STL containers.
 
 
 
 
◆ release()
◆ getAddress()
◆ address
The documentation for this class was generated from the following file: