CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalCalibFEDSelector Class Reference
Inheritance diagram for HcalCalibFEDSelector:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalCalibFEDSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

std::vector< int > extraFEDs_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_fed_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 17 of file HcalCalibFEDSelector.cc.

Constructor & Destructor Documentation

◆ HcalCalibFEDSelector()

HcalCalibFEDSelector::HcalCalibFEDSelector ( const edm::ParameterSet iConfig)

Definition at line 29 of file HcalCalibFEDSelector.cc.

References extraFEDs_, edm::ParameterSet::getParameter(), and tok_fed_.

29  {
30  tok_fed_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"));
31  extraFEDs_ = iConfig.getParameter<std::vector<int> >("extraFEDsToKeep");
32  produces<FEDRawDataCollection>();
33 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > extraFEDs_
edm::EDGetTokenT< FEDRawDataCollection > tok_fed_

Member Function Documentation

◆ produce()

void HcalCalibFEDSelector::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 35 of file HcalCalibFEDSelector.cc.

References FEDRawData::data(), data, extraFEDs_, FEDRawDataCollection::FEDData(), HcalFEDList::getListOfFEDs(), mps_fire::i, iEvent, dqmiolumiharvest::j, dqmdumpme::k, FEDNumbering::lastFEDId(), FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, eostools::move(), FEDRawData::resize(), FEDRawData::size(), findQualityFiles::size, tok_fed_, and relativeConstraints::value.

35  {
36  auto producedData = std::make_unique<FEDRawDataCollection>();
37 
39  iEvent.getByToken(tok_fed_, rawIn);
40 
41  std::vector<int> selFEDs;
42 
43  //--- Get the list of FEDs to be kept ---//
44  int calibType = -1;
46  const FEDRawData& fedData = rawIn->FEDData(i);
47  if (fedData.size() < 24)
48  continue; // FED is empty
49  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType();
50  if (calibType < 0) {
51  calibType = value;
52  } else {
53  if (calibType != value)
54  edm::LogWarning("HcalCalibFEDSelector") << "Conflicting calibration types found: " << calibType << " vs. "
55  << value << ". Staying with " << calibType;
56  }
57  }
58 
59  HcalFEDList calibFeds(calibType);
60  selFEDs = calibFeds.getListOfFEDs();
61  for (unsigned int i = 0; i < extraFEDs_.size(); i++) {
62  bool duplicate = false;
63  for (unsigned int j = 0; j < selFEDs.size(); j++) {
64  if (extraFEDs_.at(i) == selFEDs.at(j)) {
65  duplicate = true;
66  break;
67  }
68  }
69  if (!duplicate)
70  selFEDs.push_back(extraFEDs_.at(i));
71  }
72 
73  // Copying:
74  const FEDRawDataCollection* rdc = rawIn.product();
75 
76  for (int j = 0; j <= FEDNumbering::lastFEDId(); ++j) {
77  bool rightFED = false;
78  for (uint32_t k = 0; k < selFEDs.size(); k++) {
79  if (j == selFEDs[k]) {
80  rightFED = true;
81  }
82  }
83  if (!rightFED)
84  continue;
85  const FEDRawData& fedData = rdc->FEDData(j);
86  size_t size = fedData.size();
87 
88  if (size > 0) {
89  // this fed has data -- lets copy it
90  FEDRawData& fedDataProd = producedData->FEDData(j);
91  if (fedDataProd.size() != 0) {
92  continue;
93  }
94  fedDataProd.resize(size);
95  unsigned char* dataProd = fedDataProd.data();
96  const unsigned char* data = fedData.data();
97  // memcpy is at-least-as-fast as assignment and can be much faster
98  memcpy(dataProd, data, size);
99  }
100  }
101 
102  iEvent.put(std::move(producedData));
103 }
size
Write out results.
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
std::vector< int > extraFEDs_
int iEvent
Definition: GenABIO.cc:224
void resize(size_t newsize)
Definition: FEDRawData.cc:28
edm::EDGetTokenT< FEDRawDataCollection > tok_fed_
Definition: value.py:1
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
Log< level::Warning, false > LogWarning
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ extraFEDs_

std::vector<int> HcalCalibFEDSelector::extraFEDs_
private

Definition at line 26 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().

◆ tok_fed_

edm::EDGetTokenT<FEDRawDataCollection> HcalCalibFEDSelector::tok_fed_
private

Definition at line 25 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().