Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-06 08:48:28

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2024 Chun Yuen Tsang, Prithwish Tribedy
0003 //
0004 // Spread energy deposition from one strip to neighboring strips within sensor boundaries
0005 
0006 #pragma once
0007 
0008 #include <DD4hep/IDDescriptor.h>
0009 #include <DD4hep/Objects.h>
0010 #include <DDRec/CellIDPositionConverter.h>
0011 #include <DDSegmentation/BitFieldCoder.h>
0012 #include <algorithms/algorithm.h>
0013 #include <edm4hep/SimTrackerHitCollection.h>
0014 #include <functional>
0015 #include <string>
0016 #include <string_view>
0017 #include <unordered_set>
0018 #include <vector>
0019 
0020 #include "DD4hep/Detector.h"
0021 #include "algorithms/digi/LGADChargeSharingConfig.h"
0022 #include "algorithms/interfaces/WithPodConfig.h"
0023 
0024 namespace eicrecon {
0025 
0026 using LGADChargeSharingAlgorithm =
0027     algorithms::Algorithm<algorithms::Input<edm4hep::SimTrackerHitCollection>,
0028                           algorithms::Output<edm4hep::SimTrackerHitCollection>>;
0029 
0030 class LGADChargeSharing : public LGADChargeSharingAlgorithm,
0031                           public WithPodConfig<LGADChargeSharingConfig> {
0032 
0033 public:
0034   LGADChargeSharing(std::string_view name)
0035       : LGADChargeSharingAlgorithm{name, {"TOFBarrelHits"}, {"TOFBarrelSharedHits"}, ""} {};
0036 
0037   void init() final;
0038   void process(const Input&, const Output&) const final;
0039 
0040 private:
0041   void _findAllNeighborsInSensor(dd4hep::rec::CellID hitCell,
0042                                  std::vector<dd4hep::rec::CellID>& answer,
0043                                  std::unordered_set<dd4hep::rec::CellID>& dp) const;
0044   double _integralGaus(double mean, double sd, double low_lim, double up_lim) const;
0045   dd4hep::Position _cell2LocalPosition(const dd4hep::rec::CellID& cell) const;
0046   dd4hep::Position _global2Local(const dd4hep::Position& pos) const;
0047 
0048   const dd4hep::DDSegmentation::BitFieldCoder* m_decoder  = nullptr;
0049   const dd4hep::Detector* m_detector                      = nullptr;
0050   const dd4hep::rec::CellIDPositionConverter* m_converter = nullptr;
0051   dd4hep::IDDescriptor m_idSpec;
0052 
0053   // helper function to find neighbors
0054   std::function<bool(const dd4hep::rec::CellID &id1, const dd4hep::rec::CellID &id2)> _is_same_sensor;
0055 
0056 };
0057 
0058 } // namespace eicrecon