CMS 3D CMS Logo

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

Public Member Functions

 HcalCalibFEDSelector (const edm::ParameterSet &)
 
 ~HcalCalibFEDSelector () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file HcalCalibFEDSelector.cc.

Constructor & Destructor Documentation

◆ HcalCalibFEDSelector()

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

Definition at line 32 of file HcalCalibFEDSelector.cc.

32  {
33  tok_fed_ = consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("rawInputLabel"));
34  extraFEDs_ = iConfig.getParameter<std::vector<int> >("extraFEDsToKeep");
35  produces<FEDRawDataCollection>();
36 }

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

◆ ~HcalCalibFEDSelector()

HcalCalibFEDSelector::~HcalCalibFEDSelector ( )
override

Definition at line 38 of file HcalCalibFEDSelector.cc.

38 {}

Member Function Documentation

◆ beginJob()

void HcalCalibFEDSelector::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 111 of file HcalCalibFEDSelector.cc.

111 {}

◆ endJob()

void HcalCalibFEDSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 114 of file HcalCalibFEDSelector.cc.

114 {}

◆ produce()

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

Implements edm::EDProducer.

Definition at line 40 of file HcalCalibFEDSelector.cc.

40  {
41  auto producedData = std::make_unique<FEDRawDataCollection>();
42 
44  iEvent.getByToken(tok_fed_, rawIn);
45 
46  std::vector<int> selFEDs;
47 
48  //--- Get the list of FEDs to be kept ---//
49  int calibType = -1;
51  const FEDRawData& fedData = rawIn->FEDData(i);
52  if (fedData.size() < 24)
53  continue; // FED is empty
54  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType();
55  if (calibType < 0) {
56  calibType = value;
57  } else {
58  if (calibType != value)
59  edm::LogWarning("HcalCalibFEDSelector") << "Conflicting calibration types found: " << calibType << " vs. "
60  << value << ". Staying with " << calibType;
61  }
62  }
63 
64  HcalFEDList calibFeds(calibType);
65  selFEDs = calibFeds.getListOfFEDs();
66  for (unsigned int i = 0; i < extraFEDs_.size(); i++) {
67  bool duplicate = false;
68  for (unsigned int j = 0; j < selFEDs.size(); j++) {
69  if (extraFEDs_.at(i) == selFEDs.at(j)) {
70  duplicate = true;
71  break;
72  }
73  }
74  if (!duplicate)
75  selFEDs.push_back(extraFEDs_.at(i));
76  }
77 
78  // Copying:
79  const FEDRawDataCollection* rdc = rawIn.product();
80 
81  for (int j = 0; j < FEDNumbering::lastFEDId(); ++j) {
82  bool rightFED = false;
83  for (uint32_t k = 0; k < selFEDs.size(); k++) {
84  if (j == selFEDs[k]) {
85  rightFED = true;
86  }
87  }
88  if (!rightFED)
89  continue;
90  const FEDRawData& fedData = rdc->FEDData(j);
91  size_t size = fedData.size();
92 
93  if (size > 0) {
94  // this fed has data -- lets copy it
95  FEDRawData& fedDataProd = producedData->FEDData(j);
96  if (fedDataProd.size() != 0) {
97  continue;
98  }
99  fedDataProd.resize(size);
100  unsigned char* dataProd = fedDataProd.data();
101  const unsigned char* data = fedData.data();
102  // memcpy is at-least-as-fast as assignment and can be much faster
103  memcpy(dataProd, data, size);
104  }
105  }
106 
107  iEvent.put(std::move(producedData));
108 }

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(), edm::Handle< T >::product(), FEDRawData::resize(), FEDRawData::size(), findQualityFiles::size, tok_fed_, and relativeConstraints::value.

Member Data Documentation

◆ extraFEDs_

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

Definition at line 29 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().

◆ tok_fed_

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

Definition at line 28 of file HcalCalibFEDSelector.cc.

Referenced by HcalCalibFEDSelector(), and produce().

mps_fire.i
i
Definition: mps_fire.py:428
HcalCalibFEDSelector::extraFEDs_
std::vector< int > extraFEDs_
Definition: HcalCalibFEDSelector.cc:29
edm::Handle::product
T const * product() const
Definition: Handle.h:70
FEDNumbering::lastFEDId
static constexpr int lastFEDId()
Definition: FEDNumbering.h:19
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm::Handle< FEDRawDataCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
FEDNumbering::MAXHCALFEDID
Definition: FEDNumbering.h:48
dqmdumpme.k
k
Definition: dqmdumpme.py:60
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
FEDNumbering::MINHCALFEDID
Definition: FEDNumbering.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
HcalFEDList
Definition: HcalFEDList.h:7
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
HcalDCCHeader
Definition: HcalDCCHeader.h:17
eostools.move
def move(src, dest)
Definition: eostools.py:511
HcalCalibFEDSelector::tok_fed_
edm::EDGetTokenT< FEDRawDataCollection > tok_fed_
Definition: HcalCalibFEDSelector.cc:28
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FEDRawData::resize
void resize(size_t newsize)
Definition: FEDRawData.cc:28
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443