CMS 3D CMS Logo

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

Public Member Functions

void globalBeginRunProduce (edm::Run &iRun, edm::EventSetup const &iSetup) const override
 
 HcalDetIdTableProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::StreamID, edm::Event &, edm::EventSetup const &) const override
 
- Public Member Functions inherited from edm::global::EDProducer< edm::BeginRunProducer >
 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 Attributes

edm::EDPutTokenT< std::vector< HcalDetId > > hbDetIdListToken_
 
edm::EDPutTokenT< std::vector< HcalDetId > > heDetIdListToken_
 
edm::EDPutTokenT< std::vector< HcalDetId > > hfDetIdListToken_
 
edm::EDPutTokenT< std::vector< HcalDetId > > hoDetIdListToken_
 
edm::ESGetToken< HcalDbService, HcalDbRecordtokenHcalDbService_
 

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 25 of file HcalDetIdTableProducer.cc.

Constructor & Destructor Documentation

◆ HcalDetIdTableProducer()

HcalDetIdTableProducer::HcalDetIdTableProducer ( const edm::ParameterSet iConfig)
inlineexplicit

Definition at line 34 of file HcalDetIdTableProducer.cc.

References edm::BeginRun, hbDetIdListToken_, heDetIdListToken_, hfDetIdListToken_, and hoDetIdListToken_.

35  : tokenHcalDbService_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
36  hbDetIdListToken_ = produces<std::vector<HcalDetId>, edm::Transition::BeginRun>("HBDetIdList");
37  heDetIdListToken_ = produces<std::vector<HcalDetId>, edm::Transition::BeginRun>("HEDetIdList");
38  hfDetIdListToken_ = produces<std::vector<HcalDetId>, edm::Transition::BeginRun>("HFDetIdList");
39  hoDetIdListToken_ = produces<std::vector<HcalDetId>, edm::Transition::BeginRun>("HODetIdList");
40 
41  produces<nanoaod::FlatTable, edm::Transition::BeginRun>("HBDetIdList");
42  produces<nanoaod::FlatTable, edm::Transition::BeginRun>("HEDetIdList");
43  produces<nanoaod::FlatTable, edm::Transition::BeginRun>("HFDetIdList");
44  produces<nanoaod::FlatTable, edm::Transition::BeginRun>("HODetIdList");
45  };
edm::EDPutTokenT< std::vector< HcalDetId > > hbDetIdListToken_
edm::EDPutTokenT< std::vector< HcalDetId > > heDetIdListToken_
edm::EDPutTokenT< std::vector< HcalDetId > > hfDetIdListToken_
edm::ESGetToken< HcalDbService, HcalDbRecord > tokenHcalDbService_
edm::EDPutTokenT< std::vector< HcalDetId > > hoDetIdListToken_

Member Function Documentation

◆ globalBeginRunProduce()

void HcalDetIdTableProducer::globalBeginRunProduce ( edm::Run iRun,
edm::EventSetup const &  iSetup 
) const
override

Definition at line 53 of file HcalDetIdTableProducer.cc.

References HcalElectronicsMap::allPrecisionId(), mps_fire::end, edm::EventSetup::getHandle(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, eostools::move(), edm::Run::put(), jetUpdater_cfi::sort, HcalDetId::subdet(), subdetNames, fireworks::subdets, and tokenHcalDbService_.

53  {
54  // Setup products
55  const std::vector<HcalSubdetector> subdets = {HcalBarrel, HcalEndcap, HcalForward, HcalOuter};
56  std::map<HcalSubdetector, std::unique_ptr<std::vector<HcalDetId>>> didLists;
57  didLists[HcalBarrel] = std::make_unique<std::vector<HcalDetId>>();
58  didLists[HcalEndcap] = std::make_unique<std::vector<HcalDetId>>();
59  didLists[HcalForward] = std::make_unique<std::vector<HcalDetId>>();
60  didLists[HcalOuter] = std::make_unique<std::vector<HcalDetId>>();
61 
62  // Load channels from emap
63  edm::ESHandle<HcalDbService> dbService = iSetup.getHandle(tokenHcalDbService_);
64  HcalElectronicsMap const* emap = dbService->getHcalMapping();
65 
66  std::vector<HcalGenericDetId> alldids = emap->allPrecisionId();
67  for (auto it_did = alldids.begin(); it_did != alldids.end(); ++it_did) {
68  if (!it_did->isHcalDetId()) {
69  continue;
70  }
71  HcalDetId did = HcalDetId(it_did->rawId());
72  if (!(did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward ||
73  did.subdet() == HcalOuter)) {
74  continue;
75  }
76 
77  // TODO: Add filtering, for example on FED whitelist
78 
79  didLists[did.subdet()]->push_back(did);
80  }
81 
82  // Sort HcalDetIds
83  for (auto& it_subdet : subdets) {
84  std::sort(didLists[it_subdet]->begin(), didLists[it_subdet]->end());
85  }
86 
87  // Make NanoAOD tables
88  std::map<HcalSubdetector, std::string> subdetNames = {
89  {HcalBarrel, "HB"}, {HcalEndcap, "HE"}, {HcalForward, "HF"}, {HcalOuter, "HO"}};
90 
91  for (auto& it_subdet : subdets) {
92  auto didTable =
93  std::make_unique<nanoaod::FlatTable>(didLists[it_subdet]->size(), subdetNames[it_subdet], false, false);
94 
95  std::vector<int> vdids;
96  for (auto& it_did : *(didLists[it_subdet])) {
97  vdids.push_back(it_did.rawId());
98  }
99  didTable->addColumn<int>("did", vdids, "HcalDetId");
100 
101  iRun.put(std::move(didTable), subdetNames[it_subdet] + "DetIdList");
102  iRun.put(std::move(didLists[it_subdet]), subdetNames[it_subdet] + "DetIdList");
103  }
104 }
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
void put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Run.h:109
edm::ESGetToken< HcalDbService, HcalDbRecord > tokenHcalDbService_
std::vector< HcalGenericDetId > allPrecisionId() const
static const std::string subdets[7]
Definition: TrackUtils.cc:60
def move(src, dest)
Definition: eostools.py:511
static const char * subdetNames[]

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 51 of file HcalDetIdTableProducer.cc.

51 {}

Member Data Documentation

◆ hbDetIdListToken_

edm::EDPutTokenT<std::vector<HcalDetId> > HcalDetIdTableProducer::hbDetIdListToken_
private

Definition at line 28 of file HcalDetIdTableProducer.cc.

Referenced by HcalDetIdTableProducer().

◆ heDetIdListToken_

edm::EDPutTokenT<std::vector<HcalDetId> > HcalDetIdTableProducer::heDetIdListToken_
private

Definition at line 29 of file HcalDetIdTableProducer.cc.

Referenced by HcalDetIdTableProducer().

◆ hfDetIdListToken_

edm::EDPutTokenT<std::vector<HcalDetId> > HcalDetIdTableProducer::hfDetIdListToken_
private

Definition at line 30 of file HcalDetIdTableProducer.cc.

Referenced by HcalDetIdTableProducer().

◆ hoDetIdListToken_

edm::EDPutTokenT<std::vector<HcalDetId> > HcalDetIdTableProducer::hoDetIdListToken_
private

Definition at line 31 of file HcalDetIdTableProducer.cc.

Referenced by HcalDetIdTableProducer().

◆ tokenHcalDbService_

edm::ESGetToken<HcalDbService, HcalDbRecord> HcalDetIdTableProducer::tokenHcalDbService_
private

Definition at line 27 of file HcalDetIdTableProducer.cc.

Referenced by globalBeginRunProduce().