Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 07:55:46

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{this, "localDistXY", config().localDistXY};
0025   ParameterRef<std::vector<double>> m_ldep{this, "layerDistEtaPhi", config().layerDistEtaPhi};
0026   // ParameterRef<std::vector<double>> m_ldxy_adjacent{this, "layerDistXY", config().layerDistXY};
0027   ParameterRef<eicrecon::ImagingTopoClusterConfig::ELayerMode> m_laymode{this, "layerMode",
0028                                                                          config().layerMode};
0029   ParameterRef<int> m_nlr{this, "neighbourLayersRange", config().neighbourLayersRange};
0030   ParameterRef<double> m_sd{this, "sectorDist", config().sectorDist};
0031   ParameterRef<double> m_mched{this, "minClusterHitEdep", config().minClusterHitEdep};
0032   ParameterRef<double> m_mcced{this, "minClusterCenterEdep", config().minClusterCenterEdep};
0033   ParameterRef<double> m_mced{this, "minClusterEdep", config().minClusterEdep};
0034   ParameterRef<std::size_t> m_mcnh{this, "minClusterNhits", config().minClusterNhits};
0035 
0036   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0037 
0038 public:
0039   void Configure() {
0040     m_algo = std::make_unique<AlgoT>(GetPrefix());
0041     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0042     m_algo->applyConfig(config());
0043     m_algo->init();
0044   }
0045 
0046   void ChangeRun(int32_t /* run_number */) {}
0047 
0048   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0049     m_algo->process({m_hits_input()}, {m_protos_output().get()});
0050   }
0051 };
0052 
0053 } // namespace eicrecon