Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-08 07:53:31

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::MCParticle> m_particles_input{this};
0030   PodioOutput<edm4eic::TrackParameters> m_parameters_output{this};
0031 
0032   ParameterRef<double> m_maxVertexX{this, "MaxVertexX", config().maxVertexX,
0033                                     "Maximum abs(vertex x) for truth tracks turned into seed"};
0034   ParameterRef<double> m_maxVertexY{this, "MaxVertexY", config().maxVertexY,
0035                                     "Maximum abs(vertex y) for truth tracks turned into seed"};
0036   ParameterRef<double> m_maxVertexZ{this, "MaxVertexZ", config().maxVertexZ,
0037                                     "Maximum abs(vertex z) for truth tracks turned into seed"};
0038   ParameterRef<double> m_minMomentum{this, "MinMomentum", config().minMomentum,
0039                                      "Minimum momentum for truth tracks turned into seed"};
0040   ParameterRef<double> m_maxEtaForward{
0041       this, "MaxEtaForward", config().maxEtaForward,
0042       "Maximum forward abs(eta) for truth tracks turned into seed"};
0043   ParameterRef<double> m_maxEtaBackward{
0044       this, "MaxEtaBackward", config().maxEtaBackward,
0045       "Maximum backward abs(eta) for truth tracks turned into seed"};
0046   ParameterRef<double> m_momentumSmear{
0047       this, "MomentumSmear", config().momentumSmear,
0048       "Momentum magnitude fraction to use as width of gaussian smearing"};
0049 
0050   Service<ACTSGeo_service> m_ACTSGeoSvc{this};
0051   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0052 
0053 public:
0054   void Configure() {
0055     m_algo = std::make_unique<AlgoT>();
0056     m_algo->applyConfig(config());
0057     m_algo->init(m_ACTSGeoSvc().actsGeoProvider(), logger());
0058   }
0059 
0060   void ChangeRun(int32_t /* run_number */) {}
0061 
0062   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0063     m_parameters_output() = m_algo->produce(m_particles_input());
0064   }
0065 };
0066 
0067 } // namespace eicrecon