62 throw cms::Exception(
"NoTreeAvailable") <<
"No TTree set in TreeReader::addBranch." << std::endl;
64 TBranch *
branch =
tree->GetBranch(expression.c_str());
66 throw cms::Exception(
"BranchMissing") <<
"Tree branch \"" << expression <<
"\" missing." << std::endl;
74 name = (
const char *)branchName;
76 TLeaf *leaf =
dynamic_cast<TLeaf *
>(branch->GetLeaf(branchName));
78 throw cms::Exception(
"InvalidBranch") <<
"Tree branch \"" << branchName <<
"\" has no leaf." << std::endl;
80 TString
typeName = leaf->GetTypeName();
83 if (typeName ==
"Double_t" || typeName ==
"double")
85 else if (typeName ==
"Float_t" || typeName ==
"float")
87 else if (typeName ==
"Int_t" || typeName ==
"int")
89 else if (typeName ==
"Bool_t" || typeName ==
"bool")
93 if (typeName ==
"vector<double>" || typeName ==
"Vector<Double_t>")
95 else if (typeName ==
"vector<float>" || typeName ==
"Vector<Float_t>")
97 else if (typeName ==
"vector<int>" || typeName ==
"Vector<Int_t>")
99 else if (typeName ==
"vector<bool>" || typeName ==
"Vector<Bool_t>")
104 throw cms::Exception(
"InvalidBranch") <<
"Tree branch \"" << branchName
106 "unsupported type \"" 107 << typeName <<
"\"." << std::endl;
118 std::map<AtomicId, Value>::iterator
pos =
valueMap.find(name);
121 <<
"\" is not known to the " 125 pos->second.setOpt(opt, optVal);
129 std::map<AtomicId, Value>::const_iterator
pos =
valueMap.find(name);
131 throw cms::Exception(
"DuplicateVariable") <<
"Duplicate Variable \"" << name <<
"\"." << std::endl;
133 if (type !=
'D' && type !=
'F' && type !=
'I' && type !=
'B')
134 throw cms::Exception(
"InvalidType") <<
"Unsupported type '" << type
136 "TreeReader::addTypeSingle." 168 template <
typename T>
170 return std::pair<void *, std::vector<T> >(
nullptr, std::vector<T>());
174 std::map<AtomicId, Value>::const_iterator
pos =
valueMap.find(name);
176 throw cms::Exception(
"DuplicateVariable") <<
"Duplicate Variable \"" << name <<
"\"." << std::endl;
178 if (type !=
'D' && type !=
'F' && type !=
'I' && type !=
'B')
179 throw cms::Exception(
"InvalidType") <<
"Unsupported type '" << type
181 "TreeReader::addTypeMulti." 197 multiInt.push_back(makeMulti<Int_t>());
201 multiBool.push_back(makeMulti<Bool_t>());
215 throw cms::Exception(
"NoTreeAvailable") <<
"No TTree set in TreeReader::automaticAdd." << std::endl;
217 TIter iter(
tree->GetListOfBranches());
219 while ((obj = iter())) {
220 TBranch *
branch =
dynamic_cast<TBranch *
>(
obj);
224 if (skipTarget && !std::strcmp(branch->GetName(),
"__TARGET__"))
227 if (skipWeight && !std::strcmp(branch->GetName(),
"__WEIGHT__"))
252 throw cms::Exception(
"NoTreeAvailable") <<
"No TTree set in TreeReader::automaticAdd." << std::endl;
254 for (std::map<AtomicId, Value>::iterator iter =
valueMap.begin(); iter !=
valueMap.end(); iter++)
255 iter->second.update(
this);
262 throw cms::Exception(
"NoTreeAvailable") <<
"No TTree set in TreeReader::automaticAdd." << std::endl;
267 Long64_t entries =
tree->GetEntries();
277 for (std::map<AtomicId, Value>::const_iterator iter =
valueMap.begin(); iter !=
valueMap.end(); iter++)
278 iter->second.fill(iter->first,
this);
287 for (std::map<AtomicId, Value>::const_iterator iter =
valueMap.begin(); iter !=
valueMap.end(); iter++)
288 iter->second.fill(iter->first,
this);
297 std::vector<AtomicId>
result;
298 for (std::map<AtomicId, Value>::const_iterator iter =
valueMap.begin(); iter !=
valueMap.end(); iter++)
299 result.push_back(iter->first);
308 void *
value =
nullptr;
345 reader->
tree->SetBranchAddress(
name, value);
352 const std::vector<Double_t> *
values =
static_cast<const std::vector<Double_t> *
>(ptr);
355 for (std::vector<Double_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
360 const std::vector<Float_t> *
values =
static_cast<const std::vector<Float_t> *
>(ptr);
363 for (std::vector<Float_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
368 const std::vector<Int_t> *
values =
static_cast<const std::vector<Int_t> *
>(ptr);
371 for (std::vector<Int_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
376 const std::vector<Bool_t> *
values =
static_cast<const std::vector<Bool_t> *
>(ptr);
379 for (std::vector<Bool_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
407 #define TREEREADER_ADD_IMPL(T, C) \ 409 void TreeReader::addSingle<T>(AtomicId name, const T *value, bool opt) { \ 410 addTypeSingle(name, value, C, opt); \ 414 void TreeReader::addMulti(AtomicId name, const std::vector<T> *value) { \ 415 addTypeMulti(name, value, C); \ 423 #undef TREEREADER_ADD_IMPL
#define TREEREADER_ADD_IMPL(T, C)
const std::complex< double > I
static const std::string B
unsigned long long uint64_t
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)