** Warning **

Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr_eic at /usr/local/share/lxr/lxr-2.3.7/lib/LXR/Common.pm line 1161, <GEN7248> line 1.

Last-Modified: Mon, 27 Jul 2025 09:03:12 GMT Content-Type: text/html; charset=utf-8 /master/EICrecon/src/factories/pid_lut/PhaseSpacePID_factory.h
Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-27 07:54:15

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2025, Simon Gardner
0003 
0004 #pragma once
0005 
0006 #include <edm4eic/MCRecoParticleAssociationCollection.h>
0007 #include <edm4eic/ReconstructedParticleCollection.h>
0008 #include <edm4hep/MCParticleCollection.h>
0009 #include <edm4hep/ParticleIDCollection.h>
0010 
0011 #include "algorithms/pid_lut/PhaseSpacePID.h"
0012 #include "extensions/jana/JOmniFactory.h"
0013 #include "services/algorithms_init/AlgorithmsInit_service.h"
0014 
0015 namespace eicrecon {
0016 
0017 class PhaseSpacePID_factory : public JOmniFactory<PhaseSpacePID_factory, PhaseSpacePIDConfig> {
0018 public:
0019   using AlgoT = eicrecon::PhaseSpacePID;
0020 
0021 private:
0022   std::unique_ptr<AlgoT> m_algo;
0023 
0024   PodioInput<edm4eic::ReconstructedParticle> m_recoparticles_input{this};
0025   PodioInput<edm4eic::MCRecoParticleAssociation> m_recoparticle_assocs_input{this};
0026   PodioOutput<edm4eic::ReconstructedParticle> m_recoparticles_output{this};
0027   PodioOutput<edm4eic::MCRecoParticleAssociation> m_recoparticle_assocs_output{this};
0028   PodioOutput<edm4hep::ParticleID> m_particleids_output{this};
0029 
0030   ParameterRef<std::string> m_system{this, "system", config().system, "For the ParticleID record"};
0031   ParameterRef<std::vector<float>> m_direction{
0032       this, "direction", config().direction,
0033       "Direction vector for the phase space (default is along z-axis)"};
0034   ParameterRef<double> m_opening_angle{this, "openingAngle", config().opening_angle,
0035                                        "Opening angle for the phase space in radians"};
0036   ParameterRef<int> m_pdg_value{
0037       this, "pdgValue", config().pdg_value,
0038       "PDG value for the particle type to identify (default is electron)"};
0039 
0040   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0041 
0042 public:
0043   void Configure() {
0044     m_algo = std::make_unique<AlgoT>(this->GetPrefix());
0045     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0046     m_algo->applyConfig(config());
0047     m_algo->init();
0048   }
0049 
0050   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0051     m_algo->process({m_recoparticles_input(), m_recoparticle_assocs_input()},
0052                     {m_recoparticles_output().get(), m_recoparticle_assocs_output().get(),
0053                      m_particleids_output().get()});
0054   }
0055 };
0056 
0057 } // namespace eicrecon