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

feat: support EDM4hep v0.99, with TrackerHit as interface type #1676

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion src/algorithms/fardetectors/FarDetectorLinearTracking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
#include <edm4eic/TrackPoint.h>
#include <edm4eic/TrackSegmentCollection.h>
#include <edm4eic/vector_utils.h>
#include <edm4hep/EDM4hepVersion.h>
#if EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
veprbl marked this conversation as resolved.
Show resolved Hide resolved
#include <edm4hep/TrackerHitCollection.h>
namespace edm4hep {
using TrackerHit3DCollection = TrackerHitCollection;
}
#else
#include <edm4hep/TrackerHit3DCollection.h>
#endif
#include <edm4hep/Vector3d.h>
#include <edm4hep/Vector3f.h>
#include <edm4hep/utils/vector_utils.h>
Expand Down Expand Up @@ -71,7 +79,7 @@ namespace eicrecon {

void FarDetectorLinearTracking::buildMatrixRecursive(int level,
Eigen::MatrixXd* hitMatrix,
const std::vector<gsl::not_null<const edm4hep::TrackerHitCollection*>>& hits,
const std::vector<gsl::not_null<const edm4hep::TrackerHit3DCollection*>>& hits,
gsl::not_null<edm4eic::TrackSegmentCollection*> outputTracks ) const {

// Iterate over hits in this layer
Expand Down
12 changes: 10 additions & 2 deletions src/algorithms/fardetectors/FarDetectorLinearTracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
#include <algorithms/algorithm.h>
#include <algorithms/interfaces/WithPodConfig.h>
#include <edm4eic/TrackSegmentCollection.h>
#include <edm4hep/EDM4hepVersion.h>
#if EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
#include <edm4hep/TrackerHitCollection.h>
namespace edm4hep {
using TrackerHit3DCollection = TrackerHitCollection;
}
#else
#include <edm4hep/TrackerHit3DCollection.h>
#endif
#include <gsl/pointers>
#include <string>
#include <string_view>
Expand All @@ -18,7 +26,7 @@
namespace eicrecon {

using FarDetectorLinearTrackingAlgorithm =
algorithms::Algorithm<algorithms::Input<std::vector<edm4hep::TrackerHitCollection>>,
algorithms::Algorithm<algorithms::Input<std::vector<edm4hep::TrackerHit3DCollection>>,
algorithms::Output<edm4eic::TrackSegmentCollection>>;

class FarDetectorLinearTracking : public FarDetectorLinearTrackingAlgorithm,
Expand All @@ -44,7 +52,7 @@ class FarDetectorLinearTracking : public FarDetectorLinearTrackingAlgorithm,

void
buildMatrixRecursive(int level, Eigen::MatrixXd* hitMatrix,
const std::vector<gsl::not_null<const edm4hep::TrackerHitCollection*>>& hits,
const std::vector<gsl::not_null<const edm4hep::TrackerHit3DCollection*>>& hits,
gsl::not_null<edm4eic::TrackSegmentCollection*> outputTracks) const;

void checkHitCombination(Eigen::MatrixXd* hitMatrix,
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/fardetectors/FarDetectorTrackerCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ FarDetectorTrackerCluster::ClusterHits(const edm4eic::RawTrackerHitCollection& i
// Convert to global coordinates and create TrackerHits
void FarDetectorTrackerCluster::ConvertClusters(
const std::vector<FDTrackerCluster>& clusters,
edm4hep::TrackerHitCollection& outputClusters) const {
edm4hep::TrackerHit3DCollection& outputClusters) const {

// Get context of first hit
const dd4hep::VolumeManagerContext* context = m_cellid_converter->findContext(clusters[0].cellID);
Expand Down
12 changes: 10 additions & 2 deletions src/algorithms/fardetectors/FarDetectorTrackerCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
#include <Parsers/Primitives.h>
#include <algorithms/algorithm.h>
#include <edm4eic/RawTrackerHitCollection.h>
#include <edm4hep/EDM4hepVersion.h>
#if EDM4HEP_BUILD_VERSION < EDM4HEP_VERSION(0, 99, 0)
#include <edm4hep/TrackerHitCollection.h>
namespace edm4hep {
using TrackerHit3DCollection = TrackerHitCollection;
}
#else
#include <edm4hep/TrackerHit3DCollection.h>
#endif
#include <podio/ObjectID.h>
#include <string>
#include <string_view>
Expand All @@ -32,7 +40,7 @@ namespace eicrecon {

using FarDetectorTrackerClusterAlgorithm =
algorithms::Algorithm<algorithms::Input<std::vector<edm4eic::RawTrackerHitCollection>>,
algorithms::Output<std::vector<edm4hep::TrackerHitCollection>>>;
algorithms::Output<std::vector<edm4hep::TrackerHit3DCollection>>>;

class FarDetectorTrackerCluster : public FarDetectorTrackerClusterAlgorithm,
public WithPodConfig<FarDetectorTrackerClusterConfig> {
Expand All @@ -55,7 +63,7 @@ class FarDetectorTrackerCluster : public FarDetectorTrackerClusterAlgorithm,
std::vector<FDTrackerCluster> ClusterHits(const edm4eic::RawTrackerHitCollection&) const;

/** Convert clusters to TrackerHits **/
void ConvertClusters(const std::vector<FDTrackerCluster>&, edm4hep::TrackerHitCollection&) const;
void ConvertClusters(const std::vector<FDTrackerCluster>&, edm4hep::TrackerHit3DCollection&) const;

private:
const dd4hep::Detector* m_detector{nullptr};
Expand Down
Loading