CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HGCalBestChoiceCodec Class Reference

#include <HGCalBestChoiceCodec.h>

Inheritance diagram for HGCalBestChoiceCodec:
HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload > HGCalTriggerFECodecBase

Public Types

typedef HGCalBestChoiceDataPayload data_type
 

Public Member Functions

data_type decodeImpl (const std::vector< bool > &, const uint32_t) const
 
std::vector< bool > encodeImpl (const data_type &) const
 
 HGCalBestChoiceCodec (const edm::ParameterSet &conf)
 
void setDataPayloadImpl (const HGCalDigiCollection &ee, const HGCalDigiCollection &fh, const HGCalDigiCollection &bh)
 
void setDataPayloadImpl (const l1t::HGCFETriggerDigi &digi)
 
- Public Member Functions inherited from HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload >
 Codec (const edm::ParameterSet &conf)
 
void decode (const l1t::HGCFETriggerDigi &digi) final
 
HGCalBestChoiceDataPayload decode (const std::vector< bool > &data, const uint32_t module=0) const
 
void encode (l1t::HGCFETriggerDigi &digi) final
 
std::vector< bool > encode (const HGCalBestChoiceDataPayload &data) const
 
std::vector< bool > getDataPayload () const final
 
void print (const l1t::HGCFETriggerDigi &digi, std::ostream &out=std::cout) const final
 
void setDataPayload (const HGCalDigiCollection &ee, const HGCalDigiCollection &fh, const HGCalDigiCollection &bh) final
 
void setDataPayload (const l1t::HGCFETriggerDigi &digi) final
 
void unSetDataPayload () final
 
- Public Member Functions inherited from HGCalTriggerFECodecBase
const unsigned char getCodecType () const
 
 HGCalTriggerFECodecBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 
virtual ~HGCalTriggerFECodecBase ()
 

Private Attributes

HGCalBestChoiceCodecImpl codecImpl_
 

Additional Inherited Members

- Protected Attributes inherited from HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload >
HGCalBestChoiceDataPayload data_
 
- Protected Attributes inherited from HGCalTriggerFECodecBase
const HGCalTriggerGeometryBasegeometry_
 

Detailed Description

Definition at line 19 of file HGCalBestChoiceCodec.h.

Member Typedef Documentation

Definition at line 22 of file HGCalBestChoiceCodec.h.

Constructor & Destructor Documentation

HGCalBestChoiceCodec::HGCalBestChoiceCodec ( const edm::ParameterSet conf)

Definition at line 11 of file HGCalBestChoiceCodec.cc.

11  : Codec(conf),
12  codecImpl_(conf)
13 /*****************************************************************/
14 {
15 }
HGCalBestChoiceCodecImpl codecImpl_

Member Function Documentation

HGCalBestChoiceCodec::data_type HGCalBestChoiceCodec::decodeImpl ( const std::vector< bool > &  data,
const uint32_t   
) const

Definition at line 98 of file HGCalBestChoiceCodec.cc.

References codecImpl_, and HGCalBestChoiceCodecImpl::decode().

100 {
101  return codecImpl_.decode(data);
102 }
data_type decode(const std::vector< bool > &) const
HGCalBestChoiceCodecImpl codecImpl_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< bool > HGCalBestChoiceCodec::encodeImpl ( const data_type data) const

Definition at line 91 of file HGCalBestChoiceCodec.cc.

References codecImpl_, data, and HGCalBestChoiceCodecImpl::encode().

93 {
94  return codecImpl_.encode(data);
95 }
std::vector< bool > encode(const data_type &) const
HGCalBestChoiceCodecImpl codecImpl_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void HGCalBestChoiceCodec::setDataPayloadImpl ( const HGCalDigiCollection ee,
const HGCalDigiCollection fh,
const HGCalDigiCollection bh 
)

Definition at line 19 of file HGCalBestChoiceCodec.cc.

References HGCalBestChoiceCodecImpl::bestChoiceSelect(), codecImpl_, HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload >::data_, edm::SortedCollection< T, SORT >::empty(), HGCalTriggerFECodecBase::geometry_, mps_fire::i, HGCalBestChoiceCodecImpl::linearize(), HGCalBestChoiceDataPayload::reset(), and HGCalBestChoiceCodecImpl::triggerCellSums().

