Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:55:48

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