CMS 3D CMS Logo

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

#include <filter/EcalFEDWithCRCErrorProducer/src/EcalFEDWithCRCErrorProducer.cc>

Inheritance diagram for EcalFEDWithCRCErrorProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalFEDWithCRCErrorProducer (const edm::ParameterSet &)
 
 ~EcalFEDWithCRCErrorProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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 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 & itemsToGetFrom (BranchType iType) 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

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::InputTag DataLabel_
 
std::vector< int > fedUnpackList_
 
bool writeAllEcalFEDs_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 45 of file EcalFEDWithCRCErrorProducer.cc.

Constructor & Destructor Documentation

EcalFEDWithCRCErrorProducer::EcalFEDWithCRCErrorProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 66 of file EcalFEDWithCRCErrorProducer.cc.

References DataLabel_, fedUnpackList_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, FEDNumbering::MAXECALFEDID, FEDNumbering::MINECALFEDID, and writeAllEcalFEDs_.

67 {
68  //now do what ever initialization is needed
69 
70  DataLabel_ = iConfig.getParameter<edm::InputTag>("InputLabel");
71  fedUnpackList_ = iConfig.getUntrackedParameter< std::vector<int> >("FEDs", std::vector<int>());
72  writeAllEcalFEDs_ = iConfig.getUntrackedParameter<bool >("writeAllEcalFED", false);
73  if (fedUnpackList_.empty())
75  fedUnpackList_.push_back(i);
76 
77  produces< FEDRawDataCollection >();
78 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EcalFEDWithCRCErrorProducer::~EcalFEDWithCRCErrorProducer ( )
override

Definition at line 81 of file EcalFEDWithCRCErrorProducer.cc.

82 {
83 
84  // do anything here that needs to be done at desctruction time
85  // (e.g. close files, deallocate resources etc.)
86 
87 }

Member Function Documentation

void EcalFEDWithCRCErrorProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 96 of file EcalFEDWithCRCErrorProducer.cc.

References FEDRawData::data(), data, DataLabel_, DEFINE_FWK_MODULE, FEDRawDataCollection::FEDData(), fedUnpackList_, edm::Event::getByLabel(), mps_fire::i, gen::k, eostools::move(), edm::Event::put(), matplotRender::rawdata, FEDRawData::resize(), FEDRawData::size(), writeAllEcalFEDs_, and globals_cff::x1.

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

97 {
98  using namespace edm;
99 
101  iEvent.getByLabel(DataLabel_,rawdata);
102 
103  auto producedData = std::make_unique<FEDRawDataCollection>();
104  // get fed raw data and SM id
105 
106  // loop over FEDS
107  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++)
108  {
109 
110  // get fed raw data and SM id
111  const FEDRawData & fedData = rawdata->FEDData(*i);
112  int length = fedData.size()/sizeof(uint64_t);
113 
114  // LogDebug("EcalRawToDigi") << "raw data length: " << length ;
115  //if data size is not null interpret data
116  if ( length >= 1 )
117  {
118  uint64_t * pData = (uint64_t *)(fedData.data());
119  //When crc error is found return true
120  uint64_t * fedTrailer = pData + (length - 1);
121  bool crcError = (*fedTrailer >> 2 ) & 0x1;
122  // this fed has data -- lets copy it
123  if (writeAllEcalFEDs_ || crcError)
124  {
125  FEDRawData & fedDataProd = producedData->FEDData(*i);
126  if ( fedDataProd.size() != 0 )
127  {
128  // std::cout << " More than one FEDRawDataCollection with data in FED ";
129  // std::cout << j << " Skipping the 2nd\n";
130  continue;
131  }
132  fedDataProd.resize(fedData.size());
133  unsigned char *dataProd=fedDataProd.data();
134  const unsigned char *data=fedData.data();
135  for ( unsigned int k=0; k<fedData.size(); ++k )
136  {
137  dataProd[k]=data[k];
138  }
139  }
140  }
141  }
142 
143  iEvent.put(std::move(producedData));
144 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:32
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:464
int k[5][pyjets_maxn]
unsigned long long uint64_t
Definition: Time.h:15
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag EcalFEDWithCRCErrorProducer::DataLabel_
private

Definition at line 56 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

std::vector<int> EcalFEDWithCRCErrorProducer::fedUnpackList_
private

Definition at line 57 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

bool EcalFEDWithCRCErrorProducer::writeAllEcalFEDs_
private

Definition at line 58 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().