Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-05-12 08:47:50

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2025 Simon Gardner
0003 //
0004 // Convert energy deposition into ADC pulses
0005 // ADC pulses are assumed to follow the shape of landau function
0006 
0007 #pragma once
0008 
0009 #include <algorithms/algorithm.h>
0010 #include <edm4eic/EDM4eicVersion.h>
0011 #include <cstdint>
0012 #if EDM4EIC_VERSION_MAJOR > 8 || (EDM4EIC_VERSION_MAJOR == 8 && EDM4EIC_VERSION_MINOR >= 1)
0013 #include <edm4eic/SimPulseCollection.h>
0014 #else
0015 #include <edm4hep/TimeSeriesCollection.h>
0016 #endif
0017 #include <string>
0018 #include <string_view>
0019 #include <vector>
0020 
0021 #include "algorithms/digi/PulseCombinerConfig.h"
0022 #include "algorithms/interfaces/WithPodConfig.h"
0023 
0024 namespace eicrecon {
0025 
0026 #if EDM4EIC_VERSION_MAJOR > 8 || (EDM4EIC_VERSION_MAJOR == 8 && EDM4EIC_VERSION_MINOR >= 1)
0027 using PulseType = edm4eic::SimPulse;
0028 #else
0029 using PulseType = edm4hep::TimeSeries;
0030 #endif
0031 
0032 using PulseCombinerAlgorithm =
0033     algorithms::Algorithm<algorithms::Input<PulseType::collection_type>,
0034                           algorithms::Output<PulseType::collection_type>>;
0035 
0036 class PulseCombiner : public PulseCombinerAlgorithm, public WithPodConfig<PulseCombinerConfig> {
0037 
0038 public:
0039   PulseCombiner(std::string_view name)
0040       : PulseCombinerAlgorithm{name, {"InputPulses"}, {"OutputPulses"}, {}} {}
0041   virtual void init() final;
0042   void process(const Input&, const Output&) const final;
0043 
0044 private:
0045   std::vector<std::vector<PulseType>> clusterPulses(const std::vector<PulseType> pulses) const;
0046   std::vector<float> sumPulses(const std::vector<PulseType> pulses) const;
0047   uint64_t m_detector_bitmask = 0xFFFFFFFFFFFFFFFF;
0048 };
0049 
0050 } // namespace eicrecon