Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2023, Christopher Dilks
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #pragma once
0005 
0006 #include <IRT/CherenkovDetectorCollection.h>
0007 #include <JANA/JEvent.h>
0008 #include <edm4eic/CherenkovParticleIDCollection.h>
0009 #include <algorithm>
0010 #include <memory>
0011 #include <string>
0012 #include <utility>
0013 #include <vector>
0014 
0015 #include "algorithms/pid/IrtCherenkovParticleID.h"
0016 #include "algorithms/pid/IrtCherenkovParticleIDConfig.h"
0017 #include "extensions/jana/JOmniFactory.h"
0018 #include "services/algorithms_init/AlgorithmsInit_service.h"
0019 #include "services/geometry/richgeo/RichGeo_service.h"
0020 
0021 namespace eicrecon {
0022 
0023 class IrtCherenkovParticleID_factory :
0024         public JOmniFactory<IrtCherenkovParticleID_factory, IrtCherenkovParticleIDConfig> {
0025 
0026 private:
0027     using AlgoT = eicrecon::IrtCherenkovParticleID;
0028     std::unique_ptr<AlgoT> m_algo;
0029 
0030     PodioInput<edm4eic::TrackSegment> m_aerogel_tracks_input {this};
0031     PodioInput<edm4eic::TrackSegment> m_gas_tracks_input {this};
0032     PodioInput<edm4eic::TrackSegment> m_merged_tracks_input {this};
0033     PodioInput<edm4eic::RawTrackerHit> m_raw_hits_input {this};
0034     PodioInput<edm4eic::MCRecoTrackerHitAssociation> m_raw_hit_assoc_input {this};
0035     PodioOutput<edm4eic::CherenkovParticleID> m_aerogel_particleIDs_output {this};
0036     PodioOutput<edm4eic::CherenkovParticleID> m_gas_particleIDs_output {this};
0037 
0038     ParameterRef<unsigned int> m_numRIndexBins {this, "numRIndexBins", config().numRIndexBins, ""};
0039     ParameterRef<std::vector<int>> m_pdgList {this, "pdgList", config().pdgList, ""};
0040 
0041     ParameterRef<double> m_aerogel_referenceRIndex {this, "aerogel:referenceRIndex", config().radiators["Aerogel"].referenceRIndex, ""};
0042     ParameterRef<double> m_aerogel_attenuation {this, "aerogel:attenuation", config().radiators["Aerogel"].attenuation, ""};
0043     ParameterRef<std::string> m_aerogel_smearingMode {this, "aerogel:smearingMode", config().radiators["Aerogel"].smearingMode, ""};
0044     ParameterRef<double> m_aerogel_smearing {this, "aerogel:smearing", config().radiators["Aerogel"].smearing, ""};
0045 
0046     ParameterRef<double> m_gas_referenceRIndex {this, "gas:referenceRIndex", config().radiators["Gas"].referenceRIndex, ""};
0047     ParameterRef<double> m_gas_attenuation {this, "gas:attenuation", config().radiators["Gas"].attenuation, ""};
0048     ParameterRef<std::string> m_gas_smearingMode {this, "gas:smearingMode", config().radiators["Gas"].smearingMode, ""};
0049     ParameterRef<double> m_gas_smearing {this, "gas:smearing", config().radiators["Gas"].smearing, ""};
0050 
0051     ParameterRef<bool> m_cheatPhotonVertex {this, "cheatPhotonVertex", config().cheatPhotonVertex, ""};
0052     ParameterRef<bool> m_cheatTrueRadiator {this, "cheatTrueRadiator", config().cheatTrueRadiator, ""};
0053 
0054     Service<AlgorithmsInit_service> m_algorithmsInit {this};
0055     Service<RichGeo_service> m_RichGeoSvc {this};
0056 
0057 public:
0058     void Configure() {
0059         m_algo = std::make_unique<AlgoT>(GetPrefix());
0060         m_algo->level(static_cast<algorithms::LogLevel>(logger()->level()));
0061         m_algo->applyConfig(config());
0062         m_algo->init(m_RichGeoSvc().GetIrtGeo("DRICH")->GetIrtDetectorCollection(), logger());
0063     }
0064 
0065     void ChangeRun(int64_t run_number) {
0066     }
0067 
0068     void Process(int64_t run_number, uint64_t event_number) {
0069       m_algo->process(
0070         {
0071           m_aerogel_tracks_input(),
0072           m_gas_tracks_input(),
0073           m_merged_tracks_input(),
0074           m_raw_hits_input(),
0075           m_raw_hit_assoc_input()
0076         },
0077         {
0078           m_aerogel_particleIDs_output().get(),
0079           m_gas_particleIDs_output().get()
0080         }
0081       );
0082     }
0083 };
0084 
0085 } // eicrecon