Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:56:05

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 Wouter Deconinck
0003 
0004 #pragma once
0005 
0006 #include "algorithms/calorimetry/ImagingTopoCluster.h"
0007 #include "extensions/jana/JOmniFactory.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 
0010 namespace eicrecon {
0011 
0012 class ImagingTopoCluster_factory
0013     : public JOmniFactory<ImagingTopoCluster_factory, ImagingTopoClusterConfig> {
0014 
0015 public:
0016   using AlgoT = eicrecon::ImagingTopoCluster;
0017 
0018 private:
0019   std::unique_ptr<AlgoT> m_algo;
0020 
0021   PodioInput<edm4eic::CalorimeterHit> m_hits_input{this};
0022   PodioOutput<edm4eic::ProtoCluster> m_protos_output{this};
0023 
0024   // ParameterRef<std::vector<double>> m_ldxy_same{this, "sameLayerDistXY",
0025   //                                                    config().sameLayerDistXY};
0026   // ParameterRef<std::vector<double>> m_ldxy_diff{this, "diffLayerDistXY",
0027   //                                                    config().diffLayerDistXY};
0028   ParameterRef<std::vector<double>> m_ldep_same{this, "sameLayerDistEtaPhi",
0029                                                 config().sameLayerDistEtaPhi};
0030   ParameterRef<std::vector<double>> m_ldep_diff{this, "diffLayerDistEtaPhi",
0031                                                 config().diffLayerDistEtaPhi};
0032   ParameterRef<std::vector<double>> m_ldtz_same{this, "sameLayerDistTZ", config().sameLayerDistTZ};
0033   ParameterRef<std::vector<double>> m_ldtz_diff{this, "diffLayerDistTZ", config().diffLayerDistTZ};
0034   ParameterRef<eicrecon::ImagingTopoClusterConfig::ELayerMode> m_sameLayerMode{
0035       this, "sameLayerMode", config().sameLayerMode};
0036   ParameterRef<eicrecon::ImagingTopoClusterConfig::ELayerMode> m_diffLayerMode{
0037       this, "diffLayerMode", config().diffLayerMode};
0038 
0039   ParameterRef<int> m_nlr{this, "neighbourLayersRange", config().neighbourLayersRange};
0040   ParameterRef<double> m_sd{this, "sectorDist", config().sectorDist};
0041   ParameterRef<double> m_mched{this, "minClusterHitEdep", config().minClusterHitEdep};
0042   ParameterRef<double> m_mcced{this, "minClusterCenterEdep", config().minClusterCenterEdep};
0043   ParameterRef<double> m_mced{this, "minClusterEdep", config().minClusterEdep};
0044   ParameterRef<std::size_t> m_mcnh{this, "minClusterNhits", config().minClusterNhits};
0045 
0046   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0047 
0048 public:
0049   void Configure() {
0050     m_algo = std::make_unique<AlgoT>(GetPrefix());
0051     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0052     m_algo->applyConfig(config());
0053     m_algo->init();
0054   }
0055 
0056   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0057     m_algo->process({m_hits_input()}, {m_protos_output().get()});
0058   }
0059 };
0060 
0061 } // namespace eicrecon