Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:05

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 : public JOmniFactory<TrackClusterMergeSplitter_factory, TrackClusterMergeSplitterConfig> {
0019 
0020     public:
0021 
0022       using AlgoT = eicrecon::TrackClusterMergeSplitter;
0023 
0024     private:
0025 
0026       // algorithm to run
0027       std::unique_ptr<AlgoT> m_algo;
0028 
0029       // input collections
0030       PodioInput<edm4eic::ProtoCluster> m_protoclusters_input {this};
0031       PodioInput<edm4eic::TrackSegment> m_track_projections_input {this};
0032 
0033       // output collections
0034       PodioOutput<edm4eic::ProtoCluster> m_protoclusters_output {this};
0035 
0036       // parameter bindings
0037       ParameterRef<std::string> m_idCalo {this, "idCalo", config().idCalo};
0038       ParameterRef<double> m_minSigCut {this, "minSigCut", config().minSigCut};
0039       ParameterRef<double> m_avgEP {this, "avgEP", config().avgEP};
0040       ParameterRef<double> m_sigEP {this, "sigEP", config().sigEP};
0041       ParameterRef<double> m_drAdd {this, "drAdd", config().drAdd};
0042       ParameterRef<double> m_sampFrac {this, "sampFrac", config().sampFrac};
0043       ParameterRef<double> m_transverseEnergyProfileScale {this, "transverseEnergyProfileScale", config().transverseEnergyProfileScale};
0044 
0045       // services
0046       Service<DD4hep_service> m_geoSvc {this};
0047       Service<AlgorithmsInit_service> m_algoInitSvc {this};
0048 
0049     public:
0050 
0051       void Configure() {
0052         m_algo = std::make_unique<AlgoT>(GetPrefix());
0053         m_algo->applyConfig( config() );
0054         m_algo->init(m_geoSvc().detector());
0055       }
0056 
0057       void ChangeRun(int64_t run_number) {
0058         /* nothing to do here */
0059       }
0060 
0061       void Process(int64_t run_number, uint64_t event_number) {
0062         m_algo->process(
0063           {m_protoclusters_input(), m_track_projections_input()},
0064           {m_protoclusters_output().get()}
0065         );
0066       }
0067 
0068   };  // end TrackClusterMergeSplitter_factory
0069 
0070 }  // end eicrecon namespace