CMS 3D CMS Logo

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

Public Member Functions

 AllHitToTracksterAssociatorsProducer (const edm::ParameterSet &)
 
 ~AllHitToTracksterAssociatorsProducer () override=default
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
bool wantsStreamLuminosityBlocks () const noexcept final
 
bool wantsStreamRuns () const noexcept 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< std::unordered_map< DetId, const unsigned int > > hitMapToken_
 
std::vector< edm::EDGetTokenT< HGCRecHitCollection > > hitsTokens_
 
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layerClustersToken_
 
std::vector< std::pair< std::string, edm::EDGetTokenT< std::vector< ticl::Trackster > > > > tracksterCollectionTokens_
 

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
 
- 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 15 of file AllHitToTracksterAssociatorsProducer.cc.

Constructor & Destructor Documentation

◆ AllHitToTracksterAssociatorsProducer()

AllHitToTracksterAssociatorsProducer::AllHitToTracksterAssociatorsProducer ( const edm::ParameterSet pset)
explicit

Definition at line 31 of file AllHitToTracksterAssociatorsProducer.cc.

References hitsTokens_, muonDTDigis_cfi::pset, makeGlobalPositionRcd_cfg::tag, ticlDumper_cff::tracksterCollections, and tracksterCollectionTokens_.

32  : layerClustersToken_(consumes<std::vector<reco::CaloCluster>>(pset.getParameter<edm::InputTag>("layerClusters"))),
34  consumes<std::unordered_map<DetId, const unsigned int>>(pset.getParameter<edm::InputTag>("hitMapTag"))) {
35  const auto& tracksterCollections = pset.getParameter<std::vector<edm::InputTag>>("tracksterCollections");
36  for (const auto& tag : tracksterCollections) {
37  tracksterCollectionTokens_.emplace_back(tag.label() + tag.instance(), consumes<std::vector<ticl::Trackster>>(tag));
38  }
39 
40  for (const auto& tag : pset.getParameter<std::vector<edm::InputTag>>("hits")) {
41  hitsTokens_.emplace_back(consumes<HGCRecHitCollection>(tag));
42  }
43 
44  for (const auto& tracksterToken : tracksterCollectionTokens_) {
45  produces<ticl::AssociationMap<ticl::mapWithFraction>>("hitTo" + tracksterToken.first);
46  produces<ticl::AssociationMap<ticl::mapWithFraction>>(tracksterToken.first + "ToHit");
47  }
48 }
std::vector< edm::EDGetTokenT< HGCRecHitCollection > > hitsTokens_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::unordered_map< DetId, const unsigned int > > hitMapToken_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layerClustersToken_
std::vector< std::pair< std::string, edm::EDGetTokenT< std::vector< ticl::Trackster > > > > tracksterCollectionTokens_

◆ ~AllHitToTracksterAssociatorsProducer()

AllHitToTracksterAssociatorsProducer::~AllHitToTracksterAssociatorsProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void AllHitToTracksterAssociatorsProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 96 of file AllHitToTracksterAssociatorsProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

