File indexing completed on 2025-01-30 10:04:50
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <DD4hep/DetElement.h>
0012 #include <DD4hep/Detector.h>
0013 #include <DD4hep/IDDescriptor.h>
0014 #include <DDRec/CellIDPositionConverter.h>
0015 #include <Parsers/Primitives.h>
0016 #include <algorithms/algorithm.h>
0017 #include <algorithms/geo.h>
0018 #include <edm4eic/CalorimeterHitCollection.h>
0019 #include <edm4hep/RawCalorimeterHitCollection.h>
0020 #include <stddef.h>
0021 #include <stdint.h>
0022 #include <functional>
0023 #include <gsl/pointers>
0024 #include <string>
0025 #include <string_view>
0026
0027 #include "CalorimeterHitRecoConfig.h"
0028 #include "algorithms/interfaces/WithPodConfig.h"
0029
0030 namespace eicrecon {
0031
0032 using CalorimeterHitRecoAlgorithm = algorithms::Algorithm<
0033 algorithms::Input<
0034 edm4hep::RawCalorimeterHitCollection
0035 >,
0036 algorithms::Output<
0037 edm4eic::CalorimeterHitCollection
0038 >
0039 >;
0040
0041 class CalorimeterHitReco
0042 : public CalorimeterHitRecoAlgorithm,
0043 public WithPodConfig<CalorimeterHitRecoConfig> {
0044
0045 public:
0046 CalorimeterHitReco(std::string_view name)
0047 : CalorimeterHitRecoAlgorithm{name,
0048 {"inputRawHitCollection"},
0049 {"outputRecHitCollection"},
0050 "Reconstruct hit from digitized input."} {}
0051
0052 void init() final;
0053 void process(const Input&, const Output&) const final;
0054
0055 private:
0056
0057
0058 double thresholdADC{0};
0059 double stepTDC{0};
0060
0061 std::function<double(const edm4hep::RawCalorimeterHit &h)> sampFrac;
0062
0063 dd4hep::IDDescriptor id_spec;
0064 dd4hep::BitFieldCoder* id_dec = nullptr;
0065
0066 mutable uint32_t NcellIDerrors = 0;
0067 uint32_t MaxCellIDerrors = 100;
0068
0069 size_t sector_idx{0}, layer_idx{0};
0070
0071 mutable bool warned_unsupported_segmentation = false;
0072
0073 dd4hep::DetElement m_local;
0074 size_t local_mask = ~static_cast<size_t>(0), gpos_mask = static_cast<size_t>(0);
0075
0076 private:
0077 const dd4hep::Detector* m_detector{algorithms::GeoSvc::instance().detector()};
0078 const dd4hep::rec::CellIDPositionConverter* m_converter{algorithms::GeoSvc::instance().cellIDPositionConverter()};
0079
0080 };
0081
0082 }