Skip to content

Commit

Permalink
Add support for EventHeader conversion (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zehvogel authored Apr 19, 2023
1 parent e0589ca commit 1add3c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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;
}

// The EventHeaderCollection should be of length 1
void convEventHeader(const edm4hep::EventHeaderCollection* const header_coll, lcio::LCEventImpl* const lcio_event)
{
if (header_coll->size() != 1) {
return;
}

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

0 comments on commit 1add3c8

Please sign in to comment.