CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalBestChoiceCodec.cc
Go to the documentation of this file.
2 #include <limits>
3 
4 using namespace HGCalTriggerFE;
5 
8  "HGCalBestChoiceCodec");
9 
10 /*****************************************************************/
12  codecImpl_(conf)
13 /*****************************************************************/
14 {
15 }
16 
17 
18 /*****************************************************************/
20  const HGCEEDigiCollection& ee,
21  const HGCHEDigiCollection& fh,
22  const HGCHEDigiCollection& )
23 /*****************************************************************/
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 }
58 
59 /*****************************************************************/
61  const l1t::HGCFETriggerDigi& digi)
62 /*****************************************************************/
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 }
89 
90 
91 /*****************************************************************/
93 /*****************************************************************/
94 {
95  return codecImpl_.encode(data);
96 }
97 
98 /*****************************************************************/
100 /*****************************************************************/
101 {
102  return codecImpl_.decode(data);
103 }
104 
105 
data_type decodeImpl(const std::vector< bool > &) const
std::vector< bool > encodeImpl(const data_type &) const
int i
Definition: DBlmapReader.cc:9
void decode(const CODEC &codec, DATA &data) const
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 &)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
const unsigned char getCodecType() const
uint32_t triggerCellTruncationBits() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
size_type size() const
const std::string & name() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setDataPayloadImpl(const HGCalTriggerGeometryBase &geom, const HGCEEDigiCollection &ee, const HGCHEDigiCollection &fh, const HGCHEDigiCollection &bh)
HGCalBestChoiceCodec(const edm::ParameterSet &conf)