Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:34:26

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2023 Sebouh Paul
0003 
0004 // An algorithm for splitting calorimeter hits in overlapping cells into "subhits" based on the relative
0005 // energies of hits on neighboring layers
0006 //
0007 // Author: Sebouh Paul
0008 // Date: 12/04/2023
0009 
0010 #pragma once
0011 
0012 #include <DD4hep/Detector.h>
0013 #include <algorithms/algorithm.h>
0014 #include <algorithms/geo.h>
0015 #include <edm4eic/CalorimeterHitCollection.h>
0016 #include <gsl/pointers>
0017 #include <string>      // for basic_string
0018 #include <string_view> // for string_view
0019 #include <vector>
0020 
0021 #include "HEXPLITConfig.h"
0022 #include "algorithms/interfaces/WithPodConfig.h"
0023 
0024 namespace eicrecon {
0025 
0026 using HEXPLITAlgorithm =
0027     algorithms::Algorithm<algorithms::Input<const edm4eic::CalorimeterHitCollection>,
0028                           algorithms::Output<edm4eic::CalorimeterHitCollection>>;
0029 
0030 class HEXPLIT : public HEXPLITAlgorithm, public WithPodConfig<HEXPLITConfig> {
0031 
0032 public:
0033   HEXPLIT(std::string_view name)
0034       : HEXPLITAlgorithm{
0035             name, {"inputHits"}, {"outputSubcellHits"}, "Split hits into subcell hits"} {}
0036 
0037   void init() final;
0038   void process(const Input&, const Output&) const final;
0039 
0040 private:
0041   // number of subcells that a single cell is divided into
0042   static const int SUBCELLS = 12;
0043   // number of neighboring positions whose overlap define the subcells
0044   static const int NEIGHBORS = 12;
0045   // number of neighboring cells that overlap to obtain a subcell
0046   static const int OVERLAP = 3;
0047   //positions where the overlapping cells are relative to a given cell (in units of hexagon side length)
0048   static const std::vector<double> neighbor_offsets_x;
0049   static const std::vector<double> neighbor_offsets_y;
0050   //indices of the neighboring cells which overlap to produce a given subcell
0051   static const int neighbor_indices[SUBCELLS][OVERLAP];
0052   //positions of the centers of subcells
0053   static const std::vector<double> subcell_offsets_x;
0054   static const std::vector<double> subcell_offsets_y;
0055 
0056 private:
0057   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0058 };
0059 
0060 } // namespace eicrecon