Skip to content

Commit

Permalink
Add event info
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Apr 17, 2020
1 parent a526d1b commit b43ce77
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CmsNanoAod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ MamaCollection::MamaCollection(const std::string& name) :

s = "^"; s += name; s += "_(.*)$";
m_data_re.Reset(s, "o", 1);

if (name == "EventInfo")
{
m_data_re.Reset("^(run|luminosityBlock|event)$", "o", 1);
}
}

MamaCollection::~MamaCollection()
Expand Down Expand Up @@ -95,6 +100,11 @@ void MamaCollection::goto_event(Long64_t ev)
m_num_ents_leaf->GetBranch()->GetEntry(ev);
m_entries = ((UInt_t*)(m_num_ents_leaf->GetValuePointer()))[0];
}
else
{
// If not a vector (does not have nClass branch), assume single entry.
m_entries = 1;
}

for (auto &m : m_members)
{
Expand Down
3 changes: 3 additions & 0 deletions cms_nano_aod_bootstrap.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ nanoaod::Event * g_event = nullptr;

void cms_nano_aod_config_event(nanoaod::Event *e)
{
// EventInfo is handled specifically to pick up run / lumi / event ids.
e->RegisterMamaCollection("EventInfo");

e->RegisterMamaCollection("Electron");
e->RegisterMamaCollection("Jet");
e->RegisterMamaCollection("MET");
Expand Down

0 comments on commit b43ce77

Please sign in to comment.