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::ProductRegistryHelper

Public Member Functions

 EcalFEDWithCRCErrorProducer (const edm::ParameterSet &)
 
 ~EcalFEDWithCRCErrorProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

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

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

Definition at line 46 of file EcalFEDWithCRCErrorProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 67 of file EcalFEDWithCRCErrorProducer.cc.

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

68 {
69  //now do what ever initialization is needed
70 
71  DataLabel_ = iConfig.getParameter<edm::InputTag>("InputLabel");
72  fedUnpackList_ = iConfig.getUntrackedParameter< std::vector<int> >("FEDs", std::vector<int>());
73  writeAllEcalFEDs_ = iConfig.getUntrackedParameter<bool >("writeAllEcalFED", false);
74  if (fedUnpackList_.empty())
76  fedUnpackList_.push_back(i);
77 
78  produces< FEDRawDataCollection >();
79 }
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 82 of file EcalFEDWithCRCErrorProducer.cc.

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

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 97 of file EcalFEDWithCRCErrorProducer.cc.

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

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

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

Member Data Documentation

edm::InputTag EcalFEDWithCRCErrorProducer::DataLabel_
private

Definition at line 57 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

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

Definition at line 58 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().

bool EcalFEDWithCRCErrorProducer::writeAllEcalFEDs_
private

Definition at line 59 of file EcalFEDWithCRCErrorProducer.cc.

Referenced by EcalFEDWithCRCErrorProducer(), and produce().