File indexing completed on 2025-09-12 08:54:08
0001
0002
0003
0004 #pragma once
0005
0006 #include <algorithms/algorithm.h>
0007 #include <edm4eic/ClusterCollection.h>
0008 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0009 #include <algorithm>
0010 #include <cmath>
0011 #include <functional>
0012 #include <map>
0013 #include <optional>
0014 #include <string>
0015 #include <string_view>
0016 #include <utility>
0017
0018 #include "CalorimeterClusterShapeConfig.h"
0019 #include "algorithms/interfaces/WithPodConfig.h"
0020
0021 namespace eicrecon {
0022
0023
0024
0025
0026 using CalorimeterClusterShapeAlgorithm = algorithms::Algorithm<
0027 algorithms::Input<edm4eic::ClusterCollection,
0028 std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>,
0029 algorithms::Output<edm4eic::ClusterCollection,
0030 std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>>;
0031
0032
0033
0034
0035
0036
0037
0038
0039 class CalorimeterClusterShape : public CalorimeterClusterShapeAlgorithm,
0040 public WithPodConfig<CalorimeterClusterShapeConfig> {
0041
0042 public:
0043
0044 CalorimeterClusterShape(std::string_view name)
0045 : CalorimeterClusterShapeAlgorithm{name,
0046 {"inputClusters", "inputMCClusterAssociations"},
0047 {"outputClusters", "outputMCClusterAssociations"},
0048 "Computes cluster shape parameters"} {}
0049
0050
0051 void init() final;
0052 void process(const Input&, const Output&) const final;
0053
0054 private:
0055
0056 static double constWeight(double , double , double , int ) { return 1.0; }
0057
0058
0059 static double linearWeight(double E, double , double , int ) { return E; }
0060
0061
0062 static double logWeight(double E, double tE, double base, int ) {
0063 return std::max(0., base + std::log(E / tE));
0064 }
0065
0066
0067 const std::map<std::string, std::function<double(double, double, double, int)>> m_weightMethods =
0068 {{"none", constWeight}, {"linear", linearWeight}, {"log", logWeight}};
0069
0070
0071 std::function<double(double, double, double, int)> m_weightFunc;
0072 };
0073
0074 }