CMS 3D CMS Logo

HGCalTriggerCellThresholdCodec.cc
Go to the documentation of this file.
2 #include <limits>
3 
4 using namespace HGCalTriggerFE;
5 
8  "HGCalTriggerCellThresholdCodec");
9 
12  codecImpl_(conf)
13 {
14 }
15 
16 
17 void
20  const HGCHEDigiCollection& fh,
21  const HGCHEDigiCollection& )
22 {
23  data_.reset();
24  std::vector<HGCDataFrame<HGCalDetId,HGCSample>> dataframes;
25  std::vector<std::pair<HGCalDetId, uint32_t > > linearized_dataframes;
26  // convert ee and fh hit collections into the same object
27  if(ee.size()>0)
28  {
29  for(const auto& eedata : ee)
30  {
31  dataframes.emplace_back(eedata.id());
32  for(int i=0; i<eedata.size(); i++)
33  {
34  dataframes.back().setSample(i, eedata.sample(i));
35  }
36  }
37  }
38  else if(fh.size()>0)
39  {
40  for(const auto& fhdata : fh)
41  {
42  dataframes.emplace_back(fhdata.id());
43  for(int i=0; i<fhdata.size(); i++)
44  {
45  dataframes.back().setSample(i, fhdata.sample(i));
46  }
47  }
48  }
49  // linearize input energy on 16 bits
50  codecImpl_.linearize(dataframes, linearized_dataframes);
51  // sum energy in trigger cells
52  codecImpl_.triggerCellSums(*geometry_, linearized_dataframes, data_);
53  // choose thresholds selected cells in the module
55 }
56 
57 void
60 {
61  data_.reset();
62  // decode input data with different parameters
63  // (no selection, so NData=number of trigger cells in module)
64  // FIXME:
65  // Not very clean to define an alternative codec within this codec
66  // Also, the codec is built each time the method is called, which is not very efficient
67  // This may need a restructuration of the FECodec
68  edm::ParameterSet conf;
69  conf.addParameter<std::string>("CodecName", name());
70  conf.addParameter<uint32_t> ("CodecIndex", getCodecType());
71  conf.addParameter<uint32_t> ("MaxCellsInModule", codecImpl_.nCellsInModule());
72  conf.addParameter<uint32_t> ("NData", codecImpl_.nCellsInModule());
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  conf.addParameter<double> ("TCThreshold_fC", codecImpl_.TCThreshold_fC());
83  HGCalTriggerCellThresholdCodec codecInput(conf);
84  codecInput.setGeometry(geometry_);
85  digi.decode(codecInput,data_);
86  // choose threshold selected cells in the module
88 }
89 
90 
91 std::vector<bool>
94 {
95  return codecImpl_.encode(data, *geometry_);
96 }
97 
100 decodeImpl(const std::vector<bool>& data, const uint32_t module) const
101 {
102  return codecImpl_.decode(data, module, *geometry_);
103 }
104 
105 
void decode(const CODEC &codec, DATA &data) const
HGCalTriggerCellThresholdCodecImpl codecImpl_
void linearize(const std::vector< HGCDataFrame< HGCalDetId, HGCSample >> &, std::vector< std::pair< HGCalDetId, uint32_t > > &)
data_type decode(const std::vector< bool > &, const uint32_t, const HGCalTriggerGeometryBase &) const
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
const unsigned char getCodecType() const
void setDataPayloadImpl(const HGCEEDigiCollection &ee, const HGCHEDigiCollection &fh, const HGCHEDigiCollection &bh)
data_type decodeImpl(const std::vector< bool > &, const uint32_t) const
std::vector< bool > encode(const data_type &, const HGCalTriggerGeometryBase &) const
HGCalTriggerCellThresholdCodec(const edm::ParameterSet &conf)
const HGCalTriggerGeometryBase * geometry_
std::vector< bool > encodeImpl(const data_type &) 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 triggerCellSums(const HGCalTriggerGeometryBase &, const std::vector< std::pair< HGCalDetId, uint32_t > > &, data_type &)
Definition: vlib.h:208