CP3-llbb Framework
Types.h
1 #pragma once
2 
3 #include <Math/Vector4D.h>
4 #include <unordered_map>
5 
6 #define BRANCH(NAME, ...) __VA_ARGS__& NAME = tree[#NAME].write<__VA_ARGS__>()
7 #define TRANSIENT_BRANCH(NAME, ...) __VA_ARGS__& NAME = tree[#NAME].transient_write<__VA_ARGS__>()
8 #define ONLY_NOMINAL_BRANCH(NAME, ...) __VA_ARGS__& NAME = Framework::condition_branch<__VA_ARGS__>(tree, #NAME, !doingSystematics())
9 
10 typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float>> LorentzVector;
11 typedef std::unordered_map<std::string, float> tauDiscriminatorMap;
12 
13 #include <cp3_llbb/TreeWrapper/interface/TreeWrapper.h>
14 namespace Framework {
15  template <typename T>
16  T& condition_branch(ROOT::TreeGroup& tree, const std::string& branch_name, bool condition) {
17  if (condition) {
18  return tree[branch_name].write<T>();
19  } else {
20  return tree[branch_name].transient_write<T>();
21  }
22  }
23 
24  template<typename Type>
25  std::set<Type> union_sets(std::initializer_list<std::set<Type>> sets)
26  {
27  std::set<Type> result;
28  for(const auto& set : sets)
29  result.insert(set.begin(), set.end());
30  return result;
31  }
32 
33 
34 }