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::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalFEDWithCRCErrorProducer (const edm::ParameterSet &)
 
 ~EcalFEDWithCRCErrorProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 
const EDProduceroperator= (const EDProducer &)=delete
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< FEDRawDataCollectionDataToken_
 
std::vector< int > fedUnpackList_
 
bool writeAllEcalFEDs_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

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

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

Definition at line 44 of file EcalFEDWithCRCErrorProducer.cc.

Constructor & Destructor Documentation

◆ EcalFEDWithCRCErrorProducer()

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

Definition at line 62 of file EcalFEDWithCRCErrorProducer.cc.

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

62  {
63  //now do what ever initialization is needed
64 
65  DataToken_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("InputLabel"));
66  fedUnpackList_ = iConfig.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>());
67  writeAllEcalFEDs_ = iConfig.getUntrackedParameter<bool>("writeAllEcalFED", false);
68  if (fedUnpackList_.empty())
70  fedUnpackList_.push_back(i);
71 
72  produces<FEDRawDataCollection>();
73 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< FEDRawDataCollection > DataToken_
T getUntrackedParameter(std::string const &, T const &) const

◆ ~EcalFEDWithCRCErrorProducer()

EcalFEDWithCRCErrorProducer::~EcalFEDWithCRCErrorProducer ( )
override

Definition at line 75 of file EcalFEDWithCRCErrorProducer.cc.

75  {
76  // do anything here that needs to be done at desctruction time
77  // (e.g. close files, deallocate resources etc.)
78 }

Member Function Documentation

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 85 of file EcalFEDWithCRCErrorProducer.cc.

References FEDRawData::data(), data, DataToken_, FEDRawDataCollection::FEDData(), fedUnpackList_, mps_fire::i, iEvent, dqmdumpme::k, eostools::move(), FEDRawData::resize(), FEDRawData::size(), writeAllEcalFEDs_, and testProducerWithPsetDescEmpty_cfi::x1.

85  {
86  using namespace edm;
87 
88  const edm::Handle<FEDRawDataCollection>& rawdata = iEvent.getHandle(DataToken_);
89 
90  auto producedData = std::make_unique<FEDRawDataCollection>();
91  // get fed raw data and SM id
92 
93  // loop over FEDS
94  for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
95  // get fed raw data and SM id
96  const FEDRawData& fedData = rawdata->FEDData(*i);
97  int length = fedData.size() / sizeof(uint64_t);
98 
99  // LogDebug("EcalRawToDigi") << "raw data length: " << length ;
100  //if data size is not null interpret data
101  if (length >= 1) {
102  uint64_t* pData = (uint64_t*)(fedData.data());
103  //When crc error is found return true
104  uint64_t* fedTrailer = pData + (length - 1);
105  bool crcError = (*fedTrailer >> 2) & 0x1;
106  // this fed has data -- lets copy it
107  if (writeAllEcalFEDs_ || crcError) {
108  FEDRawData& fedDataProd = producedData->FEDData(*i);
109  if (fedDataProd.size() != 0) {
110  // edm::LogVerbatim("EcalTools") << " More than one FEDRawDataCollection with data in FED ";
111  // << j << " Skipping the 2nd";
112  continue;
113  }
114  fedDataProd.resize(fedData.size());
115  unsigned char* dataProd = fedDataProd.data();
116  const unsigned char* data = fedData.data();
117  for (unsigned int k = 0; k < fedData.size(); ++k) {
118  dataProd[k] = data[k];
119  }
120  }
121  }
122  }
123 
124  iEvent.put(std::move(producedData));
125 }
edm::EDGetTokenT< FEDRawDataCollection > DataToken_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:48
int iEvent
Definition: GenABIO.cc:224
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned long long uint64_t
Definition: Time.h:13
void resize(size_t newsize, size_t wordsize=8)
Definition: FEDRawData.cc:28
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ DataToken_

edm::EDGetTokenT<FEDRawDataCollection> EcalFEDWithCRCErrorProducer::DataToken_
private

Definition at line 54 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

◆ fedUnpackList_

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

Definition at line 55 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

◆ writeAllEcalFEDs_

bool EcalFEDWithCRCErrorProducer::writeAllEcalFEDs_
private

Definition at line 56 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().