2#include "Hcal/HcalAlignPolarfires.h"
5HcalAlignPolarfires::PolarfireQueueEntry::PolarfireQueueEntry(
7 const std::string& input_pass, std::pair<int, int>& spill_counter) {
8 int spilln =
event.getObject<
int>(input_name +
"Spill", input_pass);
9 if (spilln != spill_counter.second) {
10 spill_counter.first++;
11 spill_counter.second = spilln;
13 spilln = spill_counter.first;
14 ticks_ =
event.getObject<
int>(input_name +
"Ticks", input_pass);
33 while (pf1_queue_.size() > 0 and pf1_queue_.front().digis_.getNumDigis() == 0)
38 if (
pf0_queue_.size() > 0 and pf1_queue_.size() > 0) {
40 if (
pf0_queue_.front().sameEvent(pf1_queue_.front())) {
44 const auto& unmerged{pf1_queue_.front().digis_};
45 for (
int i{0}; i < unmerged.getNumDigis(); i++) {
46 auto digi{unmerged.getDigi(i)};
47 std::vector<ldmx::HgcrocDigiCollection::Sample> samples;
48 for (
int j{0}; j < unmerged.getNumSamplesPerDigi(); j++) {
49 samples.push_back(digi.at(i));
51 merged.
addDigi(digi.id(), samples);
57 }
else if (
pf0_queue_.front().earlierEvent(pf1_queue_.front())) {
64 merged = pf1_queue_.front().digis_;
74 }
else if (pf1_queue_.size() > 0) {
77 merged = pf1_queue_.front().digis_;
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
void abortEvent()
Abort the event immediately.
void setStorageHint(framework::StorageControl::Hint hint)
Mark the current event as having the given storage control hint from this module_.
Implements an event buffer system for storing event data.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Align the two polarfires with drop/keep hints signalling successful merge.
void configure(framework::config::Parameters &ps) override
Callback for the EventProcessor to configure itself from the given set of parameters.
static int max_tick_diff
number of 5MHz ticks difference to consider polarfires aligned
std::vector< std::string > input_names_
input decoded objects (vector index == polarfire index_)
std::queue< PolarfireQueueEntry > pf0_queue_
queue of unmatched digis
void produce(framework::Event &event) override
Process the event and put new data products into it.
std::pair< int, int > pf0_spill_counter_
spill counter
std::string input_pass_
pass name for decoded objects
std::string output_name_
output object name
Represents a collection of the digi hits readout by an HGCROC.
void addDigi(unsigned int id, const std::vector< Sample > &digi)
Add samples to collection.
constexpr StorageControl::Hint HINT_SHOULD_DROP
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint HINT_SHOULD_KEEP
storage control hint alias for backwards compatibility
int ticks_
ticks since spill