Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:38

0001 
0002 // SPDX-License-Identifier: LGPL-3.0-or-later
0003 // Copyright (C) 2022 Chao Peng, Sylvester Joosten, Wouter Deconinck, Chao, Whitney Armstrong
0004 
0005 // Reconstruct digitized outputs, paired with Jug::Digi::CalorimeterHitDigi
0006 // Author: Chao Peng
0007 // Date: 06/14/2021
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     // unitless counterparts of the input parameters
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 } // namespace eicrecon