96  {
98  desc.add<std::vector<edm::InputTag>>("tracksterCollections",
99  {edm::InputTag("ticlTrackstersCLUE3DHigh"),
100  edm::InputTag("ticlTrackstersLinks"),
101  edm::InputTag("ticlCandidate")});
102  desc.add<edm::InputTag>("layerClusters", edm::InputTag("hgcalMergeLayerClusters"));
103  desc.add<edm::InputTag>("hitMapTag", edm::InputTag("recHitMapProducer", "hgcalRecHitMap"));
104  desc.add<std::vector<edm::InputTag>>("hits",
105  {edm::InputTag("HGCalRecHit", "HGCEERecHits"),
106  edm::InputTag("HGCalRecHit", "HGCHEFRecHits"),
107  edm::InputTag("HGCalRecHit", "HGCHEBRecHits")});
108  descriptions.add("AllHitToTracksterAssociatorsProducer", desc);
109 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 50 of file AllHitToTracksterAssociatorsProducer.cc.

References MultiVectorManager< T >::addVector(), HLT_2024v14_cff::fraction, hitMapToken_, hitsTokens_, TSToSimTSAssociationByHits_cfi::hitToTracksterMap, iEvent, dqmiolumiharvest::j, hltTiclCandidate_cfi::layer_clusters, layerClustersToken_, eostools::move(), MultiVectorManager< T >::size(), unpackBuffers-CaloStage2::token, tracksterCollectionTokens_, HitToTracksterAssociation_cfi::tracksters, and TSToSimTSAssociationByHits_cfi::tracksterToHitMap.

50  {
51  using namespace edm;
52 
55 
57  iEvent.getByToken(hitMapToken_, hitMap);
58 
59  MultiVectorManager<HGCRecHit> rechitManager;
60  for (const auto& token : hitsTokens_) {
61  Handle<HGCRecHitCollection> hitsHandle;
62  iEvent.getByToken(token, hitsHandle);
63  rechitManager.addVector(*hitsHandle);
64  }
65 
66  for (const auto& tracksterToken : tracksterCollectionTokens_) {
68  iEvent.getByToken(tracksterToken.second, tracksters);
69 
70  auto hitToTracksterMap = std::make_unique<ticl::AssociationMap<ticl::mapWithFraction>>(rechitManager.size());
71  auto tracksterToHitMap = std::make_unique<ticl::AssociationMap<ticl::mapWithFraction>>(tracksters->size());
72 
73  for (unsigned int tracksterId = 0; tracksterId < tracksters->size(); ++tracksterId) {
74  const auto& trackster = (*tracksters)[tracksterId];
75  for (unsigned int j = 0; j < trackster.vertices().size(); ++j) {
76  const auto& lc = (*layer_clusters)[trackster.vertices()[j]];
77  float invMultiplicity = 1.0f / trackster.vertex_multiplicity()[j];
78 
79  for (const auto& hitAndFraction : lc.hitsAndFractions()) {
80  auto hitMapIter = hitMap->find(hitAndFraction.first);
81  if (hitMapIter != hitMap->end()) {
82  unsigned int rechitIndex = hitMapIter->second;
83  float fraction = hitAndFraction.second * invMultiplicity;
84  hitToTracksterMap->insert(rechitIndex, tracksterId, fraction);
85  tracksterToHitMap->insert(tracksterId, rechitIndex, fraction);
86  }
87  }
88  }
89  }
90 
91  iEvent.put(std::move(hitToTracksterMap), "hitTo" + tracksterToken.first);
92  iEvent.put(std::move(tracksterToHitMap), tracksterToken.first + "ToHit");
93  }
94 }
std::vector< edm::EDGetTokenT< HGCRecHitCollection > > hitsTokens_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::unordered_map< DetId, const unsigned int > > hitMapToken_
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layerClustersToken_
void addVector(std::span< const T > vec)
HLT enums.
std::vector< std::pair< std::string, edm::EDGetTokenT< std::vector< ticl::Trackster > > > > tracksterCollectionTokens_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ hitMapToken_

edm::EDGetTokenT<std::unordered_map<DetId, const unsigned int> > AllHitToTracksterAssociatorsProducer::hitMapToken_
private

Definition at line 27 of file AllHitToTracksterAssociatorsProducer.cc.

Referenced by produce().

◆ hitsTokens_

std::vector<edm::EDGetTokenT<HGCRecHitCollection> > AllHitToTracksterAssociatorsProducer::hitsTokens_
private

◆ layerClustersToken_

edm::EDGetTokenT<std::vector<reco::CaloCluster> > AllHitToTracksterAssociatorsProducer::layerClustersToken_
private

Definition at line 26 of file AllHitToTracksterAssociatorsProducer.cc.

Referenced by produce().

◆ tracksterCollectionTokens_

std::vector<std::pair<std::string, edm::EDGetTokenT<std::vector<ticl::Trackster> > > > AllHitToTracksterAssociatorsProducer::tracksterCollectionTokens_
private