6 #include <TDirectory.h>
10 #include "Math/VectorUtil.h"
14 #include <boost/exception/all.hpp>
27 template<
typename TTreePtr>
28 [[ deprecated(
"Use Darwin::Tools::Flow()") ]]
31 auto brList = tree->GetListOfBranches();
33 for (
auto it = brList->begin(); it != brList->end(); ++it) {
34 TString
name = (*it)->GetName();
35 if (
name == brName) brFound =
true;
42 template<
typename T> std::vector<T*>
GetObjects (TDirectory * dir)
45 BOOST_THROW_EXCEPTION( std::runtime_error(
"Trying to access inexistent `TDirectory`") );
46 std::vector<T*> objects;
47 for (
const auto&& element: *(dir->GetListOfKeys())) {
48 auto key =
dynamic_cast<TKey*
>(element);
49 if (
auto obj =
dynamic_cast<T*
>(
key->ReadObj()); obj)
50 objects.push_back(obj);
57 inline TDirectory *
GetDirectory (TDirectory * dir,
const std::vector<const char *>& names)
59 for (
const char *
name: names) {
60 TDirectory * subdir = dir->GetDirectory(
name);
62 BOOST_THROW_EXCEPTION( std::invalid_argument(
63 Form(
"`%s` could not be found in `%s`",
name, dir->GetName())) );
69 using ROOT::Math::VectorUtil::DeltaPhi;
70 using ROOT::Math::VectorUtil::DeltaR;