Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /EICrecon/src/algorithms/calorimetry/HEXPLIT.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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   typedef struct stagger_pattern {
0042     int SUBCELLS;
0043     int NEIGHBORS;
0044     int OVERLAP;
0045     std::vector<double> neighbor_offsets_x;
0046     std::vector<double> neighbor_offsets_y;
0047     std::vector<std::vector<int>> neighbor_indices;
0048     std::vector<double> subcell_offsets_x;
0049     std::vector<double> subcell_offsets_y;
0050   } stagger_pattern;
0051 
0052   // number of subcells that a single cell is divided into
0053   static const int SUBCELLS_H4 = 12;
0054   // number of neighboring positions whose overlap define the subcells
0055   static const int NEIGHBORS_H4 = 12;
0056   // number of neighboring cells that overlap to obtain a subcell
0057   static const int OVERLAP_H4 = 3;
0058   //positions where the overlapping cells are relative to a given cell (in units of hexagon side length)
0059   static const std::vector<double> neighbor_offsets_x_H4;
0060   static const std::vector<double> neighbor_offsets_y_H4;
0061   //indices of the neighboring cells which overlap to produce a given subcell
0062   static const std::vector<std::vector<int>> neighbor_indices_H4;
0063   //positions of the centers of subcells
0064   static const std::vector<double> subcell_offsets_x_H4;
0065   static const std::vector<double> subcell_offsets_y_H4;
0066 
0067   const stagger_pattern stag_H4 = {
0068       .SUBCELLS           = SUBCELLS_H4,
0069       .NEIGHBORS          = NEIGHBORS_H4,
0070       .OVERLAP            = OVERLAP_H4,
0071       .neighbor_offsets_x = neighbor_offsets_x_H4,
0072       .neighbor_offsets_y = neighbor_offsets_y_H4,
0073       .neighbor_indices   = neighbor_indices_H4,
0074       .subcell_offsets_x  = subcell_offsets_x_H4,
0075       .subcell_offsets_y  = subcell_offsets_y_H4,
0076   };
0077 
0078   static const int SUBCELLS_S2 = 4;
0079   // number of neighboring positions whose overlap define the subcells
0080   static const int NEIGHBORS_S2 = 4;
0081   // number of neighboring cells that overlap to obtain a subcell
0082   static const int OVERLAP_S2 = 1;
0083   //positions where the overlapping cells are relative to a given cell (in units of hexagon side length)
0084   static const std::vector<double> neighbor_offsets_x_S2;
0085   static const std::vector<double> neighbor_offsets_y_S2;
0086   //indices of the neighboring cells which overlap to produce a given subcell
0087   static const std::vector<std::vector<int>> neighbor_indices_S2;
0088   //positions of the centers of subcells
0089   static const std::vector<double> subcell_offsets_x_S2;
0090   static const std::vector<double> subcell_offsets_y_S2;
0091 
0092   const stagger_pattern stag_S2 = {
0093       .SUBCELLS           = SUBCELLS_S2,
0094       .NEIGHBORS          = NEIGHBORS_S2,
0095       .OVERLAP            = OVERLAP_S2,
0096       .neighbor_offsets_x = neighbor_offsets_x_S2,
0097       .neighbor_offsets_y = neighbor_offsets_y_S2,
0098       .neighbor_indices   = neighbor_indices_S2,
0099       .subcell_offsets_x  = subcell_offsets_x_S2,
0100       .subcell_offsets_y  = subcell_offsets_y_S2,
0101   };
0102 
0103   stagger_pattern stag = stag_H4;
0104 
0105 private:
0106   const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0107 };
0108 
0109 } // namespace eicrecon