Skip to content

Commit

Permalink
Delete the version checks for Podio before 1.0 (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored Aug 10, 2024
1 parent 526f542 commit 21e4f40
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 52 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ include(cmake/build_flags.cmake)
k4edm4hep2lcioconv_set_compiler_flags()

find_package(LCIO 2.20.1 REQUIRED)
find_package(podio REQUIRED)
find_package(podio 1.0 REQUIRED)
find_package(EDM4HEP 0.99 REQUIRED)
find_package(ROOT REQUIRED COMPONENTS MathCore)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ using TrackerHit3D = edm4hep::TrackerHit;
#include <edm4hep/utils/ParticleIDUtils.h>

#include "podio/Frame.h"
#include "podio/podioVersion.h"

// LCIO
#include <IMPL/CalorimeterHitImpl.h>
Expand Down Expand Up @@ -76,11 +75,7 @@ using ObjectMapT = k4EDM4hep2LcioConv::VecMapT<T1, T2>;
template <typename T1, typename T2>
using vec_pair [[deprecated("Use a more descriptive alias")]] = ObjectMapT<T1, T2>;

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
using CellIDStrType = const std::optional<std::string>;
#else
using CellIDStrType = const std::string;
#endif

struct CollectionsPairVectors {
ObjectMapT<lcio::TrackImpl*, edm4hep::Track> tracks{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,9 @@ std::unique_ptr<lcio::LCCollectionVec> convertTrackerHits(const edm4hep::Tracker
TrackerHitMapT& trackerHitMap) {
auto trackerhits = std::make_unique<lcio::LCCollectionVec>(lcio::LCIO::TRACKERHIT);

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
if (cellIDstr.has_value()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr.value(), trackerhits.get());
}
#else
if (!cellIDstr.empty()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr, trackerhits.get());
}
#endif

// Loop over EDM4hep trackerhits converting them to lcio trackerhits
for (const auto& edm_trh : (*edmColection)) {
Expand Down Expand Up @@ -122,15 +116,9 @@ convertTrackerHitPlanes(const edm4hep::TrackerHitPlaneCollection* const edmColle
TrackerHitPlaneMapT& trackerHitsMap) {
auto trackerHitPlanes = std::make_unique<lcio::LCCollectionVec>(lcio::LCIO::TRACKERHITPLANE);

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
if (cellIDstr.has_value()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr.value(), trackerHitPlanes.get());
}
#else
if (!cellIDstr.empty()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr, trackerHitPlanes.get());
}
#endif

for (const auto& edm_trh : (*edmCollection)) {
if (edm_trh.isAvailable()) {
Expand Down Expand Up @@ -172,15 +160,9 @@ convertSimTrackerHits(const edm4hep::SimTrackerHitCollection* const edmCollectio
SimTrHitMapT& simTrHitMap) {
auto simtrackerhits = std::make_unique<lcio::LCCollectionVec>(lcio::LCIO::SIMTRACKERHIT);

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
if (cellIDstr.has_value()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr.value(), simtrackerhits.get());
}
#else
if (!cellIDstr.empty()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr, simtrackerhits.get());
}
#endif

// Loop over EDM4hep simtrackerhits converting them to LCIO simtrackerhits
for (const auto& edm_strh : (*edmCollection)) {
Expand Down Expand Up @@ -222,15 +204,9 @@ convertCalorimeterHits(const edm4hep::CalorimeterHitCollection* const edmCollect
CaloHitMapT& caloHitMap) {
auto calohits = std::make_unique<lcio::LCCollectionVec>(lcio::LCIO::CALORIMETERHIT);

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
if (cellIDstr.has_value()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr.value(), calohits.get());
}
#else
if (!cellIDstr.empty()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr, calohits.get());
}
#endif

for (const auto& edm_calohit : (*edmCollection)) {
if (edm_calohit.isAvailable()) {
Expand Down Expand Up @@ -296,15 +272,9 @@ convertSimCalorimeterHits(const edm4hep::SimCalorimeterHitCollection* const edmC
const CellIDStrType& cellIDstr, SimCaloHitMapT& simCaloHitMap) {
auto simcalohits = std::make_unique<lcio::LCCollectionVec>(lcio::LCIO::SIMCALORIMETERHIT);

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
if (cellIDstr.has_value()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr.value(), simcalohits.get());
}
#else
if (!cellIDstr.empty()) {
lcio::CellIDEncoder<lcio::SimCalorimeterHitImpl> idEnc(cellIDstr, simcalohits.get());
}
#endif

for (const auto& edm_sim_calohit : (*edmCollection)) {
if (edm_sim_calohit.isAvailable()) {
Expand Down
8 changes: 0 additions & 8 deletions standalone/lcio2edm4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@

#include <edm4hep/utils/ParticleIDUtils.h>

#include "podio/podioVersion.h"
#if PODIO_BUILD_VERSION >= PODIO_VERSION(0, 99, 0)
#include "podio/ROOTWriter.h"
#else
#include "podio/ROOTFrameWriter.h"
namespace podio {
using ROOTWriter = podio::ROOTFrameWriter;
}
#endif

#include <cstdlib>
#include <fstream>
Expand Down
8 changes: 0 additions & 8 deletions tests/compare_contents.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
#include "CompareEDM4hepLCIO.h"
#include "ObjectMapping.h"

#include "podio/podioVersion.h"
#if PODIO_BUILD_VERSION >= PODIO_VERSION(0, 99, 0)
#include "podio/ROOTReader.h"
#else
#include "podio/ROOTFrameReader.h"
namespace podio {
using ROOTReader = podio::ROOTFrameReader;
}
#endif

#include "podio/Frame.h"

Expand Down

0 comments on commit 21e4f40

Please sign in to comment.