From 4aef16fab985282df864e0b04083a642a0bafb57 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Fri, 23 Feb 2024 10:26:57 +0100 Subject: [PATCH] Use Tracker3D when avaliable --- ARCdigi/include/ARCdigitizer.h | 12 ++++++++++-- ARCdigi/src/ARCdigitizer.cpp | 2 +- DCHdigi/include/DCHsimpleDigitizer.h | 12 ++++++++++-- DCHdigi/src/DCHsimpleDigitizer.cpp | 2 +- Tracking/include/GenFitter.h | 9 ++++++++- Tracking/src/GenFitter.cpp | 2 +- VTXdigi/include/VTXdigitizer.h | 12 ++++++++++-- VTXdigi/src/VTXdigitizer.cpp | 2 +- 8 files changed, 42 insertions(+), 11 deletions(-) diff --git a/ARCdigi/include/ARCdigitizer.h b/ARCdigi/include/ARCdigitizer.h index 09fb346..9d70b27 100644 --- a/ARCdigi/include/ARCdigitizer.h +++ b/ARCdigi/include/ARCdigitizer.h @@ -11,14 +11,22 @@ // EDM4HEP #include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else #include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif // DD4HEP #include "DD4hep/Detector.h" /** @class ARCdigitizer * - * Algorithm for creating digitized (meaning 'reconstructed' for now) ARC hits (edm4hep::TrackerHit) from Geant4 hits (edm4hep::SimTrackerHit). + * Algorithm for creating digitized (meaning 'reconstructed' for now) ARC hits (edm4hep::TrackerHit3D) from Geant4 hits (edm4hep::SimTrackerHit). * * @author Brieuc Francois, Matthew Basso * @date 2023-03 @@ -46,7 +54,7 @@ class ARCdigitizer : public GaudiAlgorithm { // Input sim tracker hit collection name DataHandle m_input_sim_hits{"inputSimHits", Gaudi::DataHandle::Reader, this}; // Output digitized tracker hit collection name - DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; + DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; // Flat value for SiPM efficiency FloatProperty m_flat_SiPM_effi{this, "flatSiPMEfficiency", -1.0, "Flat value for SiPM quantum efficiency (<0 := disabled)"}; // Apply the SiPM efficiency to digitized hits instead of simulated hits diff --git a/ARCdigi/src/ARCdigitizer.cpp b/ARCdigi/src/ARCdigitizer.cpp index 6331507..6758cd9 100644 --- a/ARCdigi/src/ARCdigitizer.cpp +++ b/ARCdigi/src/ARCdigitizer.cpp @@ -68,7 +68,7 @@ StatusCode ARCdigitizer::execute() { dd4hep::rec::CellIDPositionConverter converter(*m_detector); // Write the digitized hits - edm4hep::TrackerHitCollection* output_digi_hits = m_output_digi_hits.createAndPut(); + edm4hep::TrackerHit3DCollection* output_digi_hits = m_output_digi_hits.createAndPut(); for (auto it = merged_digi_hits.begin(); it != merged_digi_hits.end(); it++) { // Throw away digitized hits based on flat SiPM efficiency if (m_apply_SiPM_effi_to_digi && m_flat_SiPM_effi >= 0.0 && m_uniform.shoot() > m_flat_SiPM_effi) diff --git a/DCHdigi/include/DCHsimpleDigitizer.h b/DCHdigi/include/DCHsimpleDigitizer.h index 1cc55b4..e958045 100644 --- a/DCHdigi/include/DCHsimpleDigitizer.h +++ b/DCHdigi/include/DCHsimpleDigitizer.h @@ -12,7 +12,15 @@ // EDM4HEP #include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else #include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif // DD4HEP #include "DD4hep/Detector.h" // for dd4hep::VolumeManager @@ -20,7 +28,7 @@ /** @class DCHsimpleDigitizer * - * Algorithm for creating digitized drift chamber hits (still based on edm4hep::TrackerHit) from edm4hep::SimTrackerHit. + * Algorithm for creating digitized drift chamber hits (still based on edm4hep::TrackerHit3D) from edm4hep::SimTrackerHit. * You have to specify the expected resolution in z and in xy (distance to the wire). The smearing is applied in the wire reference frame. * * @author Brieuc Francois @@ -49,7 +57,7 @@ class DCHsimpleDigitizer : public GaudiAlgorithm { // Input sim tracker hit collection name DataHandle m_input_sim_hits{"inputSimHits", Gaudi::DataHandle::Reader, this}; // Output digitized tracker hit collection name - DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; + DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; // Detector readout name Gaudi::Property m_readoutName{this, "readoutName", "CDCHHits", "Name of the detector readout"}; diff --git a/DCHdigi/src/DCHsimpleDigitizer.cpp b/DCHdigi/src/DCHsimpleDigitizer.cpp index 4587371..f538dfd 100644 --- a/DCHdigi/src/DCHsimpleDigitizer.cpp +++ b/DCHdigi/src/DCHsimpleDigitizer.cpp @@ -51,7 +51,7 @@ StatusCode DCHsimpleDigitizer::execute() { debug() << "Input Sim Hit collection size: " << input_sim_hits->size() << endmsg; // Digitize the sim hits - edm4hep::TrackerHitCollection* output_digi_hits = m_output_digi_hits.createAndPut(); + edm4hep::TrackerHit3DCollection* output_digi_hits = m_output_digi_hits.createAndPut(); for (const auto& input_sim_hit : *input_sim_hits) { auto output_digi_hit = output_digi_hits->create(); // smear the hit position: need to go in the wire local frame to smear in the direction aligned/perpendicular with the wire for z/distanceToWire, taking e.g. stereo angle into account diff --git a/Tracking/include/GenFitter.h b/Tracking/include/GenFitter.h index f4e3758..4826a63 100644 --- a/Tracking/include/GenFitter.h +++ b/Tracking/include/GenFitter.h @@ -9,7 +9,14 @@ // EDM4HEP #include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else #include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif // GENFIT //#include "WireMeasurement.h" @@ -42,7 +49,7 @@ class GenFitter : public GaudiAlgorithm { private: // Input tracker hit collection name - DataHandle m_input_hits{"inputHits", Gaudi::DataHandle::Reader, this}; + DataHandle m_input_hits{"inputHits", Gaudi::DataHandle::Reader, this}; // Output track collection name DataHandle m_output_tracks{"outputTracks", Gaudi::DataHandle::Writer, this}; // Transient genfit measurements used internally by genfit to run the tracking diff --git a/Tracking/src/GenFitter.cpp b/Tracking/src/GenFitter.cpp index 9438c29..5de0c71 100644 --- a/Tracking/src/GenFitter.cpp +++ b/Tracking/src/GenFitter.cpp @@ -13,7 +13,7 @@ StatusCode GenFitter::initialize() { return StatusCode::SUCCESS; } StatusCode GenFitter::execute() { // Get the input collection with tracker hits - const edm4hep::TrackerHitCollection* input_hits = m_input_hits.get(); + const edm4hep::TrackerHit3DCollection* input_hits = m_input_hits.get(); verbose() << "Input Hit collection size: " << input_hits->size() << endmsg; // Convert edm4hep::TrackerHitCollection to Genfit measurements diff --git a/VTXdigi/include/VTXdigitizer.h b/VTXdigi/include/VTXdigitizer.h index 6cf4936..b0dcd75 100644 --- a/VTXdigi/include/VTXdigitizer.h +++ b/VTXdigi/include/VTXdigitizer.h @@ -12,7 +12,15 @@ // EDM4HEP #include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#if __has_include("edm4hep/TrackerHit3DCollection.h") +#include "edm4hep/TrackerHit3DCollection.h" +#else #include "edm4hep/TrackerHitCollection.h" +namespace edm4hep { + using TrackerHit3DCollection = edm4hep::TrackerHitCollection; +} // namespace edm4hep +#endif // DD4HEP #include "DD4hep/Detector.h" // for dd4hep::VolumeManager @@ -23,7 +31,7 @@ /** @class VTXdigitizer * - * Algorithm for creating digitized (meaning 'reconstructed' for now) vertex detector hits (edm4hep::TrackerHit) from Geant4 hits (edm4hep::SimTrackerHit). + * Algorithm for creating digitized (meaning 'reconstructed' for now) vertex detector hits (edm4hep::TrackerHit3D) from Geant4 hits (edm4hep::SimTrackerHit). * * @author Brieuc Francois * @date 2023-03 @@ -51,7 +59,7 @@ class VTXdigitizer : public GaudiAlgorithm { // Input sim vertex hit collection name DataHandle m_input_sim_hits{"inputSimHits", Gaudi::DataHandle::Reader, this}; // Output digitized vertex hit collection name - DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; + DataHandle m_output_digi_hits{"outputDigiHits", Gaudi::DataHandle::Writer, this}; // Detector name Gaudi::Property m_detectorName{this, "detectorName", "Vertex", "Name of the detector (default: Vertex)"}; diff --git a/VTXdigi/src/VTXdigitizer.cpp b/VTXdigi/src/VTXdigitizer.cpp index 46a1367..2e610c3 100644 --- a/VTXdigi/src/VTXdigitizer.cpp +++ b/VTXdigi/src/VTXdigitizer.cpp @@ -52,7 +52,7 @@ StatusCode VTXdigitizer::execute() { unsigned nDismissedHits=0; // Digitize the sim hits - edm4hep::TrackerHitCollection* output_digi_hits = m_output_digi_hits.createAndPut(); + edm4hep::TrackerHit3DCollection* output_digi_hits = m_output_digi_hits.createAndPut(); for (const auto& input_sim_hit : *input_sim_hits) { auto output_digi_hit = output_digi_hits->create();