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::EDProducer 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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlock (edm::LuminosityBlock const &iL, edm::EventSetup const &iE)
 
void fillFED1023 (edm::EventID &eID, FEDRawDataCollection &data)
 
void fillFEDs (const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
 

Private Attributes

bool empty_events
 
edm::EventNumber_t eventNum
 
evf::EvffedFillerRB frb
 
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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 22 of file DaqFakeReader.h.

Constructor & Destructor Documentation

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

Definition at line 31 of file DaqFakeReader.cc.

References frb, and evf::EvffedFillerRB::setEPProcessId().

32  : runNum(1)
33  , eventNum(1)
34  , empty_events(pset.getUntrackedParameter<bool>("emptyEvents",false))
35  , meansize(pset.getUntrackedParameter<unsigned int>("meanSize",1024))
36  , width(pset.getUntrackedParameter<unsigned int>("width",1024))
37  , injected_errors_per_million_events(pset.getUntrackedParameter<unsigned int>("injectErrPpm",0))
39 {
40  // mean = pset.getParameter<float>("mean");
41  produces<FEDRawDataCollection>();
42  frb.setEPProcessId(getpid());
43 }
unsigned int width
Definition: DaqFakeReader.h:62
T getUntrackedParameter(std::string const &, T const &) const
unsigned int modulo_error_events
Definition: DaqFakeReader.h:64
evf::EvffedFillerRB frb
Definition: DaqFakeReader.h:65
unsigned int injected_errors_per_million_events
Definition: DaqFakeReader.h:63
void setEPProcessId(pid_t pid)
unsigned int meansize
Definition: DaqFakeReader.h:61
edm::RunNumber_t runNum
Definition: DaqFakeReader.h:58
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:59
DaqFakeReader::~DaqFakeReader ( )
virtual

Definition at line 46 of file DaqFakeReader.cc.

47 {
48 
49 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 162 of file DaqFakeReader.cc.

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

163 {
164  std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl;}
tuple cout
Definition: gather_cfg.py:121
void DaqFakeReader::fillFED1023 ( edm::EventID eID,
FEDRawDataCollection data 
)
private

Definition at line 147 of file DaqFakeReader.cc.

References FEDRawData::data(), edm::EventID::event(), FEDRawDataCollection::FEDData(), evf::EvffedFillerRB::fedId(), frb, evf::EvffedFillerRB::getPayload(), modulo_error_events, fileCollector::now, evf::EvffedFillerRB::putHeader(), evf::EvffedFillerRB::putTrailer(), FEDRawData::resize(), evf::EvffedFillerRB::setDAQDiaWord1(), evf::EvffedFillerRB::setRBTimeStamp(), and evf::EvffedFillerRB::size().

Referenced by fillRawData().

149 {
150  FEDRawData& feddata = data.FEDData(frb.fedId());
151  // Allocate space for header+trailer+payload
152  feddata.resize(frb.size());
153  frb.putHeader(eID.event(),0);
154  if(eID.event()%modulo_error_events==0) frb.setDAQDiaWord1(1ll); else frb.setDAQDiaWord1(0ll);
155  timeval now;
156  gettimeofday(&now, 0);
157  frb.setRBTimeStamp(((uint64_t) (now.tv_sec) << 32) + (uint64_t) (now.tv_usec));
158  frb.putTrailer();
159  memcpy(feddata.data(),frb.getPayload(),frb.size());
160 }
EventNumber_t event() const
Definition: EventID.h:44
unsigned int modulo_error_events
Definition: DaqFakeReader.h:64
unsigned int size() const
evf::EvffedFillerRB frb
Definition: DaqFakeReader.h:65
unsigned int fedId() const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
unsigned char *const getPayload()
unsigned long long uint64_t
Definition: Time.h:15
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
void setRBTimeStamp(uint64_t ts)
void setDAQDiaWord1(uint64_t word)
void putHeader(unsigned int l1id, unsigned int bxid)
void DaqFakeReader::fillFEDs ( const int  fedmin,
const int  fedmax,
edm::EventID eID,
FEDRawDataCollection data,
float  meansize,
float  width 
)
private

Definition at line 108 of file DaqFakeReader.cc.

References FEDRawData::data(), edm::EventID::event(), create_public_lumi_plots::exp, FEDRawDataCollection::FEDData(), create_public_lumi_plots::log, FEDRawData::resize(), FEDTrailer::set(), FEDHeader::set(), and findQualityFiles::size.

Referenced by fillRawData().

113 {
114 
115  // FIXME: last ID included?
116  for (int fedId = fedmin; fedId <= fedmax; ++fedId ) {
117 
118  // Generate size...
119  float logsiz = CLHEP::RandGauss::shoot(std::log(meansize),
121  size_t size = int(std::exp(logsiz));
122  size -= size % 8; // all blocks aligned to 64 bit words
123 
124  FEDRawData& feddata = data.FEDData(fedId);
125  // Allocate space for header+trailer+payload
126  feddata.resize(size+16);
127 
128  // Generate header
129  FEDHeader::set(feddata.data(),
130  1, // Trigger type
131  eID.event(), // LV1_id (24 bits)
132  0, // BX_id
133  fedId); // source_id
134 
135  // Payload = all 0s...
136 
137  // Generate trailer
138  int crc = 0; // FIXME : get CRC
139  FEDTrailer::set(feddata.data()+8+size,
140  size/8+2, // in 64 bit words!!!
141  crc,
142  0, // Evt_stat
143  0); // TTS bits
144  }
145 }
unsigned int width
Definition: DaqFakeReader.h:62
EventNumber_t event() const
Definition: EventID.h:44
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:61
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.
int DaqFakeReader::fillRawData ( edm::Event e,
FEDRawDataCollection *&  data 
)
virtual

Definition at line 57 of file DaqFakeReader.cc.

References empty_events, eventNum, fillFED1023(), fillFEDs(), 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, and width.

Referenced by produce().

59 {
60  // a null pointer is passed, need to allocate the fed collection
61  data=new FEDRawDataCollection();
62  EventID eID = e.id();
63 
64  if(!empty_events)
65  {
66 
67  // Fill the EventID
68  eventNum++;
69  // FIXME:
70 
73  eID, *data, meansize, width);
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);
92  fillFED1023(eID,*data);
93  }
94  return 1;
95 }
unsigned int width
Definition: DaqFakeReader.h:62
void fillFED1023(edm::EventID &eID, FEDRawDataCollection &data)
void fillFEDs(const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
unsigned int meansize
Definition: DaqFakeReader.h:61
edm::EventID id() const
Definition: EventBase.h:56
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:59
void DaqFakeReader::produce ( edm::Event e,
edm::EventSetup const &  es 
)
virtual

Implements edm::EDProducer.

Definition at line 97 of file DaqFakeReader.cc.

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

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

97  {
98 
100  FEDRawDataCollection *fedcoll = 0;
101  fillRawData(e,fedcoll);
102  std::auto_ptr<FEDRawDataCollection> bare_product(fedcoll);
103  e.put(bare_product);
104 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual int fillRawData(edm::Event &e, FEDRawDataCollection *&data)
dictionary rawdata
Definition: lumiPlot.py:393

Member Data Documentation

bool DaqFakeReader::empty_events
private

Definition at line 60 of file DaqFakeReader.h.

Referenced by fillRawData().

edm::EventNumber_t DaqFakeReader::eventNum
private

Definition at line 59 of file DaqFakeReader.h.

Referenced by fillRawData().

evf::EvffedFillerRB DaqFakeReader::frb
private

Definition at line 65 of file DaqFakeReader.h.

Referenced by DaqFakeReader(), and fillFED1023().

unsigned int DaqFakeReader::injected_errors_per_million_events
private

Definition at line 63 of file DaqFakeReader.h.

unsigned int DaqFakeReader::meansize
private

Definition at line 61 of file DaqFakeReader.h.

Referenced by fillRawData().

unsigned int DaqFakeReader::modulo_error_events
private

Definition at line 64 of file DaqFakeReader.h.

Referenced by fillFED1023().

edm::RunNumber_t DaqFakeReader::runNum
private

Definition at line 58 of file DaqFakeReader.h.

unsigned int DaqFakeReader::width
private