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::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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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, timeval *now)
 
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
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 35 of file DaqFakeReader.cc.

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

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  frb.setEPProcessId(getpid());
47 }
unsigned int width
Definition: DaqFakeReader.h:64
T getUntrackedParameter(std::string const &, T const &) const
unsigned int modulo_error_events
Definition: DaqFakeReader.h:66
evf::EvffedFillerRB frb
Definition: DaqFakeReader.h:68
unsigned int injected_errors_per_million_events
Definition: DaqFakeReader.h:65
void setEPProcessId(pid_t pid)
unsigned int meansize
Definition: DaqFakeReader.h:63
edm::RunNumber_t runNum
Definition: DaqFakeReader.h:60
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:61
DaqFakeReader::~DaqFakeReader ( )
virtual

Definition at line 50 of file DaqFakeReader.cc.

51 {
52 
53 }

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 204 of file DaqFakeReader.cc.

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

205 {
206  std::cout << "DaqFakeReader begin Lumi " << iL.luminosityBlock() << std::endl;
207  fakeLs_=iL.luminosityBlock();
208 }
unsigned int fakeLs_
Definition: DaqFakeReader.h:67
tuple cout
Definition: gather_cfg.py:121
void DaqFakeReader::fillFED1023 ( edm::EventID eID,
FEDRawDataCollection data,
timeval *  now 
)
private

Definition at line 191 of file DaqFakeReader.cc.

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

Referenced by fillRawData().

193 {
194  FEDRawData& feddata = data.FEDData(frb.fedId());
195  // Allocate space for header+trailer+payload
196  feddata.resize(frb.size());
197  frb.putHeader(eID.event(),0);
198  if(eID.event()%modulo_error_events==0) frb.setDAQDiaWord1(1ll); else frb.setDAQDiaWord1(0ll);
199  frb.setRBTimeStamp(((uint64_t) (now->tv_sec) << 32) + (uint64_t) (now->tv_usec));
200  frb.putTrailer();
201  memcpy(feddata.data(),frb.getPayload(),frb.size());
202 }
EventNumber_t event() const
Definition: EventID.h:41
unsigned int modulo_error_events
Definition: DaqFakeReader.h:66
unsigned int size() const
evf::EvffedFillerRB frb
Definition: DaqFakeReader.h:68
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 116 of file DaqFakeReader.cc.

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

Referenced by fillRawData().

