Back to home page

EIC code displayed by LXR

 
 

    


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

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