Skip to content

Commit

Permalink
Merge geometry/rich{,/richgeo} into geometry/richgeo (#513)
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Dilks <christopher.j.dilks@gmail.com>
  • Loading branch information
veprbl and c-dilks authored Feb 27, 2023
1 parent 0e2f034 commit 5b1692c
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 72 deletions.
2 changes: 1 addition & 1 deletion src/global/pid/IrtParticleID_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void eicrecon::IrtParticleID_factory::Process(const std::shared_ptr<const JEvent
auto photoelectrons = event->Get<edm4hep::SimTrackerHit>(m_detector_name+"Hits");

// loop over photoelectrons
// FIXME: at the moment, we do nothing; the current version of this factory is only meant to test the `rich` service
// FIXME: at the moment, we do nothing; the current version of this factory is only meant to test the `richgeo` service
std::vector<edm4hep::ParticleID*> output_pid;
// for( const auto& photoelectron : photoelectrons ) {
// auto pid = new edm4hep::ParticleID(
Expand Down
2 changes: 1 addition & 1 deletion src/global/pid/IrtParticleID_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <edm4hep/ParticleID.h>

// services
#include <services/geometry/rich/RichGeo_service.h>
#include <services/geometry/richgeo/RichGeo_service.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>

Expand Down
2 changes: 1 addition & 1 deletion src/global/pid/RichTrack_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void eicrecon::RichTrack_factory::Init() {
auto detector_name = eicrecon::str::ReplaceAll(GetPluginName(), ".so", "");
auto param_prefix = detector_name + ":" + GetTag();
InitDataTags(param_prefix);
m_radiatorID = rich::ParseRadiatorName(GetTag());
m_radiatorID = richgeo::ParseRadiatorName(GetTag());

// services
m_richGeoSvc = app->GetService<RichGeo_service>();
Expand Down
4 changes: 2 additions & 2 deletions src/global/pid/RichTrack_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <algorithms/tracking/TrackPropagation.h>

// services
#include <services/geometry/rich/RichGeo_service.h>
#include <services/geometry/richgeo/RichGeo_service.h>
#include <services/geometry/acts/ACTSGeo_service.h>
#include <services/log/Log_service.h>
#include <extensions/spdlog/SpdlogExtensions.h>
Expand Down Expand Up @@ -44,7 +44,7 @@ namespace eicrecon {
std::string m_detector_name;
std::shared_ptr<RichGeo_service> m_richGeoSvc;
std::shared_ptr<ACTSGeo_service> m_actsSvc;
rich::ActsGeo *m_actsGeo;
richgeo::ActsGeo *m_actsGeo;
std::vector<std::shared_ptr<Acts::Surface>> m_trackingPlanes;
int m_numPlanes;
int m_radiatorID;
Expand Down
2 changes: 1 addition & 1 deletion src/services/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(geometry/dd4hep)
add_subdirectory(geometry/acts)
add_subdirectory(geometry/rich)
add_subdirectory(geometry/richgeo)
add_subdirectory(io/podio)
add_subdirectory(randomgenerator)
add_subdirectory(log)
Expand Down
24 changes: 0 additions & 24 deletions src/services/geometry/rich/CMakeLists.txt

This file was deleted.

12 changes: 0 additions & 12 deletions src/services/geometry/rich/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "ActsGeo.h"

std::vector<std::shared_ptr<Acts::Surface>> rich::ActsGeo::TrackingPlanes(int radiator, int numPlanes) {
std::vector<std::shared_ptr<Acts::Surface>> richgeo::ActsGeo::TrackingPlanes(int radiator, int numPlanes) {

// output list of surfaces
std::vector<std::shared_ptr<Acts::Surface>> discs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// local
#include "RichGeo.h"

namespace rich {
namespace richgeo {
class ActsGeo {
public:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# cmake configuration for an `EICrecon` plugin
cmake_minimum_required(VERSION 3.16)

# Automatically set plugin name the same as the directory name
# Don't forget string(REPLACE " " "_" PLUGIN_NAME ${PLUGIN_NAME}) if this dir has spaces in its name
get_filename_component(PLUGIN_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)

print_header(">>>> P L U G I N : ${PLUGIN_NAME} <<<<") # Fancy printing

# Function creates ${PLUGIN_NAME}_plugin and ${PLUGIN_NAME}_library targets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include "IrtGeo.h"

// constructor: creates IRT-DD4hep bindings using main `Detector` handle `*det_`
rich::IrtGeo::IrtGeo(std::string detName_, dd4hep::Detector *det_, bool verbose_) :
richgeo::IrtGeo::IrtGeo(std::string detName_, dd4hep::Detector *det_, bool verbose_) :
m_detName(detName_), m_det(det_), m_log(Logger::Instance(verbose_))
{
Bind();
}

// alternate constructor: use compact file for DD4hep geometry (backward compatibility)
rich::IrtGeo::IrtGeo(std::string detName_, std::string compactFile_, bool verbose_) :
richgeo::IrtGeo::IrtGeo(std::string detName_, std::string compactFile_, bool verbose_) :
m_detName(detName_), m_log(Logger::Instance(verbose_))
{
// compact file name; if it's not been specified, try to find the default one
Expand All @@ -37,7 +37,7 @@ rich::IrtGeo::IrtGeo(std::string detName_, std::string compactFile_, bool verbos
}

// set IRT and DD4hep geometry handles
void rich::IrtGeo::Bind() {
void richgeo::IrtGeo::Bind() {
// DD4hep geometry handles
m_detRich = m_det->detector(m_detName);
m_posRich = m_detRich.placement().position();
Expand All @@ -46,7 +46,7 @@ void rich::IrtGeo::Bind() {
m_irtDetector = m_irtDetectorCollection->AddNewDetector(m_detName.c_str());
}

rich::IrtGeo::~IrtGeo() {
richgeo::IrtGeo::~IrtGeo() {
if(m_irtDetector) delete m_irtDetector;
if(m_irtDetectorCollection) delete m_irtDetectorCollection;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
// local
#include "RichGeo.h"

namespace rich {
namespace richgeo {
class IrtGeo {
public:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "IrtGeoDRICH.h"

void rich::IrtGeoDRICH::DD4hep_to_IRT() {
void richgeo::IrtGeoDRICH::DD4hep_to_IRT() {

// begin envelope
/* FIXME: have no connection to GEANT G4LogicalVolume pointers; however all is needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "IrtGeo.h"

namespace rich {
namespace richgeo {
class IrtGeoDRICH : public IrtGeo {

public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "IrtGeoPFRICH.h"

void rich::IrtGeoPFRICH::DD4hep_to_IRT() {
void richgeo::IrtGeoPFRICH::DD4hep_to_IRT() {

// begin envelope
/* FIXME: have no connection to GEANT G4LogicalVolume pointers; however all is needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "IrtGeo.h"

namespace rich {
namespace richgeo {
class IrtGeoPFRICH : public IrtGeo {

public:
Expand Down
13 changes: 13 additions & 0 deletions src/services/geometry/richgeo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
RICH Geometry Service
=====================

A common place for bindings between RICH geometry forms:
- `DD4hep`: simulation geometry
- `ACTS`: track-projection planes
- `IRT`: optical surfaces for Indirect Ray Tracing

`RichGeo_service` provides a JANA service for these bindings, with `richgeo.cc`
to define the plugin. All other source files are meant to be JANA-independent,
and can either be built with this `richgeo` plugin or as a standalone library
for external usage (using your own build configuration). The standalone
capability is currently used for legacy Juggler support.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <string>
#include <fmt/format.h>

namespace rich {
namespace richgeo {

// local logging singleton
/* NOTE: EICrecon uses `spdlog` with a logging service; since `RichGeo` is meant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ void RichGeo_service::acquire_services(JServiceLocator *srv_locator) {

// logging service
auto log_service = srv_locator->get<Log_service>();
m_log = log_service->logger("rich");
m_log = log_service->logger("richgeo");
std::string log_level_str = "info";
m_app->SetDefaultParameter("rich:LogLevel", log_level_str, "Log level for RichGeo_service");
m_app->SetDefaultParameter("richgeo:LogLevel", log_level_str, "Log level for RichGeo_service");
m_log->set_level(eicrecon::ParseLogLevel(log_level_str));
m_log->debug("RichGeo log level is set to {} ({})", log_level_str, m_log->level());

Expand All @@ -25,7 +25,7 @@ void RichGeo_service::acquire_services(JServiceLocator *srv_locator) {
}

// IrtGeo -----------------------------------------------------------
rich::IrtGeo *RichGeo_service::GetIrtGeo(std::string detector_name) {
richgeo::IrtGeo *RichGeo_service::GetIrtGeo(std::string detector_name) {

// initialize, if not yet initialized
try {
Expand All @@ -35,8 +35,8 @@ rich::IrtGeo *RichGeo_service::GetIrtGeo(std::string detector_name) {
// instantiate IrtGeo-derived object, depending on detector
auto which_rich = detector_name;
std::transform(which_rich.begin(), which_rich.end(), which_rich.begin(), ::toupper);
if ( which_rich=="DRICH" ) m_irtGeo = new rich::IrtGeoDRICH(m_dd4hepGeo, m_verbose);
else if( which_rich=="PFRICH" ) m_irtGeo = new rich::IrtGeoPFRICH(m_dd4hepGeo, m_verbose);
if ( which_rich=="DRICH" ) m_irtGeo = new richgeo::IrtGeoDRICH(m_dd4hepGeo, m_verbose);
else if( which_rich=="PFRICH" ) m_irtGeo = new richgeo::IrtGeoPFRICH(m_dd4hepGeo, m_verbose);
else throw JException(fmt::format("IrtGeo is not defined for detector '{}'",detector_name));
};
std::call_once(m_init_irt, initialize);
Expand All @@ -49,13 +49,13 @@ rich::IrtGeo *RichGeo_service::GetIrtGeo(std::string detector_name) {
}

// ActsGeo -----------------------------------------------------------
rich::ActsGeo *RichGeo_service::GetActsGeo(std::string detector_name) {
richgeo::ActsGeo *RichGeo_service::GetActsGeo(std::string detector_name) {
// initialize, if not yet initialized
try {
m_log->debug("Call RichGeo_service::GetActsGeo initializer");
auto initialize = [this,&detector_name] () {
if(!m_dd4hepGeo) throw JException("RichGeo_service m_dd4hepGeo==null which should never be!");
m_actsGeo = new rich::ActsGeo(detector_name, m_dd4hepGeo, m_verbose);
m_actsGeo = new richgeo::ActsGeo(detector_name, m_dd4hepGeo, m_verbose);
};
std::call_once(m_init_acts, initialize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
#include <extensions/spdlog/SpdlogExtensions.h>

// richgeo
#include "richgeo/RichGeo.h"
#include "richgeo/IrtGeo.h"
#include "richgeo/IrtGeoDRICH.h"
#include "richgeo/IrtGeoPFRICH.h"
#include "richgeo/ActsGeo.h"
#include "RichGeo.h"
#include "IrtGeo.h"
#include "IrtGeoDRICH.h"
#include "IrtGeoPFRICH.h"
#include "ActsGeo.h"

class RichGeo_service : public JService {
public:
RichGeo_service(JApplication *app) : m_app(app) {}
~RichGeo_service();

// return pointers to geometry bindings; initializes the bindings upon the first time called
rich::IrtGeo *GetIrtGeo(std::string detector_name);
rich::ActsGeo *GetActsGeo(std::string detector_name);
richgeo::IrtGeo *GetIrtGeo(std::string detector_name);
richgeo::ActsGeo *GetActsGeo(std::string detector_name);

private:
RichGeo_service() = default;
Expand All @@ -42,8 +42,8 @@ class RichGeo_service : public JService {
std::once_flag m_init_acts;
JApplication *m_app = nullptr;
dd4hep::Detector *m_dd4hepGeo = nullptr;
rich::IrtGeo *m_irtGeo = nullptr;
rich::ActsGeo *m_actsGeo = nullptr;
richgeo::IrtGeo *m_irtGeo = nullptr;
richgeo::ActsGeo *m_actsGeo = nullptr;

std::shared_ptr<spdlog::logger> m_log;
bool m_verbose;
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/utilities/eicrecon/eicrecon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ std::vector<std::string> EICRECON_DEFAULT_PLUGINS = {
"dd4hep",
"acts",
"richgeo",
"rich",
"rootfile",
"algorithms_calorimetry",
"algorithms_tracking",
Expand Down

0 comments on commit 5b1692c

Please sign in to comment.