test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual void produce (edm::Event &, edm::EventSetup const &)
 
virtual ~DaqFakeReader ()
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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 fillGTPFED (edm::EventID &eID, FEDRawDataCollection &data, 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 width
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, 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 21 of file DaqFakeReader.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file DaqFakeReader.cc.

36  : runNum(1)
37  , eventNum(1)
38  , empty_events(pset.getUntrackedParameter<bool>("emptyEvents",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))
43 {
44  // mean = pset.getParameter<float>("mean");
45  produces<FEDRawDataCollection>();
46 }
unsigned int width
Definition: DaqFakeReader.h:61
T getUntrackedParameter(std::string const &, T const &) const
unsigned int modulo_error_events
Definition: DaqFakeReader.h:63
unsigned int injected_errors_per_million_events
Definition: DaqFakeReader.h:62
unsigned int meansize
Definition: DaqFakeReader.h:60
edm::RunNumber_t runNum
Definition: DaqFakeReader.h:57
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:58
DaqFakeReader::~DaqFakeReader ( )
virtual

Definition at line 49 of file DaqFakeReader.cc.

50 {
51 
52 }

Member Function Documentation

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

Definition at line 190 of file DaqFakeReader.cc.

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

191 {
192  std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl;
193  fakeLs_=iL.luminosityBlock();
194 }
unsigned int fakeLs_
Definition: DaqFakeReader.h:64
tuple cout
Definition: gather_cfg.py:145
void DaqFakeReader::fillFEDs ( const int  fedmin,
const int  fedmax,
edm::EventID eID,
FEDRawDataCollection data,
float  meansize,
float  width 
)
private

Definition at line 115 of file DaqFakeReader.cc.

References FEDRawData::data(), edm::EventID::event(), create_public_lumi_plots::exp, FEDRawDataCollection::FEDData(), l1tstage2_dqm_sourceclient-live_cfg::fedId, dqm-mbProfile::log, FEDRawData::resize(), FEDTrailer::set(), FEDHeader::set(), and findQualityFiles::size.

Referenced by fillRawData().

120 {
121 
122  // FIXME: last ID included?
123  for (int fedId = fedmin; fedId <= fedmax; ++fedId ) {
124 
125  // Generate size...
126  float logsiz = CLHEP::RandGauss::shoot(std::log(meansize),
128  size_t size = int(std::exp(logsiz));
129  size -= size % 8; // all blocks aligned to 64 bit words
130 
131  FEDRawData& feddata = data.FEDData(fedId);
132  // Allocate space for header+trailer+payload
133  feddata.resize(size+16);
134 
135  // Generate header
136  FEDHeader::set(feddata.data(),
137  1, // Trigger type
138  eID.event(), // LV1_id (24 bits)
139  0, // BX_id
140  fedId); // source_id
141 
142  // Payload = all 0s...
143 
144  // Generate trailer
145  int crc = 0; // FIXME : get CRC
146  FEDTrailer::set(feddata.data()+8+size,
147  size/8+2, // in 64 bit words!!!
148  crc,
149  0, // Evt_stat
150  0); // TTS bits
151  }
152 }
unsigned int width
Definition: DaqFakeReader.h:61
EventNumber_t event() const
Definition: EventID.h:41
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
Definition: FEDTrailer.cc:42
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
static void set(unsigned char *header, int evt_ty, int lvl1_ID, int bx_ID, int source_ID, int version=0, bool H=false)
Set all fields in the header.
Definition: FEDHeader.cc:40
unsigned int meansize
Definition: DaqFakeReader.h:60
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
tuple size
Write out results.
void DaqFakeReader::fillGTPFED ( edm::EventID eID,
FEDRawDataCollection data,
timeval *  now 
)
private

Definition at line 154 of file DaqFakeReader.cc.

References FEDRawData::data(), edm::EventID::event(), evf::evtn::EVM_BOARDID_OFFSET, evf::evtn::EVM_BOARDID_SHIFT, evf::evtn::EVM_BOARDID_VALUE, evf::evtn::EVM_GTFE_BSTGPS_OFFSET, evf::evtn::EVM_TCS_TRIGNR_OFFSET, FEDRawDataCollection::FEDData(), l1tstage2_dqm_sourceclient-live_cfg::fedId, FEDNumbering::MINTriggerGTPFEDID, FEDRawData::resize(), FEDTrailer::set(), FEDHeader::set(), findQualityFiles::size, evf::evtn::SLINK_HALFWORD_SIZE, and evf::evtn::SLINK_WORD_SIZE.

Referenced by fillRawData().

156 {
158  FEDRawData& feddata = data.FEDData(fedId);
159  uint32_t size = evf::evtn::SLINK_WORD_SIZE*37-16;//BST52_3BX
160  feddata.resize(size+16);
161 
162  FEDHeader::set(feddata.data(),
163  1, // Trigger type
164  eID.event(), // LV1_id (24 bits)
165  0, // BX_id
166  fedId); // source_id
167 
168  int crc = 0; // FIXME : get CRC
169  FEDTrailer::set(feddata.data()+8+size,
170  size/8+2, // in 64 bit words!!!
171  crc,
172  0, // Evt_stat
173  0); // TTS bits
174 
175  unsigned char * pOffset = feddata.data() + sizeof(fedh_t);
176  //fill in event ID
178  *( (uint32_t*)(pOffset + sizeof(fedh_t) + (9*2 + evf::evtn::EVM_TCS_TRIGNR_OFFSET) * evf::evtn::SLINK_WORD_SIZE / 2)) = eID.event();
179  //fill in timestamp
180  *( (uint32_t*) (pOffset + evf::evtn::EVM_GTFE_BSTGPS_OFFSET * evf::evtn::SLINK_WORD_SIZE / 2)) = now->tv_sec;
181  *( (uint32_t*) (pOffset + sizeof(fedh_t) + evf::evtn::EVM_GTFE_BSTGPS_OFFSET * evf::evtn::SLINK_WORD_SIZE / 2 + evf::evtn::SLINK_HALFWORD_SIZE)) = now->tv_usec;
182 
183  //*( (uint16_t*) (pOffset + (evtn::EVM_GTFE_BLOCK*2 + evtn::EVM_TCS_LSBLNR_OFFSET)*evtn::SLINK_HALFWORD_SIZE)) = (unsigned short)fakeLs_-1;
184 
185  //we could also generate lumiblock, bcr, orbit,... but they are not currently used by the FRD input source
186 
187 }
EventNumber_t event() const
Definition: EventID.h:41
const unsigned int EVM_TCS_TRIGNR_OFFSET
struct fedh_struct fedh_t
const unsigned int EVM_BOARDID_VALUE
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
Definition: FEDTrailer.cc:42
const unsigned int SLINK_HALFWORD_SIZE
Definition: FEDConstants.h:7
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
static void set(unsigned char *header, int evt_ty, int lvl1_ID, int bx_ID, int source_ID, int version=0, bool H=false)
Set all fields in the header.
Definition: FEDHeader.cc:40
const unsigned int SLINK_WORD_SIZE
Definition: FEDConstants.h:6
const unsigned int EVM_BOARDID_OFFSET
const unsigned int EVM_GTFE_BSTGPS_OFFSET
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
const unsigned int EVM_BOARDID_SHIFT
tuple size
Write out results.
int DaqFakeReader::fillRawData ( edm::Event e,
FEDRawDataCollection *&  data 
)
virtual

Definition at line 60 of file DaqFakeReader.cc.

References empty_events, eventNum, fillFEDs(), fillGTPFED(), edm::EventBase::id(), 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, fileCollector::now, and width.

Referenced by produce().

62 {
63  // a null pointer is passed, need to allocate the fed collection
64  data=new FEDRawDataCollection();
65  EventID eID = e.id();
66 
67  if(!empty_events)
68  {
69 
70  // Fill the EventID
71  eventNum++;
72  // FIXME:
73 
76  eID, *data, meansize, width);
79  eID, *data, meansize, width);
82  eID, *data, meansize, width);
85  eID, *data, meansize, width);
88  eID, *data, meansize, width);
91  eID, *data, meansize, width);
94  eID, *data, meansize, width);
95 
96  timeval now;
97  gettimeofday(&now,0);
98  fillGTPFED(eID, *data,&now);
99  //TODO: write fake TCDS FED filler
100  }
101  return 1;
102 }
unsigned int width
Definition: DaqFakeReader.h:61
void fillFEDs(const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
void fillGTPFED(edm::EventID &eID, FEDRawDataCollection &data, timeval *now)
unsigned int meansize
Definition: DaqFakeReader.h:60
edm::EventID id() const
Definition: EventBase.h:58
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:58
void DaqFakeReader::produce ( edm::Event e,
edm::EventSetup const &  es 
)
virtual

Implements edm::one::EDProducerBase.

Definition at line 104 of file DaqFakeReader.cc.

References fillRawData(), eostools::move(), edm::Event::put(), and lumiPlot::rawdata.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

104  {
105 
107  FEDRawDataCollection *fedcoll = 0;
108  fillRawData(e,fedcoll);
109  std::unique_ptr<FEDRawDataCollection> bare_product(fedcoll);
110  e.put(std::move(bare_product));
111 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
def move
Definition: eostools.py:510
dictionary rawdata
Definition: lumiPlot.py:393

Member Data Documentation

bool DaqFakeReader::empty_events
private

Definition at line 59 of file DaqFakeReader.h.

Referenced by fillRawData().

edm::EventNumber_t DaqFakeReader::eventNum
private

Definition at line 58 of file DaqFakeReader.h.

Referenced by fillRawData().

unsigned int DaqFakeReader::fakeLs_ =0
private

Definition at line 64 of file DaqFakeReader.h.

Referenced by beginLuminosityBlock().

unsigned int DaqFakeReader::injected_errors_per_million_events
private

Definition at line 62 of file DaqFakeReader.h.

unsigned int DaqFakeReader::meansize
private

Definition at line 60 of file DaqFakeReader.h.

Referenced by fillRawData().

unsigned int DaqFakeReader::modulo_error_events
private

Definition at line 63 of file DaqFakeReader.h.

edm::RunNumber_t DaqFakeReader::runNum
private

Definition at line 57 of file DaqFakeReader.h.

unsigned int DaqFakeReader::width
private