23 {
24  data_.reset();
25  std::vector<HGCalDataFrame> dataframes;
26  std::vector<std::pair<DetId, uint32_t > > linearized_dataframes;
27  // convert ee and fh hit collections into the same object
28  if(!ee.empty())
29  {
30  for(const auto& eedata : ee)
31  {
32  dataframes.emplace_back(eedata.id());
33  for(int i=0; i<eedata.size(); i++)
34  {
35  dataframes.back().setSample(i, eedata.sample(i));
36  }
37  }
38  }
39  else if(!fh.empty())
40  {
41  for(const auto& fhdata : fh)
42  {
43  dataframes.emplace_back(fhdata.id());
44  for(int i=0; i<fhdata.size(); i++)
45  {
46  dataframes.back().setSample(i, fhdata.sample(i));
47  }
48  }
49  }
50  // linearize input energy on 16 bits
51  codecImpl_.linearize(dataframes, linearized_dataframes);
52  // sum energy in trigger cells
53  codecImpl_.triggerCellSums(*geometry_, linearized_dataframes, data_);
54  // choose best trigger cells in the module
56 }
void linearize(const std::vector< HGCalDataFrame > &, std::vector< std::pair< DetId, uint32_t > > &)
HGCalBestChoiceCodecImpl codecImpl_
const HGCalTriggerGeometryBase * geometry_
void triggerCellSums(const HGCalTriggerGeometryBase &, const std::vector< std::pair< DetId, uint32_t > > &, data_type &)
void HGCalBestChoiceCodec::setDataPayloadImpl ( const l1t::HGCFETriggerDigi digi)

Definition at line 59 of file HGCalBestChoiceCodec.cc.

References HGCalBestChoiceCodecImpl::adcnBits(), HGCalBestChoiceCodecImpl::adcsaturation(), edm::ParameterSet::addParameter(), HGCalBestChoiceCodecImpl::bestChoiceSelect(), codecImpl_, HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload >::data_, HGCalBestChoiceCodecImpl::dataLength(), l1t::HGCFETriggerDigi::decode(), HGCalTriggerFECodecBase::geometry_, HGCalTriggerFECodecBase::getCodecType(), HGCalBestChoiceCodecImpl::linLSB(), HGCalTriggerFECodecBase::name(), HGCalBestChoiceDataPayload::reset(), HGCalBestChoiceDataPayload::size, AlCaHLTBitMon_QueryRunRegistry::string, HGCalBestChoiceCodecImpl::tdcnBits(), HGCalBestChoiceCodecImpl::tdcOnsetfC(), HGCalBestChoiceCodecImpl::tdcsaturation(), and HGCalBestChoiceCodecImpl::triggerCellTruncationBits().

61 {
62  data_.reset();
63  // decode input data with different parameters
64  // (no selection, so NData=number of trigger cells in module)
65  // FIXME:
66  // Not very clean to define an alternative codec within this codec
67  // Also, the codec is built each time the method is called, which is not very efficient
68  // This may need a restructuration of the FECodec
69  edm::ParameterSet conf;
70  conf.addParameter<std::string>("CodecName", name());
71  conf.addParameter<uint32_t> ("CodecIndex", getCodecType());
72  conf.addParameter<uint32_t> ("NData", HGCalBestChoiceCodec::data_type::size);
73  // The data length should be the same for input and output, which is limiting
74  conf.addParameter<uint32_t> ("DataLength", codecImpl_.dataLength());
75  conf.addParameter<double> ("linLSB", codecImpl_.linLSB());
76  conf.addParameter<double> ("adcsaturation", codecImpl_.adcsaturation());
77  conf.addParameter<uint32_t> ("adcnBits", codecImpl_.adcnBits());
78  conf.addParameter<double> ("tdcsaturation", codecImpl_.tdcsaturation());
79  conf.addParameter<uint32_t> ("tdcnBits", codecImpl_.tdcnBits());
80  conf.addParameter<double> ("tdcOnsetfC", codecImpl_.tdcOnsetfC());
81  conf.addParameter<uint32_t> ("triggerCellTruncationBits", codecImpl_.triggerCellTruncationBits());
82  HGCalBestChoiceCodec codecInput(conf);
83  codecInput.setGeometry(geometry_);
84  digi.decode(codecInput,data_);
85  // choose best trigger cells in the module
87 }
void decode(const CODEC &codec, DATA &data) const
HGCalBestChoiceCodecImpl codecImpl_
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
const unsigned char getCodecType() const
const HGCalTriggerGeometryBase * geometry_
uint32_t triggerCellTruncationBits() const
const std::string & name() const

Member Data Documentation

HGCalBestChoiceCodecImpl HGCalBestChoiceCodec::codecImpl_
private

Definition at line 36 of file HGCalBestChoiceCodec.h.

Referenced by decodeImpl(), encodeImpl(), and setDataPayloadImpl().