CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventStringOutputBranches.cc
Go to the documentation of this file.
4 
5 #include <iostream>
6 
8  bool found = false;
9  for (auto &existing : m_evStringBranches) {
10  existing.buffer = false;
11  if (evstring == existing.name) {
12  existing.buffer = true;
13  found = true;
14  }
15  }
16  if (!found && (!evstring.empty())) {
17  NamedBranchPtr nb(evstring, "EventString bit");
18  bool backFillValue = false;
19  nb.branch = tree.Branch(nb.name.c_str(), &backFillValue, (nb.name + "/O").c_str());
20  nb.branch->SetTitle(nb.title.c_str());
21  for (size_t i = 0; i < m_fills; i++)
22  nb.branch->Fill(); // Back fill
23  nb.buffer = true;
24  m_evStringBranches.push_back(nb);
25  for (auto &existing : m_evStringBranches)
26  existing.branch->SetAddress(&(existing.buffer)); // m_evStringBranches might have been resized
27  }
28 }
29 
31  if ((!m_update_only_at_new_lumi) || m_lastLumi != iEvent.id().luminosityBlock()) {
33  iEvent.getByToken(m_token, handle);
34  const std::string &evstring = *handle;
35  m_lastLumi = iEvent.id().luminosityBlock();
36  updateEventStringNames(tree, evstring);
37  }
38  m_fills++;
39 }
EventID const & id() const
void fill(const edm::EventForOutput &iEvent, TTree &tree)
std::vector< NamedBranchPtr > m_evStringBranches
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
int iEvent
Definition: GenABIO.cc:224
void updateEventStringNames(TTree &, const std::string &)
tuple handle
Definition: patZpeak.py:23
BasicHandle getByToken(EDGetToken token, TypeID const &typeID) const