121 {
122 
123  // FIXME: last ID included?
124  for (int fedId = fedmin; fedId <= fedmax; ++fedId ) {
125 
126  // Generate size...
127  float logsiz = CLHEP::RandGauss::shoot(std::log(meansize),
129  size_t size = int(std::exp(logsiz));
130  size -= size % 8; // all blocks aligned to 64 bit words
131 
132  FEDRawData& feddata = data.FEDData(fedId);
133  // Allocate space for header+trailer+payload
134  feddata.resize(size+16);
135 
136  // Generate header
137  FEDHeader::set(feddata.data(),
138  1, // Trigger type
139  eID.event(), // LV1_id (24 bits)
140  0, // BX_id
141  fedId); // source_id
142 
143  // Payload = all 0s...
144 
145  // Generate trailer
146  int crc = 0; // FIXME : get CRC
147  FEDTrailer::set(feddata.data()+8+size,
148  size/8+2, // in 64 bit words!!!
149  crc,
150  0, // Evt_stat
151  0); // TTS bits
152  }
153 }
unsigned int width
Definition: DaqFakeReader.h:64
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:63
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.
tuple log
Definition: cmsBatch.py:341
void DaqFakeReader::fillGTPFED ( edm::EventID eID,
FEDRawDataCollection data,
timeval *  now 
)
private

Definition at line 155 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(), HLT_25ns14e33_v1_cff::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().

157 {
159  FEDRawData& feddata = data.FEDData(fedId);
160  uint32_t size = evf::evtn::SLINK_WORD_SIZE*37-16;//BST52_3BX
161  feddata.resize(size+16);
162 
163  FEDHeader::set(feddata.data(),
164  1, // Trigger type
165  eID.event(), // LV1_id (24 bits)
166  0, // BX_id
167  fedId); // source_id
168 
169  int crc = 0; // FIXME : get CRC
170  FEDTrailer::set(feddata.data()+8+size,
171  size/8+2, // in 64 bit words!!!
172  crc,
173  0, // Evt_stat
174  0); // TTS bits
175 
176  unsigned char * pOffset = feddata.data() + sizeof(fedh_t);
177  //fill in event ID
179  *( (uint32_t*)(pOffset + sizeof(fedh_t) + (9*2 + evf::evtn::EVM_TCS_TRIGNR_OFFSET) * evf::evtn::SLINK_WORD_SIZE / 2)) = eID.event();
180  //fill in timestamp
181  *( (uint32_t*) (pOffset + evf::evtn::EVM_GTFE_BSTGPS_OFFSET * evf::evtn::SLINK_WORD_SIZE / 2)) = now->tv_sec;
182  *( (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;
183 
184  //*( (uint16_t*) (pOffset + (evtn::EVM_GTFE_BLOCK*2 + evtn::EVM_TCS_LSBLNR_OFFSET)*evtn::SLINK_HALFWORD_SIZE)) = (unsigned short)fakeLs_-1;
185 
186  //we could also generate lumiblock, bcr, orbit,... but they are not currently used by the FRD input source
187 
188 }
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 61 of file DaqFakeReader.cc.

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

63 {
64  // a null pointer is passed, need to allocate the fed collection
65  data=new FEDRawDataCollection();
66  EventID eID = e.id();
67 
68  if(!empty_events)
69  {
70 
71  // Fill the EventID
72  eventNum++;
73  // FIXME:
74 
77  eID, *data, meansize, width);
80  eID, *data, meansize, width);
83  eID, *data, meansize, width);
86  eID, *data, meansize, width);
89  eID, *data, meansize, width);
92  eID, *data, meansize, width);
95  eID, *data, meansize, width);
96 
97  timeval now;
98  gettimeofday(&now,0);
99  fillGTPFED(eID, *data,&now);
100  fillFED1023(eID,*data,&now);
101  }
102  return 1;
103 }
unsigned int width
Definition: DaqFakeReader.h:64
void fillFEDs(const int, const int, edm::EventID &eID, FEDRawDataCollection &data, float meansize, float width)
void fillGTPFED(edm::EventID &eID, FEDRawDataCollection &data, timeval *now)
void fillFED1023(edm::EventID &eID, FEDRawDataCollection &data, timeval *now)
unsigned int meansize
Definition: DaqFakeReader.h:63
edm::EventID id() const
Definition: EventBase.h:60
edm::EventNumber_t eventNum
Definition: DaqFakeReader.h:61
void DaqFakeReader::produce ( edm::Event e,
edm::EventSetup const &  es 
)
virtual

Implements edm::EDProducer.

Definition at line 105 of file DaqFakeReader.cc.

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

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

105  {
106 
108  FEDRawDataCollection *fedcoll = 0;
109  fillRawData(e,fedcoll);
110  std::auto_ptr<FEDRawDataCollection> bare_product(fedcoll);
111  e.put(bare_product);
112 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
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 62 of file DaqFakeReader.h.

Referenced by fillRawData().

edm::EventNumber_t DaqFakeReader::eventNum
private

Definition at line 61 of file DaqFakeReader.h.

Referenced by fillRawData().

unsigned int DaqFakeReader::fakeLs_ =0
private

Definition at line 67 of file DaqFakeReader.h.

Referenced by beginLuminosityBlock().

evf::EvffedFillerRB DaqFakeReader::frb
private

Definition at line 68 of file DaqFakeReader.h.

Referenced by DaqFakeReader(), and fillFED1023().

unsigned int DaqFakeReader::injected_errors_per_million_events
private

Definition at line 65 of file DaqFakeReader.h.

unsigned int DaqFakeReader::meansize
private

Definition at line 63 of file DaqFakeReader.h.

Referenced by fillRawData().

unsigned int DaqFakeReader::modulo_error_events
private

Definition at line 66 of file DaqFakeReader.h.

Referenced by fillFED1023().

edm::RunNumber_t DaqFakeReader::runNum
private

Definition at line 60 of file DaqFakeReader.h.

unsigned int DaqFakeReader::width
private