-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First working algorithm implementation, ready to finish Juggler end
- Loading branch information
Showing
6 changed files
with
335 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,4 @@ find_package(fmt REQUIRED) | |
include(GNUInstallDirs) | ||
|
||
add_subdirectory(core) | ||
add_subdirectory(calorimetry) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# SPDX-License-Identifier: LGPL-3.0-or-later | ||
# Copyright (C) 2022 Sylvester Joosten | ||
|
||
################################################################################ | ||
# Package: algorithms core utilities | ||
################################################################################ | ||
|
||
set(SUBDIR "calorimetry") | ||
set(LIBRARY "algo${SUBDIR}") | ||
set(TARGETS ${TARGETS} ${LIBRARY} PARENT_SCOPE) | ||
|
||
file(GLOB SRC CONFIGURE_DEPENDS src/*.cpp) | ||
|
||
add_library(${LIBRARY} SHARED ${SRC}) | ||
target_link_libraries(${LIBRARY} | ||
PUBLIC | ||
EDM4HEP::edm4hep | ||
EDM4EIC::edm4eic | ||
DD4hep::DDRec | ||
algocore | ||
fmt::fmt) | ||
target_include_directories(${LIBRARY} | ||
PUBLIC | ||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${SUBDIR}/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
set_target_properties(${LIBRARY} PROPERTIES | ||
VERSION ${PROJECT_VERSION} | ||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) | ||
|
||
install(TARGETS ${LIBRARY} | ||
EXPORT algorithmsTargets | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib | ||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
NAMESPACE algorithms::) | ||
|
||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/${SUBDIR}/include/algorithms | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT dev) | ||
|
||
# TODO: Testing | ||
#if(BUILD_TESTING) | ||
# enable_testing() | ||
#endif() | ||
|
68 changes: 68 additions & 0 deletions
68
external/algorithms/calorimetry/include/algorithms/calorimetry/ClusterRecoCoG.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// Copyright (C) 2022 Sylvester Joosten, Chao, Chao Peng, Whitney Armstrong | ||
|
||
/* | ||
* Reconstruct the cluster with Center of Gravity method | ||
* Logarithmic weighting is used for mimicing energy deposit in transverse direction | ||
* | ||
* Author: Sylvester Joosten (ANL), Chao Peng (ANL) 09/19/2022 | ||
*/ | ||
|
||
#include <algorithms/algorithm.h> | ||
#include <algorithms/geo.h> | ||
#include <algorithms/property.h> | ||
|
||
// Data types | ||
#include <edm4eic/ClusterCollection.h> | ||
#include <edm4eic/MCRecoClusterParticleAssociationCollection.h> | ||
#include <edm4eic/ProtoClusterCollection.h> | ||
#include <edm4hep/SimCalorimeterHitCollection.h> | ||
|
||
namespace algorithms::calorimetry { | ||
|
||
using ClusterRecoCoGBase = Algorithm< | ||
Input<edm4eic::ProtoClusterCollection, std::optional<edm4hep::SimCalorimeterHitCollection>>, | ||
Output<edm4eic::ClusterCollection, | ||
std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>>; | ||
|
||
/** Clustering with center of gravity method. | ||
* | ||
* Reconstruct the cluster with Center of Gravity method | ||
* Logarithmic weighting is used for mimicking energy deposit in transverse direction | ||
* | ||
* \ingroup reco | ||
*/ | ||
class ClusterRecoCoG : public ClusterRecoCoGBase { | ||
public: | ||
using Input = ClusterRecoCoGBase::Input; | ||
using Output = ClusterRecoCoGBase::Output; | ||
using WeightFunc = std::function<double(double, double, double)>; | ||
|
||
// TODO: get rid of "Collection" in names | ||
ClusterRecoCoG(std::string_view name) | ||
: ClusterRecoCoGBase{name, | ||
{"inputProtoClusterCollection", "mcHits"}, | ||
{"outputClusterCollection", "outputAssociations"}} {} | ||
|
||
void init(); | ||
void process(const Input&, const Output&); | ||
|
||
private: | ||
edm4eic::MutableCluster reconstruct(const edm4eic::ProtoCluster&) const; | ||
|
||
// FIXME do we really want sampling fraction here? | ||
Property<double> m_sampFrac{this, "samplingFraction", 1.0}; | ||
Property<double> m_logWeightBase{this, "logWeightBase", 3.6}; | ||
Property<std::string> m_energyWeight{this, "energyWeight", "log"}; | ||
Property<std::string> m_moduleDimZName{this, "moduleDimZName", ""}; | ||
// Constrain the cluster position eta to be within | ||
// the eta of the contributing hits. This is useful to avoid edge effects | ||
// for endcaps. | ||
Property<bool> m_enableEtaBounds{this, "enableEtaBounds", true}; | ||
|
||
WeightFunc m_weightFunc; | ||
|
||
const GeoSvc& m_geo = GeoSvc::instance(); | ||
}; | ||
} // namespace algorithms::calorimetry | ||
|
Oops, something went wrong.