Skip to content

Commit 47c8390

Browse files
authored
Do not use GaudiAlg (#38)
* Do not use GaudiAlg, use Gaudi::Algorithm instead These are the initial changes that are necessary to get rid of GaudiAlg. * Don't link to GaudiAlgLib, add a few mutables * Fix typo * Remove unrelated formatting changes --------- Co-authored-by: jmcarcell <jmcarcell@users.noreply.github.com>
1 parent b87c867 commit 47c8390

File tree

16 files changed

+59
-63
lines changed

16 files changed

+59
-63
lines changed

DRdigi/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ gaudi_add_module(DRdigi
1313
LINK
1414
EDM4HEP::edm4hep
1515
sipm::sipm
16-
Gaudi::GaudiAlgLib
1716
Gaudi::GaudiKernel
1817
k4FWCore::k4FWCore
1918
)

DRdigi/include/DigiSiPM.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99

1010
#include "k4FWCore/DataHandle.h"
1111

12-
#include "GaudiAlg/GaudiAlgorithm.h"
12+
#include "Gaudi/Algorithm.h"
1313
#include "GaudiKernel/ToolHandle.h"
1414

1515
#include "SiPMSensor.h"
1616

17-
class DigiSiPM : public GaudiAlgorithm {
17+
class DigiSiPM : public Gaudi::Algorithm {
1818
public:
1919
DigiSiPM(const std::string& name, ISvcLocator* svcLoc);
2020
virtual ~DigiSiPM() {};
2121

2222
StatusCode initialize();
23-
StatusCode execute();
23+
StatusCode execute(const EventContext&) const;
2424
StatusCode finalize();
2525

2626
private:
27-
DataHandle<edm4hep::RawCalorimeterHitCollection> m_rawHits{"RawCalorimeterHits", Gaudi::DataHandle::Reader, this};
28-
DataHandle<edm4hep::RawTimeSeriesCollection> m_timeStruct{"RawTimeStructs", Gaudi::DataHandle::Reader, this};
27+
mutable DataHandle<edm4hep::RawCalorimeterHitCollection> m_rawHits{"RawCalorimeterHits", Gaudi::DataHandle::Reader, this};
28+
mutable DataHandle<edm4hep::RawTimeSeriesCollection> m_timeStruct{"RawTimeStructs", Gaudi::DataHandle::Reader, this};
2929

30-
DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Writer, this};
31-
DataHandle<edm4hep::TimeSeriesCollection> m_waveforms{"DigiWaveforms", Gaudi::DataHandle::Writer, this};
30+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Writer, this};
31+
mutable DataHandle<edm4hep::TimeSeriesCollection> m_waveforms{"DigiWaveforms", Gaudi::DataHandle::Writer, this};
3232

3333
std::unique_ptr<sipm::SiPMSensor> m_sensor;
3434

DRdigi/src/DigiSiPM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
DECLARE_COMPONENT(DigiSiPM)
77

8-
DigiSiPM::DigiSiPM(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc) {}
8+
DigiSiPM::DigiSiPM(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc) {}
99

1010
StatusCode DigiSiPM::initialize() {
11-
StatusCode sc = GaudiAlgorithm::initialize();
11+
StatusCode sc = Gaudi::Algorithm::initialize();
1212

1313
if (sc.isFailure()) return sc;
1414

@@ -32,7 +32,7 @@ StatusCode DigiSiPM::initialize() {
3232
return StatusCode::SUCCESS;
3333
}
3434

35-
StatusCode DigiSiPM::execute() {
35+
StatusCode DigiSiPM::execute(const EventContext&) const {
3636
const edm4hep::RawTimeSeriesCollection* timeStructs = m_timeStruct.get();
3737
const edm4hep::RawCalorimeterHitCollection* rawHits = m_rawHits.get();
3838

@@ -104,5 +104,5 @@ StatusCode DigiSiPM::execute() {
104104
}
105105

106106
StatusCode DigiSiPM::finalize() {
107-
return GaudiAlgorithm::finalize();
107+
return Gaudi::Algorithm::finalize();
108108
}

DRreco/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ gaudi_add_module(DRreco
1515
LINK
1616
EDM4HEP::edm4hep
1717
DRsegmentation
18-
Gaudi::GaudiAlgLib
1918
Gaudi::GaudiKernel
2019
k4FWCore::k4FWCore
2120
CLHEP::CLHEP

DRreco/include/DRcalib2D.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "k4FWCore/DataHandle.h"
55

6-
#include "GaudiAlg/GaudiAlgorithm.h"
6+
#include "Gaudi/Algorithm.h"
77
#include "GaudiKernel/ToolHandle.h"
88

99
#include "edm4hep/CalorimeterHitCollection.h"
@@ -13,26 +13,26 @@
1313

1414
class IGeoSvc;
1515

16-
class DRcalib2D : public GaudiAlgorithm {
16+
class DRcalib2D : public Gaudi::Algorithm {
1717
public:
1818
DRcalib2D(const std::string& name, ISvcLocator* svcLoc);
1919
virtual ~DRcalib2D() {};
2020

2121
StatusCode initialize();
22-
StatusCode execute();
22+
StatusCode execute(const EventContext&) const;
2323
StatusCode finalize();
2424

2525
void readCSV(std::string filename);
2626

2727
private:
28-
edm4hep::Vector3f getPosition(dd4hep::DDSegmentation::CellID& cID);
28+
edm4hep::Vector3f getPosition(dd4hep::DDSegmentation::CellID& cID) const;
2929

3030
ServiceHandle<IGeoSvc> m_geoSvc;
3131
dd4hep::DDSegmentation::GridDRcalo* pSeg;
32-
dd4hep::DDSegmentation::DRparamBase* pParamBase;
32+
mutable dd4hep::DDSegmentation::DRparamBase* pParamBase;
3333

34-
DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Reader, this};
35-
DataHandle<edm4hep::CalorimeterHitCollection> m_caloHits{"DRcalo2dHits", Gaudi::DataHandle::Writer, this};
34+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Reader, this};
35+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_caloHits{"DRcalo2dHits", Gaudi::DataHandle::Writer, this};
3636

3737
Gaudi::Property<std::string> m_calibPath{this, "calibPath", "share/calib.csv", "relative path to calibration csv file"};
3838
Gaudi::Property<std::string> m_readoutName{this, "readoutName", "DRcaloSiPMreadout", "readout name of DRcalo"};

DRreco/include/DRcalib3D.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "k4FWCore/DataHandle.h"
55

6-
#include "GaudiAlg/GaudiAlgorithm.h"
6+
#include "Gaudi/Algorithm.h"
77
#include "GaudiKernel/ToolHandle.h"
88

99
#include "edm4hep/CalorimeterHitCollection.h"
@@ -15,29 +15,29 @@
1515
class TH1D;
1616
class IGeoSvc;
1717

18-
class DRcalib3D : public GaudiAlgorithm {
18+
class DRcalib3D : public Gaudi::Algorithm {
1919
public:
2020
DRcalib3D(const std::string& name, ISvcLocator* svcLoc);
2121
virtual ~DRcalib3D() {};
2222

2323
StatusCode initialize();
24-
StatusCode execute();
24+
StatusCode execute(const EventContext&) const;
2525
StatusCode finalize();
2626

27-
TH1* processFFT(TH1* waveHist);
27+
TH1* processFFT(TH1* waveHist) const;
2828

2929
private:
3030
ServiceHandle<IGeoSvc> m_geoSvc;
3131
dd4hep::DDSegmentation::GridDRcalo* pSeg;
32-
dd4hep::DDSegmentation::DRparamBase* pParamBase;
32+
mutable dd4hep::DDSegmentation::DRparamBase* pParamBase;
3333
std::unique_ptr<TH1D> m_veloC;
3434
std::unique_ptr<TH1D> m_veloS;
3535

36-
DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Reader, this};
37-
DataHandle<edm4hep::TimeSeriesCollection> m_waveforms{"DigiWaveforms", Gaudi::DataHandle::Reader, this};
38-
DataHandle<edm4hep::CalorimeterHitCollection> m_2dHits{"DRcalo2dHits", Gaudi::DataHandle::Reader, this};
39-
DataHandle<edm4hep::CalorimeterHitCollection> m_caloHits{"DRcalo3dHits", Gaudi::DataHandle::Writer, this};
40-
DataHandle<edm4hep::TimeSeriesCollection> m_postprocTime{"DRpostprocTime", Gaudi::DataHandle::Writer, this};
36+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_digiHits{"DigiCalorimeterHits", Gaudi::DataHandle::Reader, this};
37+
mutable DataHandle<edm4hep::TimeSeriesCollection> m_waveforms{"DigiWaveforms", Gaudi::DataHandle::Reader, this};
38+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_2dHits{"DRcalo2dHits", Gaudi::DataHandle::Reader, this};
39+
mutable DataHandle<edm4hep::CalorimeterHitCollection> m_caloHits{"DRcalo3dHits", Gaudi::DataHandle::Writer, this};
40+
mutable DataHandle<edm4hep::TimeSeriesCollection> m_postprocTime{"DRpostprocTime", Gaudi::DataHandle::Writer, this};
4141

4242
Gaudi::Property<std::string> m_readoutName{this, "readoutName", "DRcaloSiPMreadout", "readout name of DRcalo"};
4343
Gaudi::Property<std::string> m_veloFile{this, "veloFile", "share/velo.root", "velocity profile file name"};

DRreco/src/DRcalib2D.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
DECLARE_COMPONENT(DRcalib2D)
1111

12-
DRcalib2D::DRcalib2D(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
12+
DRcalib2D::DRcalib2D(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
1313
declareProperty("GeoSvc", m_geoSvc);
1414

1515
pSeg = nullptr;
1616
pParamBase = nullptr;
1717
}
1818

1919
StatusCode DRcalib2D::initialize() {
20-
StatusCode sc = GaudiAlgorithm::initialize();
20+
StatusCode sc = Gaudi::Algorithm::initialize();
2121

2222
if (sc.isFailure()) return sc;
2323

@@ -40,7 +40,7 @@ StatusCode DRcalib2D::initialize() {
4040
return StatusCode::SUCCESS;
4141
}
4242

43-
StatusCode DRcalib2D::execute() {
43+
StatusCode DRcalib2D::execute(const EventContext&) const {
4444
const edm4hep::CalorimeterHitCollection* digiHits = m_digiHits.get();
4545
edm4hep::CalorimeterHitCollection* caloHits = m_caloHits.createAndPut();
4646

@@ -70,10 +70,10 @@ StatusCode DRcalib2D::execute() {
7070
StatusCode DRcalib2D::finalize() {
7171
m_calibs.clear();
7272

73-
return GaudiAlgorithm::finalize();
73+
return Gaudi::Algorithm::finalize();
7474
}
7575

76-
edm4hep::Vector3f DRcalib2D::getPosition(dd4hep::DDSegmentation::CellID& cID) {
76+
edm4hep::Vector3f DRcalib2D::getPosition(dd4hep::DDSegmentation::CellID& cID) const {
7777
auto globalPos = pSeg->position( cID );
7878
return { static_cast<float>( globalPos.x() * CLHEP::millimeter/dd4hep::millimeter ),
7979
static_cast<float>( globalPos.y() * CLHEP::millimeter/dd4hep::millimeter ),

DRreco/src/DRcalib3D.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313

1414
DECLARE_COMPONENT(DRcalib3D)
1515

16-
DRcalib3D::DRcalib3D(const std::string& aName, ISvcLocator* aSvcLoc) : GaudiAlgorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
16+
DRcalib3D::DRcalib3D(const std::string& aName, ISvcLocator* aSvcLoc) : Gaudi::Algorithm(aName, aSvcLoc), m_geoSvc("GeoSvc", aName) {
1717
declareProperty("GeoSvc", m_geoSvc);
1818

1919
pSeg = nullptr;
2020
pParamBase = nullptr;
2121
}
2222

2323
StatusCode DRcalib3D::initialize() {
24-
StatusCode sc = GaudiAlgorithm::initialize();
24+
StatusCode sc = Gaudi::Algorithm::initialize();
2525

2626
if (sc.isFailure()) return sc;
2727

@@ -44,7 +44,7 @@ StatusCode DRcalib3D::initialize() {
4444
return StatusCode::SUCCESS;
4545
}
4646

47-
StatusCode DRcalib3D::execute() {
47+
StatusCode DRcalib3D::execute(const EventContext&) const {
4848
const edm4hep::CalorimeterHitCollection* digiHits = m_digiHits.get();
4949
const edm4hep::CalorimeterHitCollection* hits2d = m_2dHits.get();
5050
const edm4hep::TimeSeriesCollection* waveforms = m_waveforms.get();
@@ -162,9 +162,9 @@ StatusCode DRcalib3D::execute() {
162162
return StatusCode::SUCCESS;
163163
}
164164

165-
StatusCode DRcalib3D::finalize() { return GaudiAlgorithm::finalize(); }
165+
StatusCode DRcalib3D::finalize() { return Gaudi::Algorithm::finalize(); }
166166

167-
TH1* DRcalib3D::processFFT(TH1* waveHist) {
167+
TH1* DRcalib3D::processFFT(TH1* waveHist) const {
168168
int firstBin = waveHist->FindFirstBinAbove( m_zero.value()*waveHist->GetMaximum() );
169169
int lastBin = firstBin;
170170

DRsim/DRsimG4Components/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ file(GLOB headers
1111
gaudi_add_module(DRsimG4Components
1212
SOURCES ${sources}
1313
LINK
14-
Gaudi::GaudiAlgLib
1514
Gaudi::GaudiKernel
1615
k4FWCore::k4FWCore
1716
EDM4HEP::edm4hep

DRsim/DRsimG4Components/include/SimG4SaveDRcaloHits.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
#include "edm4hep/RawCalorimeterHitCollection.h"
88
#include "edm4hep/RawTimeSeriesCollection.h"
99

10-
#include "GaudiAlg/GaudiTool.h"
10+
#include "GaudiKernel/AlgTool.h"
1111
#include "k4FWCore/DataHandle.h"
1212
#include "k4Interface/ISimG4SaveOutputTool.h"
1313
#include "k4Interface/IGeoSvc.h"
1414

1515
class IGeoSvc;
1616

17-
class SimG4SaveDRcaloHits : public GaudiTool, virtual public ISimG4SaveOutputTool {
17+
class SimG4SaveDRcaloHits : public AlgTool, virtual public ISimG4SaveOutputTool {
1818
public:
1919
explicit SimG4SaveDRcaloHits(const std::string& aType, const std::string& aName, const IInterface* aParent);
2020
virtual ~SimG4SaveDRcaloHits();
@@ -30,9 +30,9 @@ class SimG4SaveDRcaloHits : public GaudiTool, virtual public ISimG4SaveOutputToo
3030

3131
Gaudi::Property<std::vector<std::string>> m_readoutNames{this, "readoutNames", {"DRcaloSiPMreadout"}, "Name of the readouts (hits collections) to save"};
3232

33-
DataHandle<edm4hep::RawCalorimeterHitCollection> mRawCaloHits{"RawCalorimeterHits", Gaudi::DataHandle::Writer, this};
34-
DataHandle<edm4hep::RawTimeSeriesCollection> mTimeStruct{"RawTimeStructs", Gaudi::DataHandle::Writer, this};
35-
DataHandle<edm4hep::RawTimeSeriesCollection> mWavlenStruct{"RawWavlenStructs", Gaudi::DataHandle::Writer, this};
33+
mutable DataHandle<edm4hep::RawCalorimeterHitCollection> mRawCaloHits{"RawCalorimeterHits", Gaudi::DataHandle::Writer, this};
34+
mutable DataHandle<edm4hep::RawTimeSeriesCollection> mTimeStruct{"RawTimeStructs", Gaudi::DataHandle::Writer, this};
35+
mutable DataHandle<edm4hep::RawTimeSeriesCollection> mWavlenStruct{"RawWavlenStructs", Gaudi::DataHandle::Writer, this};
3636
};
3737

3838
#endif

0 commit comments

Comments
 (0)