Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ class NanoAODRNTupleOutputModule : public edm::one::OutputModule<> {
class CommonEventFields {
public:
void createFields(RNTupleModel& model) {
model.AddField<UInt_t>("run", &m_run);
model.AddField<UInt_t>("luminosityBlock", &m_luminosityBlock);
model.AddField<std::uint64_t>("event", &m_event);
m_run = model.MakeField<UInt_t>("run");
m_luminosityBlock = model.MakeField<UInt_t>("luminosityBlock");
m_event = model.MakeField<std::uint64_t>("event");
}
void fill(const edm::EventID& id) {
m_run = id.run();
m_luminosityBlock = id.luminosityBlock();
m_event = id.event();
*m_run = id.run();
*m_luminosityBlock = id.luminosityBlock();
*m_event = id.event();
}

private:
UInt_t m_run;
UInt_t m_luminosityBlock;
std::uint64_t m_event;
std::shared_ptr<UInt_t> m_run;
std::shared_ptr<UInt_t> m_luminosityBlock;
std::shared_ptr<std::uint64_t> m_event;
} m_commonFields;

LumiNTuple m_lumi;
Expand Down
6 changes: 5 additions & 1 deletion PhysicsTools/NanoAOD/plugins/rntuple/TriggerOutputFields.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ void TriggerOutputFields::updateTriggerFields(const edm::TriggerResults& trigger

void TriggerOutputFields::makeUniqueFieldName(RNTupleModel& model, std::string& name) {
// Could also use a cache of names in a higher-level object, don't ask the RNTupleModel each time
const auto* existing_field = model.Get<bool>(name);
#if ROOT_VERSION_CODE < ROOT_VERSION(6, 31, 0)
auto existing_field = model.Get<bool>(name);
#else
auto existing_field = model.GetDefaultEntry().GetPtr<bool>(name);
#endif
if (!existing_field) {
return;
}
Expand Down