CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
RawDataCollectorByLabel Class Reference

#include <RawDataCollectorByLabel.h>

Inheritance diagram for RawDataCollectorByLabel:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

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
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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

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.

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

Definition at line 29 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 HiClusterCompatibility_cfi::inputTag.

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

Destructor.

Definition at line 35 of file RawDataCollectorByLabel.cc.

35  {
36 
37 }

Member Function Documentation

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

Get Data from all FEDs

Definition at line 40 of file RawDataCollectorByLabel.cc.

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

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

40  {
41 
43  std::vector< Handle<FEDRawDataCollection> > rawData;
44  rawData.reserve(inputTokens_.size());
45  for(tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok ) {
47  if (e.getByToken(*inputTok,input)){
48  rawData.push_back(input);
49  }
50  //else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning }
51  }
52 
53  auto producedData = std::make_unique<FEDRawDataCollection>();
54 
55  for (unsigned int i=0; i< rawData.size(); ++i ) {
56 
57  const FEDRawDataCollection *rdc=rawData[i].product();
58 
59  if ( verbose_ > 0 ) {
60  std::cout << "\nRAW collection #" << i+1 << std::endl;
61  std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
62  std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
63  }
64 
65  for ( int j=0; j< FEDNumbering::MAXFEDID; ++j ) {
66  const FEDRawData & fedData = rdc->FEDData(j);
67  size_t size=fedData.size();
68 
69  if ( size > 0 ) {
70  // this fed has data -- lets copy it
71  if(verbose_ > 1) std::cout << "Copying data from FED #" << j << std::endl;
72  FEDRawData & fedDataProd = producedData->FEDData(j);
73  if ( fedDataProd.size() != 0 ) {
74  if(verbose_ > 1) {
75  std::cout << " More than one FEDRawDataCollection with data in FED ";
76  std::cout << j << " Skipping the 2nd\n";
77  }
78  continue;
79  }
80  fedDataProd.resize(size);
81  unsigned char *dataProd=fedDataProd.data();
82  const unsigned char *data=fedData.data();
83  for ( unsigned int k=0; k<size; ++k ) {
84  dataProd[k]=data[k];
85  }
86  }
87  }
88  }
89 
90  // Insert the new product in the event
91  e.put(std::move(producedData));
92 
93 }
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
std::vector< edm::EDGetTokenT< FEDRawDataCollection > >::const_iterator tok_iterator_t
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
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
void resize(size_t newsize)
Definition: FEDRawData.cc:32
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
std::vector< edm::EDGetTokenT< FEDRawDataCollection > > inputTokens_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 31 of file RawDataCollectorByLabel.h.

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

Definition at line 32 of file RawDataCollectorByLabel.h.

int RawDataCollectorByLabel::verbose_
private

Definition at line 33 of file RawDataCollectorByLabel.h.