Skip to content

Commit

Permalink
Do not use GaudiAlg (#71)
Browse files Browse the repository at this point in the history
* Do not use GaudiAlg

* Remove ctx for consistency with all the other definitions

---------

Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
  • Loading branch information
jmcarcell and jmcarcell authored Jul 27, 2024
1 parent e570489 commit f04d263
Show file tree
Hide file tree
Showing 70 changed files with 214 additions and 216 deletions.
1 change: 0 additions & 1 deletion Detector/DetComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gaudi_add_module(DetComponents
DD4hep::DDRec
k4FWCore::k4FWCore
k4FWCore::k4Interface
Gaudi::GaudiAlgLib
Gaudi::GaudiKernel
EDM4HEP::edm4hep
ROOT::Core
Expand Down
11 changes: 6 additions & 5 deletions Detector/DetComponents/src/MergeCells.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "MergeCells.h"

#include "GaudiKernel/EventContext.h"

// FCCSW
#include "k4Interface/IGeoSvc.h"

Expand All @@ -8,21 +10,20 @@

// DD4hep
#include "DD4hep/Detector.h"
#include "DD4hep/BitFieldCoder.h"

using dd4hep::DDSegmentation::CellID;

DECLARE_COMPONENT(MergeCells)

MergeCells::MergeCells(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
MergeCells::MergeCells(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
declareProperty("inhits", m_inHits, "Hit collection to merge (input)");
declareProperty("outhits", m_outHits, "Merged hit collection (output)");
}

MergeCells::~MergeCells() {}

StatusCode MergeCells::initialize() {
if (GaudiAlgorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (m_idToMerge.empty()) {
error() << "No identifier to merge specified." << endmsg;
return StatusCode::FAILURE;
Expand Down Expand Up @@ -72,7 +73,7 @@ StatusCode MergeCells::initialize() {
return StatusCode::SUCCESS;
}

StatusCode MergeCells::execute() {
StatusCode MergeCells::execute(const EventContext&) const {
const auto inHits = m_inHits.get();
auto outHits = new edm4hep::CalorimeterHitCollection();

Expand Down Expand Up @@ -116,4 +117,4 @@ StatusCode MergeCells::execute() {
return StatusCode::SUCCESS;
}

StatusCode MergeCells::finalize() { return GaudiAlgorithm::finalize(); }
StatusCode MergeCells::finalize() { return Gaudi::Algorithm::finalize(); }
11 changes: 6 additions & 5 deletions Detector/DetComponents/src/MergeCells.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#define DETCOMPONENTS_MERGECELLS_H

// GAUDI
#include "GaudiAlg/GaudiAlgorithm.h"
#include "Gaudi/Algorithm.h"
#include "GaudiKernel/EventContext.h"

// FCCSW
#include "k4FWCore/DataHandle.h"
Expand Down Expand Up @@ -30,7 +31,7 @@ class CalorimeterHitCollection;
* @author Anna Zaborowska
*/

class MergeCells : public GaudiAlgorithm {
class MergeCells : public Gaudi::Algorithm {
public:
explicit MergeCells(const std::string&, ISvcLocator*);
virtual ~MergeCells();
Expand All @@ -41,7 +42,7 @@ class MergeCells : public GaudiAlgorithm {
/** Execute.
* @return status code
*/
virtual StatusCode execute() final;
virtual StatusCode execute(const EventContext&) const final;
/** Finalize.
* @return status code
Expand All @@ -52,9 +53,9 @@ class MergeCells : public GaudiAlgorithm {
/// Pointer to the geometry service
ServiceHandle<IGeoSvc> m_geoSvc;
/// Handle for the EDM Hits to be read
DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
/// Handle for the EDM Hits to be written
DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
// Handle to the detector ID descriptor
dd4hep::IDDescriptor m_descriptor;
/// Name of the detector readout
Expand Down
8 changes: 4 additions & 4 deletions Detector/DetComponents/src/MergeLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

DECLARE_COMPONENT(MergeLayers)

MergeLayers::MergeLayers(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
MergeLayers::MergeLayers(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
declareProperty("inhits", m_inHits, "Hit collection to merge (input)");
declareProperty("outhits", m_outHits, "Merged hit collection (output)");
}

MergeLayers::~MergeLayers() {}

StatusCode MergeLayers::initialize() {
if (GaudiAlgorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (m_idToMerge.empty()) {
error() << "No identifier to merge specified." << endmsg;
return StatusCode::FAILURE;
Expand Down Expand Up @@ -61,7 +61,7 @@ StatusCode MergeLayers::initialize() {
return StatusCode::SUCCESS;
}

StatusCode MergeLayers::execute() {
StatusCode MergeLayers::execute(const EventContext&) const {
const auto inHits = m_inHits.get();
auto outHits = new edm4hep::CalorimeterHitCollection();

Expand Down Expand Up @@ -109,4 +109,4 @@ StatusCode MergeLayers::execute() {
return StatusCode::SUCCESS;
}

StatusCode MergeLayers::finalize() { return GaudiAlgorithm::finalize(); }
StatusCode MergeLayers::finalize() { return Gaudi::Algorithm::finalize(); }
10 changes: 5 additions & 5 deletions Detector/DetComponents/src/MergeLayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define DETCOMPONENTS_MERGELAYERS_H

// GAUDI
#include "GaudiAlg/GaudiAlgorithm.h"
#include "Gaudi/Algorithm.h"

// FCCSW
#include "k4FWCore/DataHandle.h"
Expand Down Expand Up @@ -34,7 +34,7 @@ class CalorimeterHitCollection;
* @author Anna Zaborowska
*/

class MergeLayers : public GaudiAlgorithm {
class MergeLayers : public Gaudi::Algorithm {
public:
explicit MergeLayers(const std::string&, ISvcLocator*);
virtual ~MergeLayers();
Expand All @@ -45,7 +45,7 @@ class MergeLayers : public GaudiAlgorithm {
/** Execute.
* @return status code
*/
virtual StatusCode execute() final;
virtual StatusCode execute(const EventContext&) const final;
/** Finalize.
* @return status code
Expand All @@ -56,9 +56,9 @@ class MergeLayers : public GaudiAlgorithm {
/// Pointer to the geometry service
ServiceHandle<IGeoSvc> m_geoSvc;
/// Handle for the EDM Hits to be read
DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
/// Handle for the EDM Hits to be written
DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
// Handle to the detector ID descriptor
dd4hep::IDDescriptor m_descriptor;
/// Name of the detector readout
Expand Down
8 changes: 4 additions & 4 deletions Detector/DetComponents/src/RedoSegmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

DECLARE_COMPONENT(RedoSegmentation)

RedoSegmentation::RedoSegmentation(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
RedoSegmentation::RedoSegmentation(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
declareProperty("inhits", m_inHits, "Hit collection with old segmentation (input)");
declareProperty("outhits", m_outHits, "Hit collection with modified segmentation (output)");
}

RedoSegmentation::~RedoSegmentation() {}

StatusCode RedoSegmentation::initialize() {
if (GaudiAlgorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE;

if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
Expand Down Expand Up @@ -79,7 +79,7 @@ StatusCode RedoSegmentation::initialize() {
return StatusCode::SUCCESS;
}

StatusCode RedoSegmentation::execute() {
StatusCode RedoSegmentation::execute(const EventContext&) const {
const auto inHits = m_inHits.get();
auto outHits = m_outHits.createAndPut();
// loop over positioned hits to get the energy deposits: position and cellID
Expand Down Expand Up @@ -140,7 +140,7 @@ StatusCode RedoSegmentation::execute() {

StatusCode RedoSegmentation::finalize() {
info() << "RedoSegmentation finalize! " << endmsg;
return GaudiAlgorithm::finalize(); }
return Gaudi::Algorithm::finalize(); }

uint64_t RedoSegmentation::volumeID(uint64_t aCellId) const {
dd4hep::DDSegmentation::CellID cID = aCellId;
Expand Down
10 changes: 5 additions & 5 deletions Detector/DetComponents/src/RedoSegmentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define DETCOMPONENTS_REDOSEGMENTATION_H

// GAUDI
#include "GaudiAlg/GaudiAlgorithm.h"
#include "Gaudi/Algorithm.h"
#include "GaudiKernel/ToolHandle.h"

// k4FWCore
Expand Down Expand Up @@ -34,7 +34,7 @@
* @author Anna Zaborowska
*/

class RedoSegmentation : public GaudiAlgorithm {
class RedoSegmentation : public Gaudi::Algorithm {
public:
explicit RedoSegmentation(const std::string&, ISvcLocator*);
virtual ~RedoSegmentation();
Expand All @@ -45,7 +45,7 @@ class RedoSegmentation : public GaudiAlgorithm {
/** Execute.
* @return status code
*/
virtual StatusCode execute() final;
virtual StatusCode execute(const EventContext&) const final;
/** Finalize.
* @return status code
*/
Expand All @@ -60,10 +60,10 @@ class RedoSegmentation : public GaudiAlgorithm {
/// Pointer to the geometry service
ServiceHandle<IGeoSvc> m_geoSvc;
/// Handle for the EDM positioned hits to be read
DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{
"hits/caloInHits", Gaudi::DataHandle::Reader, this};
/// Handle for the EDM hits to be written
DataHandle<edm4hep::SimCalorimeterHitCollection> m_outHits{
mutable DataHandle<edm4hep::SimCalorimeterHitCollection> m_outHits{
"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
/// Handle for the output hits cell id encoding.
MetaDataHandle<std::string> m_outHitsCellIDEncoding{
Expand Down
8 changes: 4 additions & 4 deletions Detector/DetComponents/src/RewriteBitfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

DECLARE_COMPONENT(RewriteBitfield)

RewriteBitfield::RewriteBitfield(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
RewriteBitfield::RewriteBitfield(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
declareProperty("inhits", m_inHits, "Hit collection with old segmentation (input)");
declareProperty("outhits", m_outHits, "Hit collection with modified segmentation (output)");
}

RewriteBitfield::~RewriteBitfield() {}

StatusCode RewriteBitfield::initialize() {
if (GaudiAlgorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE;

if (!m_geoSvc) {
error() << "Unable to locate Geometry Service. "
Expand Down Expand Up @@ -71,7 +71,7 @@ StatusCode RewriteBitfield::initialize() {
return StatusCode::SUCCESS;
}

StatusCode RewriteBitfield::execute() {
StatusCode RewriteBitfield::execute(const EventContext&) const {
const auto inHits = m_inHits.get();
auto outHits = m_outHits.createAndPut();
// loop over positioned hits to get the energy deposits: position and cellID
Expand Down Expand Up @@ -101,4 +101,4 @@ StatusCode RewriteBitfield::execute() {
return StatusCode::SUCCESS;
}

StatusCode RewriteBitfield::finalize() { return GaudiAlgorithm::finalize(); }
StatusCode RewriteBitfield::finalize() { return Gaudi::Algorithm::finalize(); }
10 changes: 5 additions & 5 deletions Detector/DetComponents/src/RewriteBitfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define DETCOMPONENTS_REWRITEBITFIELD_H

// GAUDI
#include "GaudiAlg/GaudiAlgorithm.h"
#include "Gaudi/Algorithm.h"
#include "GaudiKernel/ToolHandle.h"

// FCCSW
Expand Down Expand Up @@ -36,7 +36,7 @@ class CalorimeterHitCollection;
* @author Anna Zaborowska
*/

class RewriteBitfield : public GaudiAlgorithm {
class RewriteBitfield : public Gaudi::Algorithm {
public:
explicit RewriteBitfield(const std::string&, ISvcLocator*);
virtual ~RewriteBitfield();
Expand All @@ -47,7 +47,7 @@ class RewriteBitfield : public GaudiAlgorithm {
/** Execute.
* @return status code
*/
virtual StatusCode execute() final;
virtual StatusCode execute(const EventContext&) const final;
/** Finalize.
* @return status code
*/
Expand All @@ -57,9 +57,9 @@ class RewriteBitfield : public GaudiAlgorithm {
/// Pointer to the geometry service
ServiceHandle<IGeoSvc> m_geoSvc;
/// Handle for the EDM hits to be read
DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_inHits{"hits/caloInHits", Gaudi::DataHandle::Reader, this};
/// Handle for the EDM hits to be written
DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_outHits{"hits/caloOutHits", Gaudi::DataHandle::Writer, this};
/// Name of the detector readout used in simulation
Gaudi::Property<std::string> m_oldReadoutName{this, "oldReadoutName", "",
"Name of the detector readout used in simulation"};
Expand Down
1 change: 0 additions & 1 deletion Detector/DetStudies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ gaudi_add_module(DetStudies
DD4hep::DDG4
k4FWCore::k4FWCore
k4FWCore::k4Interface
Gaudi::GaudiAlgLib
Gaudi::GaudiKernel
EDM4HEP::edm4hep
ROOT::Core
Expand Down
8 changes: 4 additions & 4 deletions Detector/DetStudies/src/components/EnergyInCaloLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ DECLARE_COMPONENT(EnergyInCaloLayers)


EnergyInCaloLayers::EnergyInCaloLayers(const std::string& aName, ISvcLocator* aSvcLoc)
: GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
: Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
declareProperty("deposits", m_deposits, "Energy deposits (input)");
declareProperty("particle", m_particle, "Generated single-particle event (input)");

Expand All @@ -27,7 +27,7 @@ EnergyInCaloLayers::~EnergyInCaloLayers() {}


StatusCode EnergyInCaloLayers::initialize() {
if (GaudiAlgorithm::initialize().isFailure()) return StatusCode::FAILURE;
if (Gaudi::Algorithm::initialize().isFailure()) return StatusCode::FAILURE;

// Check geometry service
if (!m_geoSvc) {
Expand Down Expand Up @@ -60,7 +60,7 @@ StatusCode EnergyInCaloLayers::initialize() {
}


StatusCode EnergyInCaloLayers::execute() {
StatusCode EnergyInCaloLayers::execute(const EventContext&) const {
auto decoder = m_geoSvc->getDetector()->readout(m_readoutName).idSpec().decoder();

// Initialize output variables
Expand Down Expand Up @@ -145,5 +145,5 @@ StatusCode EnergyInCaloLayers::execute() {


StatusCode EnergyInCaloLayers::finalize() {
return GaudiAlgorithm::finalize();
return Gaudi::Algorithm::finalize();
}
Loading

0 comments on commit f04d263

Please sign in to comment.