Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 07:55:53

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