CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DaqFakeReader Class Reference

#include <DaqFakeReader.h>

Inheritance diagram for DaqFakeReader:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 DaqFakeReader (const edm::ParameterSet &pset)
 
virtual int fillRawData (edm::Event &e, FEDRawDataCollection *&data)
 
void produce (edm::Event &, edm::EventSetup const &) override
 
 ~DaqFakeReader () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &iL, edm::EventSetup const &iE)
 
void fillFEDs (const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
 
void fillTCDSFED (edm::EventID &eID, FEDRawDataCollection &data, uint32_t ls, timeval *now)
 

Private Attributes

bool empty_events
 
edm::EventNumber_t eventNum
 
unsigned int fakeLs_ = 0
 
unsigned int injected_errors_per_million_events
 
unsigned int meansize
 
unsigned int modulo_error_events
 
edm::RunNumber_t runNum
 
unsigned int tcdsFEDID_
 
unsigned int width
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Generates empty FEDRawData of random size for all FEDs Proper headers and trailers are included; but the payloads are all 0s

Author
N. Amapane - CERN

Definition at line 19 of file DaqFakeReader.h.

Constructor & Destructor Documentation

◆ DaqFakeReader()

DaqFakeReader::DaqFakeReader ( const edm::ParameterSet pset)

Definition at line 32 of file DaqFakeReader.cc.

33  : runNum(1),
34  eventNum(1),
35  empty_events(pset.getUntrackedParameter<bool>("emptyEvents", false)),
36  meansize(pset.getUntrackedParameter<unsigned int>("meanSize", 1024)),
37  width(pset.getUntrackedParameter<unsigned int>("width", 1024)),
38  injected_errors_per_million_events(pset.getUntrackedParameter<unsigned int>("injectErrPpm", 0)),
39  tcdsFEDID_(pset.getUntrackedParameter<unsigned int>("tcdsFEDID", 1024)),
41  : 0xffffffff) {
42  // mean = pset.getParameter<float>("mean");
44  throw cms::Exception("DaqFakeReader::DaqFakeReader")
45  << " TCDS FED ID lower than " << FEDNumbering::MINTCDSuTCAFEDID;
46  produces<FEDRawDataCollection>();
47 }

References Exception, FEDNumbering::MINTCDSuTCAFEDID, and tcdsFEDID_.

◆ ~DaqFakeReader()

DaqFakeReader::~DaqFakeReader ( )
override

Definition at line 50 of file DaqFakeReader.cc.

50 {}

Member Function Documentation

◆ beginLuminosityBlock()

void DaqFakeReader::beginLuminosityBlock ( edm::LuminosityBlock const &  iL,
edm::EventSetup const &  iE 
)
privatevirtual

Definition at line 163 of file DaqFakeReader.cc.

163  {
164  std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl;
165  fakeLs_ = iL.luminosityBlock();
166 }

References gather_cfg::cout, fakeLs_, and edm::LuminosityBlockBase::luminosityBlock().

◆ fillFEDs()

void DaqFakeReader::fillFEDs ( const int  fedmin,
const int  fedmax,
edm::EventID eID,
FEDRawDataCollection data,
float  meansize,
float  width 
)
private

Definition at line 92 of file DaqFakeReader.cc.

93  {
94  // FIXME: last ID included?
95  for (int fedId = fedmin; fedId <= fedmax; ++fedId) {
96  // Generate size...
97  float logsiz = CLHEP::RandGauss::shoot(std::log(meansize), std::log(meansize) - std::log(width / 2.));
98  size_t size = int(std::exp(logsiz));
99  size -= size % 8; // all blocks aligned to 64 bit words
100 
101  FEDRawData& feddata = data.FEDData(fedId);
102  // Allocate space for header+trailer+payload
103  feddata.resize(size + 16);
104 
105  // Generate header
106  FEDHeader::set(feddata.data(),
107  1, // Trigger type
108  eID.event(), // LV1_id (24 bits)
109  0, // BX_id
110  fedId); // source_id
111 
112  // Payload = all 0s...
113 
114  // Generate trailer
115  int crc = 0; // FIXME : get CRC
116  FEDTrailer::set(feddata.data() + 8 + size,
117  size / 8 + 2, // in 64 bit words!!!
118  crc,
119  0, // Evt_stat
120  0); // TTS bits
121  }
122 }

References FEDRawData::data(), data, edm::EventID::event(), JetChargeProducer_cfi::exp, l1tstage2_dqm_sourceclient-live_cfg::fedId, createfilelist::int, dqm-mbProfile::log, meansize, FEDRawData::resize(), FEDHeader::set(), FEDTrailer::set(), findQualityFiles::size, and width.

Referenced by fillRawData().

◆ fillRawData()

int DaqFakeReader::fillRawData ( edm::Event e,
FEDRawDataCollection *&  data 
)
virtual

