Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:40

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 <spdlog/logger.h>
0015 #include <stdint.h>
0016 #include <map>
0017 #include <memory>
0018 #include <string>
0019 #include <string_view>
0020 #include <unordered_map>
0021 
0022 // EICrecon
0023 #include "IrtCherenkovParticleIDConfig.h"
0024 #include "algorithms/interfaces/ParticleSvc.h"
0025 #include "algorithms/interfaces/WithPodConfig.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_assocs` is a collection of digitized (raw) sensor hits, associated with MC (simulated) hits;
0031   //   noise hits are not included since there is no associated simulated photon
0032   // - `in_charged_particles` is a map of a radiator name to a collection of TrackSegments
0033   //   - each TrackSegment has a list of TrackPoints: the propagation of reconstructed track (trajectory) points
0034   // - the output is a map: radiator name -> collection of particle ID objects
0035   using IrtCherenkovParticleIDAlgorithm = algorithms::Algorithm<
0036     algorithms::Input<
0037       const edm4eic::TrackSegmentCollection,
0038       const edm4eic::TrackSegmentCollection,
0039       const edm4eic::TrackSegmentCollection,
0040       const edm4eic::RawTrackerHitCollection,
0041       const edm4eic::MCRecoTrackerHitAssociationCollection
0042     >,
0043     algorithms::Output<
0044       edm4eic::CherenkovParticleIDCollection,
0045       edm4eic::CherenkovParticleIDCollection
0046     >
0047   >;
0048 
0049   class IrtCherenkovParticleID
0050   : public IrtCherenkovParticleIDAlgorithm,
0051     public WithPodConfig<IrtCherenkovParticleIDConfig> {
0052 
0053   public:
0054     IrtCherenkovParticleID(std::string_view name)
0055       : IrtCherenkovParticleIDAlgorithm{name,
0056                             {
0057                               "inputAerogelTrackSegments", "inputGasTrackSegments", "inputMergedTrackSegments",
0058                               "inputRawHits", "inputRawHitAssociations"
0059                             },
0060                             {"outputAerogelParticleIDs", "outputGasParticleIDs"},
0061                             "Effectively 'zip' the input particle IDs"} {}
0062 
0063     void init(CherenkovDetectorCollection* irt_det_coll, std::shared_ptr<spdlog::logger>& logger);
0064 
0065     void process(const Input&, const Output&) const;
0066 
0067   private:
0068 
0069     std::shared_ptr<spdlog::logger> m_log;
0070     CherenkovDetectorCollection*    m_irt_det_coll;
0071     CherenkovDetector*              m_irt_det;
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     std::map<std::string,CherenkovRadiator*> m_pid_radiators;
0079 
0080   };
0081 }