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 Types | Private Attributes
RawDataCollectorByLabel Class Reference

#include <RawDataCollectorByLabel.h>

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

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c)
 
 RawDataCollectorByLabel (const edm::ParameterSet &pset)
 Constructor. More...
 
virtual ~RawDataCollectorByLabel ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::vector
< edm::InputTag >
::const_iterator 
tag_iterator_t
 

Private Attributes

std::vector< edm::InputTaginputTags_
 
int verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

Definition at line 15 of file RawDataCollectorByLabel.h.

Member Typedef Documentation

typedef std::vector<edm::InputTag>::const_iterator RawDataCollectorByLabel::tag_iterator_t
private

Definition at line 28 of file RawDataCollectorByLabel.h.

Constructor & Destructor Documentation

RawDataCollectorByLabel::RawDataCollectorByLabel ( const edm::ParameterSet pset)

Constructor.

Definition at line 23 of file RawDataCollectorByLabel.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

23  {
24 
25  inputTags_ = pset.getParameter<std::vector<InputTag> >("RawCollectionList");
26  verbose_ = pset.getUntrackedParameter<int>("verbose",0);
27 
28  produces<FEDRawDataCollection>();
29 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag > inputTags_
RawDataCollectorByLabel::~RawDataCollectorByLabel ( )
virtual

Destructor.

Definition at line 31 of file RawDataCollectorByLabel.cc.

31  {
32 
33 }

Member Function Documentation

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

Get Data from all FEDs

Implements edm::EDProducer.

Definition at line 36 of file RawDataCollectorByLabel.cc.

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

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

36  {
37 
39  std::vector< Handle<FEDRawDataCollection> > rawData;
40  for(tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag ) {
42  if (e.getByLabel(*inputTag,input)){
43  rawData.push_back(input);
44  }
45  //else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning }
46  }
47 
48  std::auto_ptr<FEDRawDataCollection> producedData(new FEDRawDataCollection);
49 
50  for (unsigned int i=0; i< rawData.size(); ++i ) {
51 
52  const FEDRawDataCollection *rdc=rawData[i].product();
53 
54  if ( verbose_ > 0 ) {
55  std::cout << "\nRAW collection #" << i+1 << std::endl;
56  std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
57  std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
58  }
59 
60  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) {
61  const FEDRawData & fedData = rdc->FEDData(j);
62  size_t size=fedData.size();
63 
64  if ( size > 0 ) {
65  // this fed has data -- lets copy it
66  if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl;
67  FEDRawData & fedDataProd = producedData->FEDData(j);
68  if ( fedDataProd.size() != 0 ) {
69  if(verbose_ > 1) {
70  std::cout << " More than one FEDRawDataCollection with data in FED ";
71  std::cout << j << " Skipping the 2nd\n";
72  }
73  continue;
74  }
75  fedDataProd.resize(size);
76  unsigned char *dataProd=fedDataProd.data();
77  const unsigned char *data=fedData.data();
78  for ( unsigned int k=0; k<size; ++k ) {
79  dataProd[k]=data[k];
80  }
81  }
82  }
83  }
84 
85  // Insert the new product in the event
86  e.put(producedData);
87 
88 }
int i
Definition: DBlmapReader.cc:9
std::vector< edm::InputTag >::const_iterator tag_iterator_t
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static std::string const input
Definition: EdmProvDump.cc:44
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< edm::InputTag > inputTags_
void resize(size_t newsize)
Definition: FEDRawData.cc:32
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
int k[5][pyjets_maxn]
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
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.

Member Data Documentation

std::vector<edm::InputTag> RawDataCollectorByLabel::inputTags_
private

Definition at line 30 of file RawDataCollectorByLabel.h.

int RawDataCollectorByLabel::verbose_
private

Definition at line 31 of file RawDataCollectorByLabel.h.