Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-13 10:09:39

0001 // Created by Dmitry Romanov
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 #pragma once
0006 
0007 #include <JANA/JEvent.h>
0008 #include <edm4eic/TrackParametersCollection.h>
0009 #include <memory>
0010 #include <string>
0011 #include <utility>
0012 #include <vector>
0013 
0014 #include "services/geometry/acts/ACTSGeo_service.h"
0015 #include "algorithms/tracking/TrackParamTruthInit.h"
0016 #include "algorithms/tracking/TrackParamTruthInitConfig.h"
0017 #include "extensions/jana/JOmniFactory.h"
0018 #include "services/algorithms_init/AlgorithmsInit_service.h"
0019 
0020 namespace eicrecon {
0021 
0022 class TrackParamTruthInit_factory
0023     : public JOmniFactory<TrackParamTruthInit_factory, TrackParamTruthInitConfig> {
0024 
0025 private:
0026   using AlgoT = eicrecon::TrackParamTruthInit;
0027   std::unique_ptr<AlgoT> m_algo;
0028 
0029   PodioInput<edm4hep::EventHeader> m_headers_input{this};
0030   PodioInput<edm4hep::MCParticle> m_particles_input{this};
0031   PodioOutput<edm4eic::TrackParameters> m_parameters_output{this};
0032 
0033   ParameterRef<double> m_maxVertexX{this, "MaxVertexX", config().maxVertexX,
0034                                     "Maximum abs(vertex x) for truth tracks turned into seed"};
0035   ParameterRef<double> m_maxVertexY{this, "MaxVertexY", config().maxVertexY,
0036                                     "Maximum abs(vertex y) for truth tracks turned into seed"};
0037   ParameterRef<double> m_maxVertexZ{this, "MaxVertexZ", config().maxVertexZ,
0038                                     "Maximum abs(vertex z) for truth tracks turned into seed"};
0039   ParameterRef<double> m_minMomentum{this, "MinMomentum", config().minMomentum,
0040                                      "Minimum momentum for truth tracks turned into seed"};
0041   ParameterRef<double> m_maxEtaForward{
0042       this, "MaxEtaForward", config().maxEtaForward,
0043       "Maximum forward abs(eta) for truth tracks turned into seed"};
0044   ParameterRef<double> m_maxEtaBackward{
0045       this, "MaxEtaBackward", config().maxEtaBackward,
0046       "Maximum backward abs(eta) for truth tracks turned into seed"};
0047   ParameterRef<double> m_momentumSmear{
0048       this, "MomentumSmear", config().momentumSmear,
0049       "Momentum magnitude fraction to use as width of gaussian smearing"};
0050 
0051   Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0052   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0053 
0054 public:
0055   void Configure() {
0056     m_algo = std::make_unique<AlgoT>(GetPrefix());
0057     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0058     m_algo->applyConfig(config());
0059     m_algo->init();
0060   }
0061 
0062   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0063     m_algo->process({m_headers_input(), m_particles_input()}, {m_parameters_output().get()});
0064   }
0065 };
0066 
0067 } // namespace eicrecon