Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-01 08:26:02

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/CherenkovDetector.h>
0007 #include <IRT/CherenkovDetectorCollection.h>
0008 #include <IRT/CherenkovRadiator.h>
0009 #include <algorithms/algorithm.h>
0010 #include <edm4eic/CherenkovParticleIDCollection.h>
0011 #include <edm4eic/MCRecoTrackerHitAssociationCollection.h>
0012 #include <edm4eic/MCRecoTrackerHitLinkCollection.h>
0013 #include <edm4eic/RawTrackerHitCollection.h>
0014 #include <edm4eic/TrackSegmentCollection.h>
0015 #include <stdint.h>
0016 #include <map>
0017 #include <mutex>
0018 #include <string>
0019 #include <string_view>
0020 #include <unordered_map>
0021 
0022 // EICrecon
0023 #include "algorithms/interfaces/WithPodConfig.h"
0024 #include "services/particle/ParticleSvc.h"
0025 #include "algorithms/pid/IrtCherenkovParticleIDConfig.h"
0026 
0027 namespace eicrecon {
0028 
0029 // - `in_raw_hits` is a collection of digitized (raw) sensor hits, possibly including noise hits
0030 // - `in_hit_links` is a collection of raw-hit ↔ sim-hit link objects
0031 //   (`edm4eic::MCRecoTrackerHitLink`); noise hits are not included since they have no associated
0032 //   simulated photon
0033 // - `in_hit_assocs` is the association collection for compatibility with
0034 //   CherenkovParticleID::rawHitAssociations output relations
0035 // - `in_charged_particles` is a map of a radiator name to a collection of TrackSegments
0036 //   - each TrackSegment has a list of TrackPoints: the propagation of reconstructed track (trajectory) points
0037 // - the output is a map: radiator name -> collection of particle ID objects
0038 using IrtCherenkovParticleIDAlgorithm = algorithms::Algorithm<
0039     algorithms::Input<const edm4eic::TrackSegmentCollection, const edm4eic::TrackSegmentCollection,
0040                       const edm4eic::TrackSegmentCollection, const edm4eic::RawTrackerHitCollection,
0041                       const edm4eic::MCRecoTrackerHitLinkCollection,
0042                       const edm4eic::MCRecoTrackerHitAssociationCollection>,
0043     algorithms::Output<edm4eic::CherenkovParticleIDCollection,
0044                        edm4eic::CherenkovParticleIDCollection>>;
0045 
0046 class IrtCherenkovParticleID : public IrtCherenkovParticleIDAlgorithm,
0047                                public WithPodConfig<IrtCherenkovParticleIDConfig> {
0048 
0049 public:
0050   IrtCherenkovParticleID(std::string_view name)
0051       : IrtCherenkovParticleIDAlgorithm{name,
0052                                         {"inputAerogelTrackSegments", "inputGasTrackSegments",
0053                                          "inputMergedTrackSegments", "inputRawHits",
0054                                          "inputRawHitLinks", "inputRawHitAssociations"},
0055                                         {"outputAerogelParticleIDs", "outputGasParticleIDs"},
0056                                         "Effectively 'zip' the input particle IDs"} {}
0057 
0058   // FIXME: init() must not take arguments
0059 #pragma GCC diagnostic push
0060 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
0061   void init(CherenkovDetectorCollection* irt_det_coll);
0062 #pragma GCC diagnostic pop
0063 
0064   void process(const Input&, const Output&) const;
0065 
0066 private:
0067   // any access (R or W) to m_irt_det_coll, m_irt_det, m_pid_radiators must be locked
0068   inline static std::mutex m_irt_det_mutex;
0069   CherenkovDetectorCollection* m_irt_det_coll;
0070   CherenkovDetector* m_irt_det;
0071   std::map<std::string, CherenkovRadiator*> m_pid_radiators;
0072 
0073   const algorithms::ParticleSvc& m_particleSvc = algorithms::ParticleSvc::instance();
0074 
0075   uint64_t m_cell_mask;
0076   std::string m_det_name;
0077   std::unordered_map<int, double> m_pdg_mass;
0078 };
0079 
0080 } // namespace eicrecon