CMS 3D CMS Logo

HGCalFrameGenerator.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * This is a part of HGCAL offline software.
4  * Authors:
5  * Laurent Forthomme, CERN
6  *
7  ****************************************************************************/
8 
9 #ifndef EventFilter_HGCalRawToDigi_HGCalFrameGenerator_h
10 #define EventFilter_HGCalRawToDigi_HGCalFrameGenerator_h
11 
15 
16 #include <cstdint>
17 #include <vector>
18 
19 namespace edm {
20  class ParameterSet;
22 } // namespace edm
23 namespace CLHEP {
24  class HepRandomEngine;
25 }
26 
27 namespace hgcal {
28  namespace econd {
29  class Emulator;
30  }
33  public:
34  explicit HGCalFrameGenerator(const edm::ParameterSet&);
35 
37 
39  void setRandomEngine(CLHEP::HepRandomEngine& rng);
42 
44  std::vector<uint64_t> produceSlinkEvent(unsigned int fed_id) const;
47  std::vector<uint64_t> produceCaptureBlockEvent(unsigned int cb_id) const;
51  std::vector<uint64_t> produceECONEvent(unsigned int econd_id, unsigned int cb_id = 0) const;
52 
57 
59  struct SlinkParameters {
60  std::vector<unsigned int> active_econds{};
63  };
65  const SlinkParameters& slinkParams() const { return slink_params_; }
67  const std::map<unsigned int, econd::EmulatorParameters>& econdParams() const { return econd_params_; }
68 
69  private:
71  std::vector<uint32_t> generateERxData(unsigned int,
72  const econd::ERxInput&,
73  std::vector<econd::ERxChannelEnable>&) const;
74 
75  static constexpr size_t kMaxNumECONDs = 12;
76 
77  struct HeaderBits {
78  bool bitO, bitB, bitE, bitT, bitH, bitS;
79  };
80  HeaderBits generateStatusBits(unsigned int) const;
82  uint32_t computeCRC(const std::vector<uint32_t>&) const;
83 
85  std::map<unsigned int, econd::EmulatorParameters> econd_params_;
86 
87  CLHEP::HepRandomEngine* rng_{nullptr}; // NOT owning
88  mutable econd::Emulator* emul_{nullptr}; // NOT owning
89 
92  };
93 } // namespace hgcal
94 
95 #endif
const std::map< unsigned int, econd::EmulatorParameters > & econdParams() const
List of ECON-D operational parameters for emulation.
econd::ECONDInput last_emul_event_
std::map< unsigned int, econd::EmulatorParameters > econd_params_
std::vector< uint64_t > produceECONEvent(unsigned int econd_id, unsigned int cb_id=0) const
void setEmulator(econd::Emulator &)
Set the emulation source for ECON-D frames.
const econd::ECONDInput & lastECONDEmulatedInput() const
Retrieve the last ECON-D event emulated.
HeaderBits generateStatusBits(unsigned int) const
CLHEP::HepRandomEngine * rng_
std::vector< uint64_t > produceCaptureBlockEvent(unsigned int cb_id) const
std::map< ERxId_t, ERxData > ERxInput
eRx data maps
Definition: SlinkTypes.h:29
const SlinkParameters & slinkParams() const
List of S-link operational parameters for emulation.
std::vector< uint32_t > generateERxData(unsigned int, const econd::ERxInput &, std::vector< econd::ERxChannelEnable > &) const
econd::ERxChannelEnable generateEnabledChannels(unsigned int) const
std::vector< bool > ERxChannelEnable
list of channels enabled in eRx
Definition: SlinkTypes.h:38
std::vector< uint64_t > produceSlinkEvent(unsigned int fed_id) const
Produce a S-link event from an emulated event.
Pure virtual base class for a ECON-D event emulator implementation.
List of S-link operational parameters for emulation.
A S-link/ECON-D payload generator helper.
std::pair< EventId, ERxInput > ECONDInput
ECON-D inputs for a given event.
Definition: SlinkTypes.h:32
Map of capture block emulator truth information within a S-link payload.
const HGCalSlinkEmulatorInfo & lastSlinkEmulatedInfo() const
Retrieve the metadata generated along with the last S-link emulated payload.
uint32_t computeCRC(const std::vector< uint32_t > &) const
32bit CRC
HGCalSlinkEmulatorInfo last_slink_emul_info_
static edm::ParameterSetDescription description()
void setRandomEngine(CLHEP::HepRandomEngine &rng)
Set the random number generator engine.
HGCalFrameGenerator(const edm::ParameterSet &)
HLT enums.
static constexpr size_t kMaxNumECONDs