Back to home page

EIC code displayed by LXR

 
 

    


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

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 private:
0026     std::unique_ptr<AlgoT> m_algo;
0027 
0028     PodioInput<edm4hep::MCParticle> m_mcparts_input {this};
0029     PodioInput<edm4eic::TrackerHit> m_hits_input {this};
0030     PodioOutput<edm4eic::ReconstructedParticle> m_tracks_output {this};
0031 
0032     Service<DD4hep_service> m_geoSvc {this};
0033 
0034     ParameterRef<float>     partMass  {this, "partMass", config().partMass};
0035     ParameterRef<float>     partCharge{this, "partCharge", config().partCharge};
0036     ParameterRef<long long> partPDG   {this, "partPDG", config().partPDG};
0037 
0038     ParameterRef<double> local_x_offset      {this, "local_x_offset", config().local_x_offset};
0039     ParameterRef<double> local_y_offset      {this, "local_y_offset", config().local_y_offset};
0040     ParameterRef<double> local_x_slope_offset{this, "local_x_slope_offset", config().local_x_slope_offset};
0041     ParameterRef<double> local_y_slope_offset{this, "local_y_slope_offset", config().local_y_slope_offset};
0042     ParameterRef<double> crossingAngle       {this, "crossingAngle", config().crossingAngle};
0043     ParameterRef<double> nomMomentum         {this, "nomMomentum", config().nomMomentum};
0044 
0045     // FIXME JANA2 does not support vector of vector
0046     //ParameterRef<std::vector<std::vector<double>>> aX {this, "aX", config().aX};
0047     //ParameterRef<std::vector<std::vector<double>>> aY {this, "aY", config().aY};
0048 
0049     ParameterRef<double> hit1minZ {this, "hit1minZ", config().hit1minZ};
0050     ParameterRef<double> hit1maxZ {this, "hit1maxZ", config().hit1maxZ};
0051     ParameterRef<double> hit2minZ {this, "hit2minZ", config().hit2minZ};
0052     ParameterRef<double> hit2maxZ {this, "hit2maxZ", config().hit2maxZ};
0053 
0054     ParameterRef<std::string> readout {this, "readout", config().readout};
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(int64_t run_number) {
0067     }
0068 
0069     void Process(int64_t run_number, uint64_t event_number) {
0070         m_algo->process({m_mcparts_input(), m_hits_input()}, {m_tracks_output().get()});
0071     }
0072 
0073 };
0074 
0075 } // eicrecon