Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EventHeader conversion #13

Merged
merged 5 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -140,6 +140,8 @@ lcio::LCCollectionVec* convMCParticles(
const edm4hep::MCParticleCollection* const mcparticle_coll,
vec_pair<lcio::MCParticleImpl*, edm4hep::MCParticle>& mc_particles_vec);

void convEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event);

void FillMissingCollections(CollectionsPairVectors& collection_pairs);

bool collectionExist(const std::string& collection_name, const lcio::LCEventImpl* lcio_event);
Expand Down
14 changes: 14 additions & 0 deletions k4EDM4hep2LcioConv/src/k4EDM4hep2LcioConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,20 @@ lcio::LCCollectionVec* convMCParticles(
return mcparticles;
}

void convEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event)
{
// the collection should be of length 1
if (header_coll->size() != 1) {
// TODO: somehow warn about this?
return;
}
Zehvogel marked this conversation as resolved.
Show resolved Hide resolved
const auto& header = header_coll->at(0);
lcio_event->setEventNumber(header.getEventNumber());
lcio_event->setRunNumber(header.getRunNumber());
lcio_event->setTimeStamp(header.getTimeStamp());
lcio_event->setWeight(header.getWeight());
}

// Depending on the order of the collections in the parameters,
// and for the mutual dependencies between some collections,
// go over the possible missing associated collections and fill them.
Expand Down