Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 08:34:01

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2025 Derek Anderson
0003 
0004 #pragma once
0005 
0006 #include "algorithms/calorimetry/CalorimeterClusterShape.h"
0007 #include "extensions/jana/JOmniFactory.h"
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 
0010 namespace eicrecon {
0011 
0012 class CalorimeterClusterShape_factory
0013     : public JOmniFactory<CalorimeterClusterShape_factory, CalorimeterClusterShapeConfig> {
0014 
0015 public:
0016   using AlgoT = eicrecon::CalorimeterClusterShape;
0017 
0018 private:
0019   // algorithm to run
0020   std::unique_ptr<AlgoT> m_algo;
0021 
0022   // input collections
0023   PodioInput<edm4eic::Cluster> m_clusters_input{this};
0024   PodioInput<edm4eic::MCRecoClusterParticleAssociation> m_assocs_input{this};
0025 
0026   // output collections
0027   PodioOutput<edm4eic::Cluster> m_clusters_output{this};
0028   PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assocs_output{this};
0029 
0030   // parameter bindings
0031   ParameterRef<bool> m_longitudinalShowerInfoAvailable{this, "longitudinalShowerInfoAvailable",
0032                                                        config().longitudinalShowerInfoAvailable};
0033   ParameterRef<std::string> m_energyWeight{this, "energyWeight", config().energyWeight};
0034   ParameterRef<double> m_sampFrac{this, "sampFrac", config().sampFrac};
0035   ParameterRef<std::vector<double>> m_logWeightBaseCoeffs{this, "logWeightBaseCoeffs",
0036                                                           config().logWeightBaseCoeffs};
0037   ParameterRef<double> m_logWeightBase_Eref{this, "logWeightBase_Eref",
0038                                             config().logWeightBase_Eref};
0039   ParameterRef<double> m_logWeightBase{this, "logWeightBase", config().logWeightBase};
0040 
0041   // services
0042   Service<AlgorithmsInit_service> m_algoInitSvc{this};
0043 
0044 public:
0045   void Configure() {
0046     m_algo = std::make_unique<AlgoT>(GetPrefix());
0047     m_algo->applyConfig(config());
0048     m_algo->init();
0049   }
0050 
0051   void ChangeRun(int32_t /* run_number */) {
0052     //... nothing to do ...//
0053   }
0054 
0055   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0056     m_algo->process({m_clusters_input(), m_assocs_input()},
0057                     {m_clusters_output().get(), m_assocs_output().get()});
0058   }
0059 
0060 }; // end CalorimeterClusterShape_factory
0061 
0062 } // namespace eicrecon