Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2023, Wouter Deconinck
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 #pragma once
0006 
0007 #include <edm4eic/EDM4eicVersion.h>
0008 
0009 #include "algorithms/calorimetry/CalorimeterClusterRecoCoG.h"
0010 #include "services/algorithms_init/AlgorithmsInit_service.h"
0011 #include "extensions/jana/JOmniFactory.h"
0012 
0013 namespace eicrecon {
0014 
0015 class CalorimeterClusterRecoCoG_factory : public JOmniFactory<CalorimeterClusterRecoCoG_factory, CalorimeterClusterRecoCoGConfig> {
0016 
0017 public:
0018     using AlgoT = eicrecon::CalorimeterClusterRecoCoG;
0019 private:
0020     std::unique_ptr<AlgoT> m_algo;
0021 
0022     PodioInput<edm4eic::ProtoCluster> m_proto_input {this};
0023 #if EDM4EIC_VERSION_MAJOR >= 7
0024     PodioInput<edm4eic::MCRecoCalorimeterHitAssociation> m_mchitassocs_input {this};
0025 #else
0026     PodioInput<edm4hep::SimCalorimeterHit> m_mchits_input {this};
0027 #endif
0028 
0029 
0030     PodioOutput<edm4eic::Cluster> m_cluster_output {this};
0031     PodioOutput<edm4eic::MCRecoClusterParticleAssociation> m_assoc_output {this};
0032 
0033     ParameterRef<std::string> m_energyWeight {this, "energyWeight", config().energyWeight};
0034     ParameterRef<double> m_samplingFraction {this, "samplingFraction", config().sampFrac};
0035     ParameterRef<double> m_logWeightBase {this, "logWeightBase", config().logWeightBase};
0036     ParameterRef<std::vector<double>> m_logWeightBaseCoeffs {this, "logWeightBaseCoeffs", config().logWeightBaseCoeffs};
0037     ParameterRef<double> m_logWeightBase_Eref {this, "logWeightBase_Eref", config().logWeightBase_Eref};
0038     ParameterRef<bool> m_longitudinalShowerInfoAvailable {this, "longitudinalShowerInfoAvailable", config().longitudinalShowerInfoAvailable};
0039     ParameterRef<bool> m_enableEtaBounds {this, "enableEtaBounds", config().enableEtaBounds};
0040 
0041     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0042 
0043 public:
0044     void Configure() {
0045         m_algo = std::make_unique<AlgoT>(GetPrefix());
0046         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0047         m_algo->applyConfig(config());
0048         m_algo->init();
0049     }
0050 
0051     void ChangeRun(int64_t run_number) {
0052     }
0053 
0054     void Process(int64_t run_number, uint64_t event_number) {
0055 #if EDM4EIC_VERSION_MAJOR >= 7
0056         m_algo->process({m_proto_input(), m_mchitassocs_input()},
0057 #else
0058         m_algo->process({m_proto_input(), m_mchits_input()},
0059 #endif
0060                         {m_cluster_output().get(), m_assoc_output().get()});
0061     }
0062 };
0063 
0064 } // eicrecon