Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:07:29

0001 // Created by Alex Jentsch
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 #pragma once
0006 
0007 #include <DDRec/CellIDPositionConverter.h>
0008 #include "services/algorithms_init/AlgorithmsInit_service.h"
0009 #include "algorithms/fardetectors/MatrixTransferStatic.h"
0010 #include "algorithms/fardetectors/MatrixTransferStaticConfig.h"
0011 
0012 // Event Model related classes
0013 #include <edm4eic/ReconstructedParticleCollection.h>
0014 #include <edm4eic/TrackerHitCollection.h>
0015 #include <edm4hep/SimTrackerHitCollection.h>
0016 #include <edm4hep/MCParticleCollection.h>
0017 
0018 #include "extensions/jana/JOmniFactory.h"
0019 
0020 namespace eicrecon {
0021 
0022 class MatrixTransferStatic_factory
0023     : public JOmniFactory<MatrixTransferStatic_factory, MatrixTransferStaticConfig> {
0024 
0025 public:
0026   using AlgoT = eicrecon::MatrixTransferStatic;
0027 
0028 private:
0029   std::unique_ptr<AlgoT> m_algo;
0030 
0031   PodioInput<edm4hep::MCParticle> m_mcparts_input{this};
0032   PodioInput<edm4eic::TrackerHit> m_hits_input{this};
0033   PodioOutput<edm4eic::ReconstructedParticle> m_tracks_output{this};
0034 
0035   Service<DD4hep_service> m_geoSvc{this};
0036 
0037   ParameterRef<float> partMass{this, "partMass", config().partMass};
0038   ParameterRef<float> partCharge{this, "partCharge", config().partCharge};
0039   ParameterRef<long long> partPDG{this, "partPDG", config().partPDG};
0040 
0041   ParameterRef<double> crossingAngle{this, "crossingAngle", config().crossingAngle};
0042 
0043   // FIXME JANA2 does not support vector of vector
0044   //ParameterRef<std::vector<std::vector<double>>> aX {this, "aX", config().aX};
0045   //ParameterRef<std::vector<std::vector<double>>> aY {this, "aY", config().aY};
0046 
0047   ParameterRef<double> hit1minZ{this, "hit1minZ", config().hit1minZ};
0048   ParameterRef<double> hit1maxZ{this, "hit1maxZ", config().hit1maxZ};
0049   ParameterRef<double> hit2minZ{this, "hit2minZ", config().hit2minZ};
0050   ParameterRef<double> hit2maxZ{this, "hit2maxZ", config().hit2maxZ};
0051 
0052   ParameterRef<std::string> readout{this, "readout", config().readout};
0053 
0054   ParameterRef<bool> requireBeamProton{this, "requireBeamProton", config().requireBeamProton};
0055   ParameterRef<bool> requireMatchingMatrix{this, "requireMatchingMatrix",
0056                                            config().requireMatchingMatrix};
0057 
0058   Service<AlgorithmsInit_service> m_algorithmsInit{this};
0059 
0060 public:
0061   void Configure() {
0062     m_algo = std::make_unique<AlgoT>(GetPrefix());
0063     m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0064     m_algo->applyConfig(config());
0065     m_algo->init();
0066   }
0067 
0068   void Process(int32_t /* run_number */, uint64_t /* event_number */) {
0069     m_algo->process({m_mcparts_input(), m_hits_input()}, {m_tracks_output().get()});
0070   }
0071 };
0072 
0073 } // namespace eicrecon