EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
CalorimeterClusterShape.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2025 Chao Peng, Dhevan Gangadharan, Sebouh Paul, Derek Anderson
3
4#pragma once
5
6#include <algorithms/algorithm.h>
7#include <edm4eic/ClusterCollection.h>
8#include <edm4eic/EDM4eicVersion.h>
9#include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
10#include <algorithm>
11#include <cmath>
12#include <functional>
13#include <map>
14#include <optional>
15#include <string>
16#include <string_view>
17#include <utility>
18
21
22#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
23#include <edm4eic/MCRecoClusterParticleLinkCollection.h>
24#endif
25
26namespace eicrecon {
27
28// --------------------------------------------------------------------------
30// --------------------------------------------------------------------------
31using CalorimeterClusterShapeAlgorithm = algorithms::Algorithm<
32 algorithms::Input<edm4eic::ClusterCollection,
33 std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>,
34 algorithms::Output<edm4eic::ClusterCollection,
35#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
36 std::optional<edm4eic::MCRecoClusterParticleLinkCollection>,
37#endif
38 std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>>;
39
40// --------------------------------------------------------------------------
42// --------------------------------------------------------------------------
48 public WithPodConfig<CalorimeterClusterShapeConfig> {
49
50public:
51 // ctor
52 CalorimeterClusterShape(std::string_view name)
54 {"inputClusters", "inputMCClusterAssociations"},
55 {"outputClusters",
56#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 7, 0)
57 "outputMCClusterLinks",
58#endif
59 "outputMCClusterAssociations"},
60 "Computes cluster shape parameters"} {
61 }
62
63 // public methods
64 void init() final;
65 void process(const Input&, const Output&) const final;
66
67private:
69 static double constWeight(double /*E*/, double /*tE*/, double /*p*/, int /*type*/) { return 1.0; }
70
72 static double linearWeight(double E, double /*tE*/, double /*p*/, int /*type*/) { return E; }
73
75 static double logWeight(double E, double tE, double base, int /*type*/) {
76 return std::max(0., base + std::log(E / tE));
77 }
78
80 const std::map<std::string, std::function<double(double, double, double, int)>> m_weightMethods =
81 {{"none", constWeight}, {"linear", linearWeight}, {"log", logWeight}};
82
84 std::function<double(double, double, double, int)> m_weightFunc;
85};
86
87} // namespace eicrecon
Calculate cluster shapes for provided clusters.
Definition CalorimeterClusterShape.h:48
CalorimeterClusterShape(std::string_view name)
Definition CalorimeterClusterShape.h:52
Definition WithPodConfig.h:22
E
Definition TwoElectronsTopCAL.py:10
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< algorithms::Input< edm4eic::ClusterCollection, std::optional< edm4eic::MCRecoClusterParticleAssociationCollection > >, algorithms::Output< edm4eic::ClusterCollection, std::optional< edm4eic::MCRecoClusterParticleLinkCollection >, std::optional< edm4eic::MCRecoClusterParticleAssociationCollection > > > CalorimeterClusterShapeAlgorithm
Algorithm input/output.
Definition CalorimeterClusterShape.h:38