Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 07:55:38

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 <edm4hep/CaloHitContribution.h>
0015 // Event Model related classes
0016 #include <edm4hep/MCParticleCollection.h>
0017 #include <edm4eic/MCRecoCalorimeterHitAssociationCollection.h>
0018 #include <edm4eic/CalorimeterHitCollection.h>
0019 #include <edm4eic/ClusterCollection.h>
0020 #include <edm4eic/MCRecoClusterParticleAssociationCollection.h>
0021 #include <edm4eic/ProtoClusterCollection.h>
0022 #include <string>
0023 #include <string_view>
0024 #include <utility>
0025 #include <vector>
0026 
0027 #include "ImagingClusterRecoConfig.h"
0028 #include "algorithms/interfaces/WithPodConfig.h"
0029 
0030 namespace eicrecon {
0031 
0032 using ImagingClusterRecoAlgorithm =
0033     algorithms::Algorithm<algorithms::Input<edm4eic::ProtoClusterCollection,
0034                                             edm4eic::MCRecoCalorimeterHitAssociationCollection>,
0035                           algorithms::Output<edm4eic::ClusterCollection,
0036                                              edm4eic::MCRecoClusterParticleAssociationCollection,
0037                                              edm4eic::ClusterCollection>>;
0038 
0039 /** Imaging cluster reconstruction.
0040    *
0041    *  Reconstruct the cluster/layer info for imaging calorimeter
0042    *  Logarithmic weighting is used to describe energy deposit in transverse direction
0043    *
0044    *  \ingroup reco
0045    */
0046 class ImagingClusterReco : public ImagingClusterRecoAlgorithm,
0047                            public WithPodConfig<ImagingClusterRecoConfig> {
0048 
0049 public:
0050   ImagingClusterReco(std::string_view name)
0051       : ImagingClusterRecoAlgorithm{
0052             name,
0053             {"inputProtoClusterCollection", "mcRawHitAssocations"},
0054             {"outputClusterCollection", "outputClusterAssociations", "outputLayerCollection"},
0055             "Reconstruct the cluster/layer info for imaging calorimeter."} {}
0056 
0057 public:
0058   void init() {}
0059 
0060   void process(const Input& input, const Output& output) const final;
0061 
0062 private:
0063   std::vector<edm4eic::MutableCluster>
0064   reconstruct_cluster_layers(const edm4eic::ProtoCluster& pcl) const;
0065 
0066   edm4eic::MutableCluster
0067   reconstruct_layer(const std::vector<std::pair<const edm4eic::CalorimeterHit, float>>& hits) const;
0068 
0069   edm4eic::MutableCluster reconstruct_cluster(const edm4eic::ProtoCluster& pcl) const;
0070 
0071   std::pair<double /* polar */, double /* azimuthal */>
0072   fit_track(const std::vector<edm4eic::MutableCluster>& layers) const;
0073 
0074   void associate_mc_particles(
0075       const edm4eic::Cluster& cl,
0076       const edm4eic::MCRecoCalorimeterHitAssociationCollection* mchitassociations,
0077       edm4eic::MCRecoClusterParticleAssociationCollection* assocs) const;
0078 
0079   edm4hep::MCParticle get_primary(const edm4hep::CaloHitContribution& contrib) const;
0080 };
0081 
0082 } // namespace eicrecon