7 nData_(conf.getParameter<uint32_t>(
"NData")),
8 dataLength_(conf.getParameter<uint32_t>(
"DataLength")),
10 linLSB_(conf.getParameter<double>(
"linLSB")),
11 adcsaturation_(conf.getParameter<double>(
"adcsaturation")),
12 adcnBits_(conf.getParameter<uint32_t>(
"adcnBits")),
13 tdcsaturation_(conf.getParameter<double>(
"tdcsaturation")),
14 tdcnBits_(conf.getParameter<uint32_t>(
"tdcnBits")),
15 tdcOnsetfC_(conf.getParameter<double>(
"tdcOnsetfC")),
16 triggerCellTruncationBits_(conf.getParameter<uint32_t>(
"triggerCellTruncationBits"))
40 result[itc] = (value>0 ? 1 : 0);
46 <<
"encode: Number of non-zero trigger cells larger than codec parameter\n"\
47 <<
" : Number of energy values = "<<nData_<<
"\n";
70 <<
"decode: data length ("<<
data.size()<<
") inconsistent with codec parameters:\n"\
72 <<
" : Number of energy values = "<<
nData_<<
"\n"\
83 size_t index = nCellsInModule_+c*dataLength_+
i;
84 if(
data[index]) value |= (0x1<<
i);
96 std::vector<std::pair<DetId, uint32_t > >& linearized_dataframes)
102 for(
const auto& frame : dataframes) {
103 if (frame[2].
mode()) {
110 amplitude_int = uint32_t (floor(amplitude/
linLSB_+0.5));
111 if (amplitude_int>65535) amplitude_int = 65535;
113 linearized_dataframes.push_back(std::make_pair (frame.id(), amplitude_int));
122 if(linearized_dataframes.size()==0)
return;
123 std::map<HGCalDetId, uint32_t>
payload;
125 for(
const auto& frame : linearized_dataframes)
127 DetId cellid(frame.first);
131 payload.insert( std::make_pair(triggercellid, 0) );
133 uint32_t
value = frame.second;
134 payload[triggercellid] +=
value;
140 for(
const auto& id_value : payload)
145 uint32_t
id =
std::distance(trigger_cells_in_module.begin(),trigger_cells_in_module.find(id_value.first));
151 <<
"Number of trigger cells in module too large for available data payload\n";
153 data.
payload.at(
id) = id_value.second;
167 std::vector< std::pair<uint32_t, uint32_t> > sortedtriggercells;
171 sortedtriggercells.push_back(std::make_pair(data.
payload[
i],
i));
174 sort(sortedtriggercells.begin(), sortedtriggercells.end(),
175 [](
const std::pair<uint32_t, uint32_t>&
a,
176 const std::pair<uint32_t, uint32_t>&
b) ->
bool 184 sortedtriggercells.at(
i).first = 0;
186 for(
const auto& value_id : sortedtriggercells)
188 if(value_id.second>=nCellsInModule_)
191 <<
"Number of trigger cells in module too large for available data payload\n";
193 data.
payload.at(value_id.second) = value_id.first;
data_type decode(const std::vector< bool > &) const
std::vector< bool > encode(const data_type &) const
virtual geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const =0
HGCalBestChoiceCodecImpl(const edm::ParameterSet &conf)
uint32_t triggerCellSaturationBits_
payload
payload postfix for testing
uint32_t triggerCellTruncationBits_
trigger_cell_list payload
virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const =0
void triggerCellSums(const HGCalTriggerGeometryBase &, const std::vector< std::pair< DetId, uint32_t > > &, data_type &)
void linearize(const std::vector< HGCDataFrame< DetId, HGCSample >> &, std::vector< std::pair< DetId, uint32_t > > &)
void bestChoiceSelect(data_type &)
std::set< unsigned > geom_ordered_set
char data[epos_bytes_allocation]
virtual unsigned getTriggerCellFromCell(const unsigned cell_det_id) const =0
Power< A, B >::type pow(const A &a, const B &b)