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
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 ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 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
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(), 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
int i
Definition: DBlmapReader.cc:9
EcalFEDWithCRCErrorProducer::~EcalFEDWithCRCErrorProducer ( )

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 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 96 of file EcalFEDWithCRCErrorProducer.cc.

References FEDRawData::data(), AlCaHLTBitMon_QueryRunRegistry::data, DataLabel_, fedUnpackList_, edm::Event::getByLabel(), i, relval_2017::k, edm::Event::put(), lumiPlot::rawdata, FEDRawData::resize(), FEDRawData::size(), and writeAllEcalFEDs_.

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  std::auto_ptr<FEDRawDataCollection> producedData(new 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(producedData);
144 }
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void resize(size_t newsize)
Definition: FEDRawData.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
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
dictionary rawdata
Definition: lumiPlot.py:393

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().