CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Attributes
RawDataCollectorByLabel Class Reference

#include <RawDataCollectorByLabel.h>

Inheritance diagram for RawDataCollectorByLabel:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c) override
 
 RawDataCollectorByLabel (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~RawDataCollectorByLabel () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 

Private Types

typedef std::vector
< edm::InputTag >
::const_iterator 
tag_iterator_t
 
typedef std::vector
< edm::EDGetTokenT
< FEDRawDataCollection >
>::const_iterator 
tok_iterator_t
 

Private Attributes

std::vector< edm::InputTaginputTags_
 
std::vector< edm::EDGetTokenT
< FEDRawDataCollection > > 
inputTokens_
 
int verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 14 of file RawDataCollectorByLabel.h.

Member Typedef Documentation

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

Definition at line 25 of file RawDataCollectorByLabel.h.

typedef std::vector<edm::EDGetTokenT<FEDRawDataCollection> >::const_iterator RawDataCollectorByLabel::tok_iterator_t
private

Definition at line 26 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(), edm::ParameterSet::getUntrackedParameter(), and beam_dqm_sourceclient-live_cfg::inputTag.

23  {
24  inputTags_ = pset.getParameter<std::vector<InputTag> >("RawCollectionList");
25  verbose_ = pset.getUntrackedParameter<int>("verbose", 0);
26 
27  inputTokens_.reserve(inputTags_.size());
28  for (tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag) {
29  inputTokens_.push_back(consumes<FEDRawDataCollection>(*inputTag));
30  }
31  produces<FEDRawDataCollection>();
32 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag >::const_iterator tag_iterator_t
std::vector< edm::InputTag > inputTags_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
RawDataCollectorByLabel::~RawDataCollectorByLabel ( )
override

Destructor.

Definition at line 34 of file RawDataCollectorByLabel.cc.

34 {}

Member Function Documentation

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

Get Data from all FEDs

Definition at line 36 of file RawDataCollectorByLabel.cc.

References gather_cfg::cout, FEDRawData::data(), data, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), mps_fire::i, input, dqmiolumiharvest::j, isotrackApplyRegressor::k, FEDNumbering::MAXFEDID, eostools::move(), edm::Event::put(), FEDRawData::resize(), FEDRawData::size(), and findQualityFiles::size.

36  {
38  std::vector<Handle<FEDRawDataCollection> > rawData;
39  rawData.reserve(inputTokens_.size());
40  for (tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok) {
42  if (e.getByToken(*inputTok, 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  auto producedData = std::make_unique<FEDRawDataCollection>();
49 
50  for (unsigned int i = 0; i < rawData.size(); ++i) {
51  const FEDRawDataCollection *rdc = rawData[i].product();
52 
53  if (verbose_ > 0) {
54  std::cout << "\nRAW collection #" << i + 1 << std::endl;
55  std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
56  std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
57  }
58 
59  for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
60  const FEDRawData &fedData = rdc->FEDData(j);
61  size_t size = fedData.size();
62 
63  if (size > 0) {
64  // this fed has data -- lets copy it
65  if (verbose_ > 1)
66  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(std::move(producedData));
87 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
static std::string const input
Definition: EdmProvDump.cc:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void resize(size_t newsize)
Definition: FEDRawData.cc:28
def move
Definition: eostools.py:511
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
tuple cout
Definition: gather_cfg.py:144
tuple size
Write out results.
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_

Member Data Documentation

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

Definition at line 28 of file RawDataCollectorByLabel.h.

std::vector<edm::EDGetTokenT<FEDRawDataCollection> > RawDataCollectorByLabel::inputTokens_
private

Definition at line 29 of file RawDataCollectorByLabel.h.

int RawDataCollectorByLabel::verbose_
private

Definition at line 30 of file RawDataCollectorByLabel.h.