CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
std::vector< bool > encodeImpl (const data_type &) const
 
 HGCalBestChoiceCodec (const edm::ParameterSet &conf)
 
void setDataPayloadImpl (const HGCalTriggerGeometryBase &geom, const HGCEEDigiCollection &ee, const HGCHEDigiCollection &fh, const HGCHEDigiCollection &bh)
 
void setDataPayloadImpl (const HGCalTriggerGeometryBase &geom, const l1t::HGCFETriggerDigi &digi)
 
- Public Member Functions inherited from HGCalTriggerFE::Codec< HGCalBestChoiceCodec, HGCalBestChoiceDataPayload >
 Codec (const edm::ParameterSet &conf)
 
virtual void decode (const l1t::HGCFETriggerDigi &digi) overridefinal
 
HGCalBestChoiceDataPayload decode (const std::vector< bool > &data) const
 
virtual void encode (l1t::HGCFETriggerDigi &digi) overridefinal
 
std::vector< bool > encode (const HGCalBestChoiceDataPayload &data) const
 
std::vector< bool > getDataPayload () const overridefinal
 
virtual void print (const l1t::HGCFETriggerDigi &digi, std::ostream &out=std::cout) const overridefinal
 
virtual void setDataPayload (const HGCalTriggerGeometryBase &geom, const HGCEEDigiCollection &ee, const HGCHEDigiCollection &fh, const HGCHEDigiCollection &bh) overridefinal
 
virtual void setDataPayload (const HGCalTriggerGeometryBase &geom, const l1t::HGCFETriggerDigi &digi) overridefinal
 
virtual void unSetDataPayload () overridefinal
 
- Public Member Functions inherited from HGCalTriggerFECodecBase
const unsigned char getCodecType () const
 
 HGCalTriggerFECodecBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~HGCalTriggerFECodecBase ()
 

Private Attributes

HGCalBestChoiceCodecImpl codecImpl_
 

Additional Inherited Members

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

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

Definition at line 99 of file HGCalBestChoiceCodec.cc.

References data.

101 {
102  return codecImpl_.decode(data);
103 }
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 92 of file HGCalBestChoiceCodec.cc.

References data.

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

Definition at line 19 of file HGCalBestChoiceCodec.cc.

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

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

Definition at line 60 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::getCodecType(), HGCalBestChoiceCodecImpl::linLSB(), HGCalTriggerFECodecBase::name(), HGCalBestChoiceDataPayload::reset(), HGCalBestChoiceDataPayload::size, AlCaHLTBitMon_QueryRunRegistry::string, HGCalBestChoiceCodecImpl::tdcnBits(), HGCalBestChoiceCodecImpl::tdcOnsetfC(), HGCalBestChoiceCodecImpl::tdcsaturation(), and HGCalBestChoiceCodecImpl::triggerCellTruncationBits().

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

Member Data Documentation

HGCalBestChoiceCodecImpl HGCalBestChoiceCodec::codecImpl_
private

Definition at line 38 of file HGCalBestChoiceCodec.h.

Referenced by setDataPayloadImpl().