File indexing completed on 2024-06-29 07:05:54
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #pragma once
0015
0016 #include <algorithms/algorithm.h>
0017 #include <algorithms/geo.h>
0018 #include <DD4hep/IDDescriptor.h>
0019 #include <edm4hep/RawCalorimeterHitCollection.h>
0020 #include <edm4hep/SimCalorimeterHitCollection.h>
0021 #include <random>
0022 #include <stdint.h>
0023 #include <string>
0024 #include <string_view>
0025 #include <functional>
0026
0027 #include "CalorimeterHitDigiConfig.h"
0028 #include "algorithms/interfaces/WithPodConfig.h"
0029
0030 namespace eicrecon {
0031
0032 using CalorimeterHitDigiAlgorithm = algorithms::Algorithm<
0033 algorithms::Input<
0034 edm4hep::SimCalorimeterHitCollection
0035 >,
0036 algorithms::Output<
0037 edm4hep::RawCalorimeterHitCollection
0038 >
0039 >;
0040
0041 class CalorimeterHitDigi
0042 : public CalorimeterHitDigiAlgorithm,
0043 public WithPodConfig<CalorimeterHitDigiConfig> {
0044
0045 public:
0046 CalorimeterHitDigi(std::string_view name)
0047 : CalorimeterHitDigiAlgorithm{name,
0048 {"inputHitCollection"},
0049 {"outputRawHitCollection"},
0050 "Smear energy deposit, digitize within ADC range, add pedestal, "
0051 "convert time with smearing resolution, and sum signals."} {}
0052
0053 void init() final;
0054 void process(const Input&, const Output&) const final;
0055
0056 private:
0057
0058
0059 double dyRangeADC{0}, stepTDC{0}, tRes{0};
0060
0061 uint64_t id_mask{0};
0062
0063 std::function<double(const edm4hep::SimCalorimeterHit &h)> corrMeanScale;
0064
0065 dd4hep::IDDescriptor id_spec;
0066
0067 private:
0068 const algorithms::GeoSvc& m_geo = algorithms::GeoSvc::instance();
0069
0070 mutable std::default_random_engine m_generator;
0071 mutable std::normal_distribution<double> m_gaussian;
0072
0073 };
0074
0075 }