File indexing completed on 2025-02-22 09:55:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <algorithms/algorithm.h>
0012 #include <algorithms/geo.h>
0013
0014
0015 #include <edm4eic/ClusterCollection.h>
0016 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0017 #include <edm4eic/ProtoClusterCollection.h>
0018 #include <edm4hep/SimCalorimeterHitCollection.h>
0019
0020 namespace algorithms::calorimetry {
0021
0022 using ClusteringAlgorithm = Algorithm<
0023 Input<edm4eic::ProtoClusterCollection, std::optional<edm4hep::SimCalorimeterHitCollection>>,
0024 Output<edm4eic::ClusterCollection,
0025 std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>>;
0026
0027
0028
0029
0030
0031
0032
0033
0034 class ClusterRecoCoG : public ClusteringAlgorithm {
0035 public:
0036 using WeightFunc = std::function<double(double, double, double)>;
0037
0038
0039 ClusterRecoCoG(std::string_view name)
0040 : ClusteringAlgorithm{name,
0041 {"inputProtoClusterCollection", "mcHits"},
0042 {"outputClusterCollection", "outputAssociations"},
0043 "Reconstruct a cluster with the Center of Gravity method. For "
0044 "simulation results it optionally creates a Cluster <-> MCParticle "
0045 "association provided both optional arguments are provided."} {}
0046
0047 void init() final;
0048 void process(const Input&, const Output&) const final;
0049
0050 private:
0051 edm4eic::MutableCluster reconstruct(const edm4eic::ProtoCluster&) const;
0052
0053
0054 Property<double> m_sampFrac{this, "samplingFraction", 1.0, "Sampling fraction"};
0055 Property<double> m_logWeightBase{this, "logWeightBase", 3.6, "Weight base for log weighting"};
0056 Property<std::string> m_energyWeight{this, "energyWeight", "log", "Default hit weight method"};
0057 Property<std::string> m_moduleDimZName{this, "moduleDimZName", "", "z-dim name of the module"};
0058
0059
0060
0061 Property<bool> m_enableEtaBounds{this, "enableEtaBounds", true, "Constrain cluster to hit eta?"};
0062
0063 WeightFunc m_weightFunc;
0064
0065 const GeoSvc& m_geo = GeoSvc::instance();
0066 };
0067 }
0068