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 Attributes
RawDataCollectorModule Class Reference

#include <RawDataCollectorModule.h>

Inheritance diagram for RawDataCollectorModule:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c)
 
 RawDataCollectorModule (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~RawDataCollectorModule ()
 Destructor. More...
 
- 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 Attributes

bool useCurrentProcessOnly_
 

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

Definition at line 12 of file RawDataCollectorModule.h.

Constructor & Destructor Documentation

RawDataCollectorModule::RawDataCollectorModule ( const edm::ParameterSet pset)

Constructor.

Definition at line 23 of file RawDataCollectorModule.cc.

References edm::ParameterSet::getParameter().

23  {
24 
25  useCurrentProcessOnly_ = pset.getParameter<bool>("currentProcessOnly") ;
26 
27  produces<FEDRawDataCollection>();
28 }
T getParameter(std::string const &) const
RawDataCollectorModule::~RawDataCollectorModule ( )
virtual

Destructor.

Definition at line 30 of file RawDataCollectorModule.cc.

30  {
31 
32 }

Member Function Documentation

void RawDataCollectorModule::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Get Data from all FEDs

Implements edm::EDProducer.

Definition at line 35 of file RawDataCollectorModule.cc.

References gather_cfg::cout, FEDRawData::data(), data, FEDRawDataCollection::FEDData(), edm::Event::getManyByType(), i, j, gen::k, FEDNumbering::MAXFEDID, edm::Event::processHistory(), edm::Event::put(), edm::ProcessHistory::rbegin(), FEDRawData::resize(), FEDRawData::size(), and findQualityFiles::size.

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

35  {
36 
38  std::vector< Handle<FEDRawDataCollection> > rawData;
39  e.getManyByType(rawData);
40 
41  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
42 
43  for (unsigned int i=0; i< rawData.size(); ++i ) {
44 
45  const FEDRawDataCollection *rdc=rawData[i].product();
46 
48  ( rawData[i].provenance()->processName() != e.processHistory().rbegin()->processName() ) )
49  continue ; // skip all raw collections not produced by the current process
50 
51  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) {
52  const FEDRawData & fedData = rdc->FEDData(j);
53  size_t size=fedData.size();
54 
55  if ( size > 0 ) {
56  // this fed has data -- lets copy it
57  FEDRawData & fedDataProd = producedData->FEDData(j);
58  if ( fedDataProd.size() != 0 ) {
59  std::cout << " More than one FEDRawDataCollection with data in FED ";
60  std::cout << j << " Skipping the 2nd\n";
61  continue;
62  }
63  fedDataProd.resize(size);
64  unsigned char *dataProd=fedDataProd.data();
65  const unsigned char *data=fedData.data();
66  for ( unsigned int k=0; k<size; ++k ) {
67  dataProd[k]=data[k];
68  }
69  }
70  }
71  }
72 
73  // Insert the new product in the event
74  e.put(producedData);
75 
76 }
const_reverse_iterator rbegin() const
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:408
int i
Definition: DBlmapReader.cc:9
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
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
int j
Definition: DBlmapReader.cc:9
int k[5][pyjets_maxn]
virtual ProcessHistory const & processHistory() const
Definition: Event.cc:180
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
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.

Member Data Documentation

bool RawDataCollectorModule::useCurrentProcessOnly_
private

Definition at line 25 of file RawDataCollectorModule.h.