Skip to content

Commit

Permalink
Remove pre processor version checks for podio
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Jun 28, 2024
1 parent ca9de56 commit 0e49873
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 74 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ spack-*
install/
## podio
podio_generated_files.cmake
/include/podio/podioVersion.h
/python/podio/__init__.py

## EDM4hep
/python/edm4hep/__version__.py
edm4hep/edm4hep/
Expand Down
8 changes: 0 additions & 8 deletions test/hepmc/edm4hep_testhepmc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
#include "HepPDT/ParticleID.hh"

#include "podio/Frame.h"
#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99)
#include "podio/ROOTWriter.h"
#else
#include "podio/ROOTFrameWriter.h"
#endif

#include "edm4hep/MCParticleCollection.h"

Expand Down Expand Up @@ -158,11 +154,7 @@ int main() {
auto event = podio::Frame();
event.put(std::move(edm_particle_collection), "TestParticles2");

#if PODIO_VERSION_MAJOR > 0 || (PODIO_VERSION_MAJOR == 0 && PODIO_VERSION_MINOR >= 99)
auto writer = podio::ROOTWriter("edm4hep_testhepmc.root");
#else
auto writer = podio::ROOTFrameWriter("edm4hep_testhepmc.root");
#endif
writer.writeFrame(event, "events");

// after all events
Expand Down
8 changes: 0 additions & 8 deletions test/read_events.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#include "read_events.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

int main() {
read_events<podio::ROOTReader>("edm4hep_events.root");
Expand Down
5 changes: 0 additions & 5 deletions test/read_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

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

// STL
#include <iostream>
Expand Down Expand Up @@ -273,11 +272,7 @@ void processEvent(const podio::Frame& event) {
// throw std::runtime_error("Collection 'SimCalorimeterHitContributions' should be present");
// }

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
const auto evtType = event.getParameter<std::string>("EventType").value();
#else
const auto& evtType = event.getParameter<std::string>("EventType");
#endif
std::cout << "Event Type: " << evtType << std::endl;
}

Expand Down
8 changes: 0 additions & 8 deletions test/read_events_sio.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#include "read_events.h"

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

int main(int, char**) {
read_events<podio::SIOReader>("edm4hep_events.sio");
Expand Down
8 changes: 0 additions & 8 deletions test/write_events.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#include "write_events.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

int main(int, char*[]) {

Expand Down
8 changes: 0 additions & 8 deletions test/write_events_sio.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
#include "write_events.h"

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

int main(int, char**) {
write<podio::SIOWriter>("edm4hep_events.sio");
Expand Down
10 changes: 1 addition & 9 deletions tools/src/edm4hep2json.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@
#include "TFile.h"

// podio
#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/ROOTLegacyReader.h"
#include "podio/ROOTReader.h"

// std
#include <filesystem>
Expand Down
18 changes: 0 additions & 18 deletions utils/src/ParticleIDUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "edm4hep/Constants.h"

#include <podio/FrameCategories.h>
#include <podio/podioVersion.h>

#include <iterator>
#include <stdexcept>
Expand Down Expand Up @@ -141,7 +140,6 @@ void PIDHandler::setAlgoInfo(podio::Frame& metadata, const std::string& collName
std::optional<edm4hep::utils::ParticleIDMeta> PIDHandler::getAlgoInfo(const podio::Frame& metadata,
const std::string& collName) {

#if PODIO_BUILD_VERSION > PODIO_VERSION(0, 99, 0)
auto maybeAlgoName =
metadata.getParameter<std::string>(podio::collMetadataParamName(collName, edm4hep::labels::PIDAlgoName));
if (!maybeAlgoName.has_value()) {
Expand All @@ -156,22 +154,6 @@ std::optional<edm4hep::utils::ParticleIDMeta> PIDHandler::getAlgoInfo(const podi
podio::collMetadataParamName(collName, edm4hep::labels::PIDParameterNames))
.value()};

#else

const auto& algoName =
metadata.getParameter<std::string>(podio::collMetadataParamName(collName, edm4hep::labels::PIDAlgoName));
// Use the algoName as proxy to see whether we could actually get the
// information from the metadata
if (algoName.empty()) {
return std::nullopt;
}

ParticleIDMeta pidInfo{
algoName, metadata.getParameter<int>(podio::collMetadataParamName(collName, edm4hep::labels::PIDAlgoType)),
metadata.getParameter<std::vector<std::string>>(
podio::collMetadataParamName(collName, edm4hep::labels::PIDParameterNames))};
#endif

return pidInfo;
}

Expand Down

0 comments on commit 0e49873

Please sign in to comment.