CMS 3D CMS Logo

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:
13  EventStringOutputBranches(const edm::BranchDescription *desc, const edm::EDGetToken & token, bool update_only_at_new_lumi = false ) :
14  m_token(token), m_lastLumi(-1), m_fills(0), m_update_only_at_new_lumi(update_only_at_new_lumi)
15  {
16  if (desc->className() != "std::basic_string<char,std::char_traits<char> >") throw cms::Exception("Configuration", "NanoAODOutputModule/EventStringOutputBranches can only write out std::string objects");
17  }
18 
19  void updateEventStringNames(TTree &, const std::string &);
20  void fill(const edm::EventForOutput &iEvent,TTree & tree) ;
21 
22  private:
23 
25  struct NamedBranchPtr {
27  TBranch * branch;
28  bool buffer;
29  NamedBranchPtr(const std::string & aname, const std::string & atitle, TBranch *branchptr = nullptr) :
30  name(aname), title(atitle), branch(branchptr), buffer(false) {}
31  };
32  std::vector<NamedBranchPtr> m_evStringBranches;
33  long m_lastLumi;
34  unsigned long m_fills;
36 
37 };
38 
39 #endif
40 
void fill(const edm::EventForOutput &iEvent, TTree &tree)
std::vector< NamedBranchPtr > m_evStringBranches
int iEvent
Definition: GenABIO.cc:230
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)
Definition: tree.py:1
NamedBranchPtr(const std::string &aname, const std::string &atitle, TBranch *branchptr=0)