Skip to content

Commit

Permalink
fix: migration to Acts 30.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wdconinc committed Nov 17, 2023
1 parent 48fda26 commit 4c32274
Show file tree
Hide file tree
Showing 49 changed files with 315 additions and 1,404 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ endif()
add_definitions("-DActs_VERSION_MAJOR=${Acts_VERSION_MAJOR}")
add_definitions("-DActs_VERSION_MINOR=${Acts_VERSION_MINOR}")
add_definitions("-DActs_VERSION_PATCH=${Acts_VERSION_PATCH}")
# Get ActsCore path for ActsExamples include
get_target_property(ActsCore_LOCATION ActsCore LOCATION)
get_filename_component(ActsCore_PATH ${ActsCore_LOCATION} DIRECTORY)

## algorithms dependency
option(USE_SYSTEM_ALGORITHMS "Use system-provided algorithms" OFF)
Expand Down
6 changes: 3 additions & 3 deletions JugAlgo/src/components/AlgoServiceSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ StatusCode AlgoServiceSvc::initialize() {
static_cast<algorithms::LogLevel>(msgLevel() > 0 ? msgLevel() - 1 : 0)};
info() << "Setting up algorithms::LogSvc with default level " << algorithms::logLevelName(level)
<< endmsg;
serviceSvc.setInit<algorithms::LogSvc>([=](auto&& logger) {
serviceSvc.setInit<algorithms::LogSvc>([this,level](auto&& logger) {
this->info() << "Initializing the algorithms::LogSvc using the Gaudi logger" << endmsg;
logger.defaultLevel(level);
logger.init(
Expand Down Expand Up @@ -75,15 +75,15 @@ StatusCode AlgoServiceSvc::initialize() {
<< "Make sure you have GeoSvc in the right order in the configuration." << endmsg;
return StatusCode::FAILURE;
}
serviceSvc.setInit<algorithms::GeoSvc>([=](auto&& g) {
serviceSvc.setInit<algorithms::GeoSvc>([this](auto&& g) {
this->info() << "Initializing algorithms::RandomSvc with the Juggler GeoSvc" << endmsg;
g.init(m_geoSvc->detector());
});
// setup random service
info() << "Setting up algorithms::RandomSvc\n"
<< " --> using internal STL 64-bit MT engine\n"
<< " --> seed set to" << m_randomSeed << endmsg;
serviceSvc.setInit<algorithms::RandomSvc>([=](auto&& r) {
serviceSvc.setInit<algorithms::RandomSvc>([this](auto&& r) {
this->info() << "Initializing the algorithms::RandomSvc" << endmsg;
r.setProperty("seed", m_randomSeed);
r.init();
Expand Down
30 changes: 27 additions & 3 deletions JugBase/JugBase/ACTSLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class GaudiFilterPolicy : public Acts::Logging::OutputFilterPolicy {
public:
GaudiFilterPolicy(IMessageSvc* owner) : m_owner(owner) {}
GaudiFilterPolicy(IMessageSvc* owner, const Acts::Logging::Level& lvl) : m_owner(owner), m_level(lvl) {}

bool doPrint(const Acts::Logging::Level& lvl) const {

Expand Down Expand Up @@ -47,17 +47,41 @@ class GaudiFilterPolicy : public Acts::Logging::OutputFilterPolicy {
return l >= m_owner->outputLevel();
}

/// Get the level of this filter policy
/// @return the levele
Acts::Logging::Level level() const override { return m_level; }

/// Make a copy of this filter policy with a new level
/// @param level the new level
/// @return the new copy
std::unique_ptr<OutputFilterPolicy> clone(Acts::Logging::Level level) const override {
return std::make_unique<GaudiFilterPolicy>(m_owner, level);
}

private:
IMessageSvc* m_owner;
Acts::Logging::Level m_level;
};

class GaudiPrintPolicy : public Acts::Logging::OutputPrintPolicy {
public:
GaudiPrintPolicy(IMessageSvc* owner) : m_messenger(owner) {}
GaudiPrintPolicy(IMessageSvc* owner) : m_owner(owner),m_messenger(owner) {}

const std::string& name() const override {
return m_name;
};

/// Make a copy of this print policy with a new name
/// @param name the new name
/// @return the copy
std::unique_ptr<Acts::Logging::OutputPrintPolicy> clone(
const std::string& name) const override {
(void)name;
return std::make_unique<GaudiPrintPolicy>(m_owner);
};

void setName(std::string name) {
m_name = name;

}

void flush(const Acts::Logging::Level& lvl, const std::string& input) {
Expand Down
43 changes: 0 additions & 43 deletions JugBase/JugBase/Acts/MaterialWiper.hpp

This file was deleted.

3 changes: 1 addition & 2 deletions JugBase/src/ACTSLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
namespace Acts {
std::unique_ptr<const Logger> getDefaultLogger(const std::string& name, const Logging::Level& lvl, std::ostream* /* unused */) {
using namespace Logging;
//ServiceHandle<IMessageSvc>* msgSvc = new ServiceHandle<IMessageSvc>("MessageSvc", name);
ServiceHandle<IMessageSvc> msgSvc("MessageSvc", name);
msgSvc->setOutputLevel(lvl + 1);
auto printPol = std::make_unique<GaudiPrintPolicy>(&(*msgSvc));
printPol->setName(name);
return std::make_unique<Acts::Logger>(std::move(printPol),
std::make_unique<GaudiFilterPolicy>(&(*msgSvc)));
std::make_unique<GaudiFilterPolicy>(&(*msgSvc), lvl));
}
}
7 changes: 2 additions & 5 deletions JugBase/src/components/GeoSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "DD4hep/Printout.h"

#include "JugBase/ACTSLogger.h"
#include "JugBase/Acts/MaterialWiper.hpp"

#include "Acts/Geometry/TrackingGeometry.hpp"
#include "Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp"
Expand Down Expand Up @@ -113,12 +112,10 @@ StatusCode GeoSvc::initialize() {
// Set up the json-based decorator
m_materialDeco = std::make_shared<const Acts::JsonMaterialDecorator>(
jsonGeoConvConfig, m_jsonFileName, m_actsLoggingLevel);
} else {
m_log << MSG::WARNING << "no ACTS materials map has been loaded" << endmsg;
m_materialDeco = std::make_shared<const Acts::MaterialWiper>();
}

// Convert DD4hep geometry to ACTS
auto logger = Acts::getDefaultLogger("CONV", m_actsLoggingLevel);
Acts::BinningType bTypePhi = Acts::equidistant;
Acts::BinningType bTypeR = Acts::equidistant;
Acts::BinningType bTypeZ = Acts::equidistant;
Expand All @@ -128,7 +125,7 @@ StatusCode GeoSvc::initialize() {
using Acts::sortDetElementsByID;
m_trackingGeo = Acts::convertDD4hepDetector(
m_dd4hepGeo->world(),
m_actsLoggingLevel,
*logger,
bTypePhi,
bTypeR,
bTypeZ,
Expand Down
1 change: 1 addition & 0 deletions JugDigi/src/components/CalorimeterBirksCorr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <algorithm>
#include <cmath>

#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiKernel/PhysicalConstants.h"
Expand Down
3 changes: 2 additions & 1 deletion JugDigi/src/components/CalorimeterHitDigi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <cmath>
#include <unordered_map>

#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiKernel/PhysicalConstants.h"
Expand Down Expand Up @@ -147,7 +148,7 @@ namespace Jug::Digi {
return StatusCode::FAILURE;
}
id_mask = ~id_mask;
info() << fmt::format("ID mask in {:s}: {:#064b}", m_readout, id_mask) << endmsg;
info() << fmt::format("ID mask in {:s}: {:#064b}", m_readout.value(), id_mask) << endmsg;
return StatusCode::SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions JugDigi/src/components/PhotoMultiplierDigi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <unordered_map>
#include <cmath>

#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiKernel/RndmGenerators.h"
Expand Down
1 change: 1 addition & 0 deletions JugDigi/src/components/SiliconTrackerDigi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cmath>

#include "Gaudi/Property.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/GaudiTool.h"
#include "GaudiAlg/Transformer.h"
#include "GaudiKernel/PhysicalConstants.h"
Expand Down
2 changes: 1 addition & 1 deletion JugReco/src/components/CalorimeterHitsMerger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class CalorimeterHitsMerger : public GaudiAlgorithm {
return StatusCode::FAILURE;
}
id_mask = ~id_mask;
info() << fmt::format("ID mask in {:s}: {:#064b}", m_readout, id_mask) << endmsg;
info() << fmt::format("ID mask in {:s}: {:#064b}", m_readout.value(), id_mask) << endmsg;
return StatusCode::SUCCESS;
}

Expand Down
8 changes: 5 additions & 3 deletions JugReco/src/components/ImagingClusterReco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
* Author: Chao Peng (ANL), 06/02/2021
*/
#include "fmt/format.h"
#pragma GCC diagnostic push // save the actual diag context
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" // disable maybe warnings
#include <Eigen/Dense>
#pragma GCC diagnostic pop // restore previous diag context
#include <algorithm>

#include "Gaudi/Property.h"
Expand Down Expand Up @@ -38,7 +41,6 @@
#include "edm4hep/utils/vector_utils.h"

using namespace Gaudi::Units;
using namespace Eigen;

namespace Jug::Reco {

Expand Down Expand Up @@ -329,7 +331,7 @@ class ImagingClusterReco : public GaudiAlgorithm {

mean_pos = mean_pos / nrows;
// fill position data
MatrixXd pos(nrows, 3);
Eigen::MatrixXd pos(nrows, 3);
int ir = 0;
for (const auto& layer : layers) {
if ((layer.getNhits() > 0) && (layer.getHits(0).getLayer() <= m_trackStopLayer)) {
Expand All @@ -341,7 +343,7 @@ class ImagingClusterReco : public GaudiAlgorithm {
}
}

JacobiSVD<MatrixXd> svd(pos, ComputeThinU | ComputeThinV);
Eigen::JacobiSVD<Eigen::MatrixXd> svd(pos, Eigen::ComputeThinU | Eigen::ComputeThinV);
const auto dir = svd.matrixV().col(0);
// theta and phi
return {std::acos(dir(2)), std::atan2(dir(1), dir(0))};
Expand Down
1 change: 1 addition & 0 deletions JugTrack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gaudi_add_module(JugTrackPlugins
EDM4EIC::edm4eic
DD4hep::DDRec
ActsCore
${ActsCore_PATH}/libActsExamplesFramework.so
)

target_include_directories(JugTrackPlugins PUBLIC
Expand Down
Loading

0 comments on commit 4c32274

Please sign in to comment.