Definition at line 57 of file DaqFakeReader.cc.

57  {
58  // a null pointer is passed, need to allocate the fed collection
59  data = new FEDRawDataCollection();
60  EventID eID = e.id();
61  auto ls = e.luminosityBlock();
62 
63  if (!empty_events) {
64  // Fill the EventID
65  eventNum++;
66  // FIXME:
67 
75 
76  timeval now;
77  gettimeofday(&now, nullptr);
78  fillTCDSFED(eID, *data, ls, &now);
79  }
80  return 1;
81 }

References data, MillePedeFileConverter_cfg::e, empty_events, eventNum, EcalFEDMonitor_cfi::FEDRawDataCollection, fillFEDs(), fillTCDSFED(), eostools::ls(), FEDNumbering::MAXCSCFEDID, FEDNumbering::MAXDTFEDID, FEDNumbering::MAXECALFEDID, FEDNumbering::MAXHCALFEDID, FEDNumbering::MAXRPCFEDID, FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MAXSiStripFEDID, meansize, FEDNumbering::MINCSCFEDID, FEDNumbering::MINDTFEDID, FEDNumbering::MINECALFEDID, FEDNumbering::MINHCALFEDID, FEDNumbering::MINRPCFEDID, FEDNumbering::MINSiPixelFEDID, FEDNumbering::MINSiStripFEDID, submitPVValidationJobs::now, and width.

Referenced by produce().

◆ fillTCDSFED()

void DaqFakeReader::fillTCDSFED ( edm::EventID eID,
FEDRawDataCollection data,
uint32_t  ls,
timeval *  now 
)
private

Definition at line 124 of file DaqFakeReader.cc.

124  {
125  uint32_t fedId = tcdsFEDID_;
126  FEDRawData& feddata = data.FEDData(fedId);
127  uint32_t size = sizeof(tcds::Raw_v1);
128  feddata.resize(size + 16);
129 
130  uint64_t orbitnr = 0;
131  uint16_t bxid = 0;
132 
133  FEDHeader::set(feddata.data(),
134  1, // Trigger type
135  eID.event(), // LV1_id (24 bits)
136  bxid, // BX_id
137  fedId); // source_id
138 
139  tcds::Raw_v1* tcds = reinterpret_cast<tcds::Raw_v1*>(feddata.data() + FEDHeader::length);
140  tcds::BST_v1* bst = const_cast<tcds::BST_v1*>(&tcds->bst);
141  tcds::Header_v1* header = const_cast<tcds::Header_v1*>(&tcds->header);
142 
143  const_cast<uint32_t&>(bst->gpstimehigh) = now->tv_sec;
144  const_cast<uint32_t&>(bst->gpstimelow) = now->tv_usec;
145  const_cast<uint16_t&>(bst->lhcFillHigh) = 0;
146  const_cast<uint16_t&>(bst->lhcFillLow) = 0;
147 
148  const_cast<uint32_t&>(header->orbitHigh) = orbitnr & 0xffff00;
149  const_cast<uint16_t&>(header->orbitLow) = orbitnr & 0xff;
150  const_cast<uint16_t&>(header->bxid) = bxid;
151 
152  const_cast<uint64_t&>(header->eventNumber) = eID.event();
153  const_cast<uint32_t&>(header->lumiSection) = ls;
154 
155  int crc = 0; // only full event crc32c checked in HLT, not FED CRC16
156  FEDTrailer::set(feddata.data() + 8 + size,
157  size / 8 + 2, // in 64 bit words!!!
158  crc,
159  0, // Evt_stat
160  0); // TTS bits
161 }

References FEDRawData::data(), data, edm::EventID::event(), l1tstage2_dqm_sourceclient-live_cfg::fedId, RecoTauValidation_cfi::header, FEDHeader::length, eostools::ls(), submitPVValidationJobs::now, FEDRawData::resize(), FEDHeader::set(), FEDTrailer::set(), findQualityFiles::size, and tcdsFEDID_.

Referenced by fillRawData().

◆ produce()

