Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:13:07

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Derek Anderson
0003 
0004 #pragma once
0005 
0006 // c++ utilities
0007 #include <string>
0008 // dd4hep utilities
0009 #include <DD4hep/Detector.h>
0010 // eicrecon components
0011 #include "extensions/jana/JOmniFactory.h"
0012 #include "services/geometry/dd4hep/DD4hep_service.h"
0013 #include "services/algorithms_init/AlgorithmsInit_service.h"
0014 #include "algorithms/calorimetry/TrackClusterMergeSplitter.h"
0015 
0016 namespace eicrecon {
0017 
0018 class TrackClusterMergeSplitter_factory
0019     : public JOmniFactory<TrackClusterMergeSplitter_factory, TrackClusterMergeSplitterConfig> {
0020 
0021 public:
0022   using AlgoT = eicrecon::TrackClusterMergeSplitter;
0023 
0024 private:
0025   // algorithm to run
0026   std::unique_ptr<AlgoT> m_algo;
0027 
0028   // input collections
0029   PodioInput<edm4eic::ProtoCluster> m_protoclusters_input{this};
0030   PodioInput<edm4eic::TrackSegment> m_track_projections_input{this};
0031 
0032   // output collections
0033   PodioOutput<edm4eic::ProtoCluster> m_protoclusters_output{this};
0034 
0035   // parameter bindings
0036   ParameterRef<std::string> m_idCalo{this, "idCalo", config().idCalo};
0037   ParameterRef<double> m_minSigCut{this, "minSigCut", config().minSigCut};
0038   ParameterRef<double> m_avgEP{this, "avgEP", config().avgEP};
0039   ParameterRef<double> m_sigEP{this, "sigEP", config().sigEP};
0040   ParameterRef<double> m_drAdd{this, "drAdd", config().drAdd};
0041   ParameterRef<double> m_sampFrac{this, "sampFrac", config().sampFrac};
0042   ParameterRef<double> m_transverseEnergyProfileScale{this, "transverseEnergyProfileScale",
0043                                                       config().transverseEnergyProfileScale};
0044 
0045   // services
0046   Service<DD4hep_service> m_geoSvc{this};
0047   Service<AlgorithmsInit_service> m_algoInitSvc{this};
0048 
0049 public:
0050   void Configure() {
0051     m_algo = std::make_unique<AlgoT>(GetPrefix());
0052     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0053     m_algo->applyConfig(config());
0054     m_algo->init();
0055   }
0056 
0057   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0058     m_algo->process({m_protoclusters_input(), m_track_projections_input()},
0059                     {m_protoclusters_output().get()});
0060   }
0061 
0062 }; // end TrackClusterMergeSplitter_factory
0063 
0064 } // namespace eicrecon