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

Use k4EDM4hep2LcioConv as separate lib #77

Merged
merged 4 commits into from
Jun 15, 2022
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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project(k4MarlinWrapper LANGUAGES CXX)

# RPATH settings
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "RPATH USE LINK PATH")
option(USE_RUNPATH_INSTEAD_OF_RPATH "Use runpath instead of rpath (allow specifying liked libraries via LD_LIBRARY_PATH)" OFF)
option(USE_RUNPATH_INSTEAD_OF_RPATH "Use runpath instead of rpath (allow specifying linked libraries via LD_LIBRARY_PATH)" OFF)
if(USE_RUNPATH_INSTEAD_OF_RPATH)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags")
endif()
Expand Down Expand Up @@ -60,6 +60,7 @@ find_package(LCIO REQUIRED)
find_package(Marlin REQUIRED)
find_package(EDM4HEP REQUIRED)
find_package(k4FWCore REQUIRED)
find_package(k4EDM4hep2LcioConv REQUIRED)
find_package(k4LCIOReader REQUIRED)

include(CTest)
Expand Down
3 changes: 2 additions & 1 deletion k4MarlinWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ gaudi_add_module(EDM4hep2Lcio
SOURCES
src/components/EDM4hep2Lcio.cpp
LINK
k4EDM4hep2LcioConv::k4EDM4hep2LcioConv
k4FWCore::k4FWCore
Gaudi::GaudiAlgLib
${LCIO_LIBRARIES}
k4FWCore::k4FWCore
EDM4HEP::edm4hep
)

Expand Down
23 changes: 3 additions & 20 deletions k4MarlinWrapper/k4MarlinWrapper/converters/EDM4hep2Lcio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,14 @@
// FWCore
#include <k4FWCore/DataHandle.h>

//k4EDM4hep2LcioConv
#include "k4EDM4hep2LcioConv/k4EDM4hep2LcioConv.h"

// k4MarlinWrapper
#include "k4MarlinWrapper/LCEventWrapper.h"
#include "k4MarlinWrapper/converters/IEDMConverter.h"
#include "k4MarlinWrapper/util/k4MarlinWrapperUtil.h"

template <typename T1, typename T2> using vec_pair = std::vector<std::pair<T1, T2>>;

struct CollectionsPairVectors {
vec_pair<lcio::TrackImpl*, edm4hep::Track> tracks;
vec_pair<lcio::TrackerHitImpl*, edm4hep::TrackerHit> trackerhits;
vec_pair<lcio::SimTrackerHitImpl*, edm4hep::SimTrackerHit> simtrackerhits;
vec_pair<lcio::CalorimeterHitImpl*, edm4hep::CalorimeterHit> calohits;
vec_pair<lcio::RawCalorimeterHitImpl*, edm4hep::RawCalorimeterHit> rawcalohits;
vec_pair<lcio::SimCalorimeterHitImpl*, edm4hep::SimCalorimeterHit> simcalohits;
vec_pair<lcio::TPCHitImpl*, edm4hep::TPCHit> tpchits;
vec_pair<lcio::ClusterImpl*, edm4hep::Cluster> clusters;
vec_pair<lcio::VertexImpl*, edm4hep::Vertex> vertices;
vec_pair<lcio::ReconstructedParticleImpl*, edm4hep::ReconstructedParticle> recoparticles;
vec_pair<lcio::MCParticleImpl*, edm4hep::MCParticle> mcparticles;
};

class EDM4hep2LcioTool : public GaudiTool, virtual public IEDMConverter {
public:
EDM4hep2LcioTool(const std::string& type, const std::string& name, const IInterface* parent);
Expand Down Expand Up @@ -100,12 +87,8 @@ class EDM4hep2LcioTool : public GaudiTool, virtual public IEDMConverter {
const std::string& e4h_coll_name, const std::string& lcio_coll_name,
lcio::LCEventImpl* lcio_event);

void FillMissingCollections(CollectionsPairVectors& collection_pairs);

void convertAdd(const std::string& e4h_coll_name, const std::string& lcio_coll_name, lcio::LCEventImpl* lcio_event,
CollectionsPairVectors& collection_pairs);

bool collectionExist(const std::string& collection_name, lcio::LCEventImpl* lcio_event);
};

#endif
Loading