18 #include "CLHEP/Random/RandGauss.h" 37 empty_events(
pset.getUntrackedParameter<
bool>(
"emptyEvents",
false)),
38 fillRandom_(
pset.getUntrackedParameter<
bool>(
"fillRandom",
false)),
39 meansize(
pset.getUntrackedParameter<unsigned
int>(
"meanSize", 1024)),
40 width(
pset.getUntrackedParameter<unsigned
int>(
"width", 1024)),
41 injected_errors_per_million_events(
pset.getUntrackedParameter<unsigned
int>(
"injectErrPpm", 0)),
42 tcdsFEDID_(
pset.getUntrackedParameter<unsigned
int>(
"tcdsFEDID", 1024)),
43 modulo_error_events(injected_errors_per_million_events ? 1000000 / injected_errors_per_million_events
53 srand(time_count & 0xffffffff);
55 produces<FEDRawDataCollection>();
70 auto ls =
e.luminosityBlock();
86 gettimeofday(&
now,
nullptr);
96 std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
116 size_t size_ui =
size -
size %
sizeof(
unsigned int);
117 for (
size_t i = 0;
i < size_ui;
i +=
sizeof(
unsigned int)) {
118 *((
unsigned int*)(feddata.
data() +
i)) = (
unsigned int)rand();
121 for (
size_t i = size_ui;
i <
size;
i++) {
122 *(feddata.
data() +
i) = rand() & 0xff;
169 const_cast<uint32_t&
>(
header->orbitHigh) = orbitnr & 0xffff00;
170 const_cast<uint16_t&
>(
header->orbitLow) = orbitnr & 0xff;
171 const_cast<uint16_t&
>(
header->bxid) = bxid;
174 const_cast<uint32_t&
>(
header->lumiSection) =
ls;
191 desc.setComment(
"Injector of generated raw FED data for DAQ testing");
192 desc.addUntracked<
bool>(
"emptyEvents",
false);
193 desc.addUntracked<
bool>(
"fillRandom",
false);
194 desc.addUntracked<
unsigned int>(
"meanSize", 1024);
195 desc.addUntracked<
unsigned int>(
"width", 1024);
196 desc.addUntracked<
unsigned int>(
"injectErrPpm", 1024);
197 desc.addUntracked<
unsigned int>(
"tcdsFEDID", 1024);
198 descriptions.
add(
"DaqFakeReader",
desc);
void fillFEDs(const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
virtual void beginLuminosityBlock(edm::LuminosityBlock const &iL, edm::EventSetup const &iE)
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
DaqFakeReader(const edm::ParameterSet &pset)
unsigned long long uint64_t
void resize(size_t newsize, size_t wordsize=8)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void fillTCDSFED(edm::EventID &eID, FEDRawDataCollection &data, uint32_t ls, timeval *now)
const uint16_t lhcFillLow
void produce(edm::Event &, edm::EventSetup const &) override
~DaqFakeReader() override
const uint32_t gpstimelow
const uint32_t gpstimehigh
char data[epos_bytes_allocation]
edm::EventNumber_t eventNum
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
LuminosityBlockNumber_t luminosityBlock() const
const uint16_t lhcFillHigh
EventNumber_t event() const