void DaqFakeReader::produce ( edm::Event e,
edm::EventSetup const &  es 
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 83 of file DaqFakeReader.cc.

83  {
85  FEDRawDataCollection* fedcoll = nullptr;
86  fillRawData(e, fedcoll);
87  std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
88  e.put(std::move(bare_product));
89 }

References MillePedeFileConverter_cfg::e, fillRawData(), and eostools::move().

Member Data Documentation

◆ empty_events

bool DaqFakeReader::empty_events
private

Definition at line 50 of file DaqFakeReader.h.

Referenced by fillRawData().

◆ eventNum

edm::EventNumber_t DaqFakeReader::eventNum
private

Definition at line 49 of file DaqFakeReader.h.

Referenced by fillRawData().

◆ fakeLs_

unsigned int DaqFakeReader::fakeLs_ = 0
private

Definition at line 56 of file DaqFakeReader.h.

Referenced by beginLuminosityBlock().

◆ injected_errors_per_million_events

unsigned int DaqFakeReader::injected_errors_per_million_events
private

Definition at line 53 of file DaqFakeReader.h.

◆ meansize

unsigned int DaqFakeReader::meansize
private

Definition at line 51 of file DaqFakeReader.h.

Referenced by fillFEDs(), and fillRawData().

◆ modulo_error_events

unsigned int DaqFakeReader::modulo_error_events
private

Definition at line 55 of file DaqFakeReader.h.

◆ runNum

edm::RunNumber_t DaqFakeReader::runNum
private

Definition at line 48 of file DaqFakeReader.h.

◆ tcdsFEDID_

unsigned int DaqFakeReader::tcdsFEDID_
private

Definition at line 54 of file DaqFakeReader.h.

Referenced by DaqFakeReader(), and fillTCDSFED().

◆ width

unsigned int DaqFakeReader::width
private
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
DaqFakeReader::runNum
edm::RunNumber_t runNum
Definition: DaqFakeReader.h:48
FEDNumbering::MINECALFEDID
Definition: FEDNumbering.h:43
DaqFakeReader::fillTCDSFED
void fillTCDSFED(edm::EventID &eID, FEDRawDataCollection &data, uint32_t ls, timeval *now)
Definition: DaqFakeReader.cc:124
DaqFakeReader::empty_events
bool empty_events
Definition: DaqFakeReader.h:50
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
DaqFakeReader::injected_errors_per_million_events
unsigned int injected_errors_per_million_events
Definition: DaqFakeReader.h:53
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
DaqFakeReader::fillRawData
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
Definition: DaqFakeReader.cc:57
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FEDNumbering::MAXCSCFEDID
Definition: FEDNumbering.h:52
FEDNumbering::MINTCDSuTCAFEDID
Definition: FEDNumbering.h:101
edm::Handle< FEDRawDataCollection >
FEDNumbering::MINRPCFEDID
Definition: FEDNumbering.h:59
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
DaqFakeReader::meansize
unsigned int meansize
Definition: DaqFakeReader.h:51
FEDNumbering::MAXSiPixelFEDID
Definition: FEDNumbering.h:28
tcds::Raw_v1
Definition: TCDSRaw.h:106
EcalFEDMonitor_cfi.FEDRawDataCollection
FEDRawDataCollection
Definition: EcalFEDMonitor_cfi.py:6
FEDNumbering::MAXDTFEDID
Definition: FEDNumbering.h:56
DaqFakeReader::eventNum
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:49
tcds::Header_v1
Definition: TCDSRaw.h:29
FEDNumbering::MAXSiStripFEDID
Definition: FEDNumbering.h:30
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
createfilelist.int
int
Definition: createfilelist.py:10
FEDHeader::length
static const uint32_t length
Definition: FEDHeader.h:54
FEDNumbering::MINCSCFEDID
Definition: FEDNumbering.h:51
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
FEDNumbering::MINDTFEDID
Definition: FEDNumbering.h:55
FEDTrailer::set
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.
Definition: FEDTrailer.cc:31
tcds
Definition: TCDSRaw.h:16
DaqFakeReader::width
unsigned int width
Definition: DaqFakeReader.h:52
DaqFakeReader::fillFEDs
void fillFEDs(const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
Definition: DaqFakeReader.cc:92
FEDNumbering::MINSiPixelFEDID
Definition: FEDNumbering.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
DaqFakeReader::fakeLs_
unsigned int fakeLs_
Definition: DaqFakeReader.h:56
Exception
Definition: hltDiff.cc:245
FEDNumbering::MINHCALFEDID
Definition: FEDNumbering.h:47
FEDHeader::set
static void set(unsigned char *header, uint8_t triggerType, uint32_t lvl1ID, uint16_t bxID, uint16_t sourceID, uint8_t version=0, bool moreHeaders=false)
Set all fields in the header.
Definition: FEDHeader.cc:25
FEDRawData::resize
void resize(size_t newsize)
Definition: FEDRawData.cc:28
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DaqFakeReader::tcdsFEDID_
unsigned int tcdsFEDID_
Definition: DaqFakeReader.h:54
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
FEDNumbering::MAXRPCFEDID
Definition: FEDNumbering.h:60
tcds::BST_v1
Definition: TCDSRaw.h:71
FEDNumbering::MAXHCALFEDID
Definition: FEDNumbering.h:48
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::EventID
Definition: EventID.h:31
DaqFakeReader::modulo_error_events
unsigned int modulo_error_events
Definition: DaqFakeReader.h:55
FEDNumbering::MAXECALFEDID
Definition: FEDNumbering.h:44
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FEDNumbering::MINSiStripFEDID
Definition: FEDNumbering.h:29