Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-12 08:16:43

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 - 2024, Sylvester Joosten, Chao Peng, Wouter Deconinck, David Lawrence, Derek Anderson
0003 
0004 /*
0005  *  Reconstruct the cluster/layer info for imaging calorimeter
0006  *  Logarithmic weighting is used to describe energy deposit in transverse direction
0007  *
0008  *  Author: Chao Peng (ANL), 06/02/2021
0009  */
0010 
0011 #pragma once
0012 
0013 #include <algorithms/algorithm.h>
0014 #include <edm4eic/CalorimeterHitCollection.h>
0015 #include <edm4eic/ClusterCollection.h>
0016 #include <edm4eic/MCRecoCalorimeterHitAssociationCollection.h>
0017 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0018 #include <edm4eic/ProtoClusterCollection.h>
0019 #include <edm4hep/CaloHitContribution.h>
0020 // Event Model related classes
0021 #include <edm4hep/MCParticleCollection.h>
0022 #include <iterator>
0023 #include <string>
0024 #include <string_view>
0025 #include <utility>
0026 #include <vector>
0027 
0028 #include "ImagingClusterRecoConfig.h"
0029 #include "algorithms/interfaces/WithPodConfig.h"
0030 
0031 namespace eicrecon {
0032 
0033 using ImagingClusterRecoAlgorithm =
0034     algorithms::Algorithm<algorithms::Input<edm4eic::ProtoClusterCollection,
0035                                             edm4eic::MCRecoCalorimeterHitAssociationCollection>,
0036                           algorithms::Output<edm4eic::ClusterCollection,
0037                                              edm4eic::MCRecoClusterParticleAssociationCollection,
0038                                              edm4eic::ClusterCollection>>;
0039 
0040 /** Imaging cluster reconstruction.
0041    *
0042    *  Reconstruct the cluster/layer info for imaging calorimeter
0043    *  Logarithmic weighting is used to describe energy deposit in transverse direction
0044    *
0045    *  \ingroup reco
0046    */
0047 class ImagingClusterReco : public ImagingClusterRecoAlgorithm,
0048                            public WithPodConfig<ImagingClusterRecoConfig> {
0049 
0050 public:
0051   ImagingClusterReco(std::string_view name)
0052       : ImagingClusterRecoAlgorithm{
0053             name,
0054             {"inputProtoClusterCollection", "mcRawHitAssocations"},
0055             {"outputClusterCollection", "outputClusterAssociations", "outputLayerCollection"},
0056             "Reconstruct the cluster/layer info for imaging calorimeter."} {}
0057 
0058 public:
0059   void init() {}
0060 
0061   void process(const Input& input, const Output& output) const final;
0062 
0063 private:
0064   std::vector<edm4eic::MutableCluster>
0065   reconstruct_cluster_layers(const edm4eic::ProtoCluster& pcl) const;
0066 
0067   edm4eic::MutableCluster
0068   reconstruct_layer(const std::vector<std::pair<const edm4eic::CalorimeterHit, float>>& hits) const;
0069 
0070   edm4eic::MutableCluster reconstruct_cluster(const edm4eic::ProtoCluster& pcl) const;
0071 
0072   std::pair<double /* polar */, double /* azimuthal */>
0073   fit_track(const std::vector<edm4eic::MutableCluster>& layers) const;
0074 
0075   void associate_mc_particles(
0076       const edm4eic::Cluster& cl,
0077       const edm4eic::MCRecoCalorimeterHitAssociationCollection* mchitassociations,
0078       edm4eic::MCRecoClusterParticleAssociationCollection* assocs) const;
0079 
0080   edm4hep::MCParticle get_primary(const edm4hep::CaloHitContribution& contrib) const;
0081 };
0082 
0083 } // namespace eicrecon