CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventStringOutputBranches.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_NanoAOD_EventStringOutputBranches_h
2 #define PhysicsTools_NanoAOD_EventStringOutputBranches_h
3 
4 #include <string>
5 #include <vector>
6 #include <TTree.h>
10 
12 public:
14  const edm::EDGetToken &token,
15  bool update_only_at_new_lumi = false)
16  : m_token(token), m_lastLumi(-1), m_fills(0), m_update_only_at_new_lumi(update_only_at_new_lumi) {
17  if (desc->className() != "std::basic_string<char,std::char_traits<char> >")
18  throw cms::Exception("Configuration",
19  "NanoAODOutputModule/EventStringOutputBranches can only write out std::string objects");
20  }
21 
22  void updateEventStringNames(TTree &, const std::string &);
23  void fill(const edm::EventForOutput &iEvent, TTree &tree);
24 
25 private:
27  struct NamedBranchPtr {
29  TBranch *branch;
30  bool buffer;
31  NamedBranchPtr(const std::string &aname, const std::string &atitle, TBranch *branchptr = nullptr)
32  : name(aname), title(atitle), branch(branchptr), buffer(false) {}
33  };
34  std::vector<NamedBranchPtr> m_evStringBranches;
35  long m_lastLumi;
36  unsigned long m_fills;
38 };
39 
40 #endif
void fill(const edm::EventForOutput &iEvent, TTree &tree)
NamedBranchPtr(const std::string &aname, const std::string &atitle, TBranch *branchptr=nullptr)
std::vector< NamedBranchPtr > m_evStringBranches
int iEvent
Definition: GenABIO.cc:224
void updateEventStringNames(TTree &, const std::string &)
std::string const & className() const
EventStringOutputBranches(const edm::BranchDescription *desc, const edm::EDGetToken &token, bool update_only_at_new_lumi=false)