11 #include "RConfigure.h" 33 if (tree) branch = tree->GetBranch(colName.c_str());
34 if (!branch and !tmpBranch) {
35 throw std::runtime_error(
"Column \"" + colName +
"\" is not in a file and has not been defined.");
39 static const TClassRef tbranchelRef(
"TBranchElement");
44 auto typeCode = title[strlen(title) - 1];
47 else if (typeCode ==
'b')
48 return "unsigned char";
49 else if (typeCode ==
'I')
51 else if (typeCode ==
'i')
52 return "unsigned int";
53 else if (typeCode ==
'S')
55 else if (typeCode ==
's')
56 return "unsigned short";
57 else if (typeCode ==
'D')
59 else if (typeCode ==
'F')
61 else if (typeCode ==
'L')
63 else if (typeCode ==
'l')
65 else if (typeCode ==
'O')
70 const auto &type_id = tmpBranch->
GetTypeId();
73 }
else if (type_id ==
typeid(
char))
75 else if (type_id ==
typeid(
unsigned char))
76 return "unsigned char";
77 else if (type_id ==
typeid(
int))
79 else if (type_id ==
typeid(
unsigned int))
80 return "unsigned int";
81 else if (type_id ==
typeid(
short))
83 else if (type_id ==
typeid(
unsigned short))
84 return "unsigned short";
85 else if (type_id ==
typeid(
long))
87 else if (type_id ==
typeid(
unsigned long))
88 return "unsigned long";
89 else if (type_id ==
typeid(
double))
91 else if (type_id ==
typeid(
float))
93 else if (type_id ==
typeid(
Long64_t))
97 else if (type_id ==
typeid(
bool))
100 std::string msg(
"Cannot deduce type of temporary column ");
101 msg += colName.c_str();
102 msg +=
". The typename is ";
105 throw std::runtime_error(msg);
109 std::string msg(
"Cannot deduce type of column ");
110 msg += colName.c_str();
112 throw std::runtime_error(msg);
127 unsigned int nSlots = 1;
136 if (treePtr !=
nullptr) {
137 std::string branchNameInt(branchName);
138 auto branch = treePtr->GetBranch(branchNameInt.c_str());
139 if (branch !=
nullptr) {
140 auto msg =
"branch \"" + branchNameInt +
"\" already present in TTree";
141 throw std::runtime_error(msg);
147 const ColumnNames_t &
PickBranchNames(
unsigned int nArgs,
const ColumnNames_t &bl,
const ColumnNames_t &defBl)
149 bool useDefBl =
false;
150 if (nArgs != bl.size()) {
151 if (bl.size() == 0 && nArgs == defBl.size()) {
154 auto msg =
"mismatch between number of filter/define arguments (" + std::to_string(nArgs) +
155 ") and number of columns specified (" + std::to_string(bl.size() ? bl.size() : defBl.size()) +
156 "). Please check the number of arguments of the function/lambda/functor and the number of branches " 158 throw std::runtime_error(msg);
162 return useDefBl ? defBl : bl;
UInt_t GetImplicitMTPoolSize()
Returns the size of the pool used for implicit multi-threading.
Namespace for new ROOT classes and functions.
TTree()
Default constructor and I/O constructor.
const ColumnNames_t & PickBranchNames(unsigned int nArgs, const ColumnNames_t &bl, const ColumnNames_t &defBl)
Returns local BranchNames or default BranchNames according to which one should be used...
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
std::string ColumnName2ColumnTypeName(const std::string &colName, TTree *tree, TCustomColumnBase *tmpBranch)
Return a string containing the type of the given branch.
A Branch for the case of an object.
virtual const std::type_info & GetTypeId() const =0
unsigned long long ULong64_t
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
TClassRef is used to implement a permanent reference to a TClass object.
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
const char * ToConstCharPtr(const std::string s)
void CheckTmpBranch(std::string_view branchName, TTree *treePtr)
A TTree is a list of TBranches.
virtual const char * GetTitle() const
Returns title of object.