CMS 3D CMS Logo

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

#include <VertexProducer.h>

Inheritance diagram for VertexProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 VertexProducer (const edm::ParameterSet &)
 
 ~VertexProducer () override
 
- 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 Types

typedef edm::View< TTTrack< Ref_Phase2TrackerDigi_ > > TTTrackCollectionView
 

Private Member Functions

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

Private Attributes

const edm::EDGetTokenT< TTTrackCollectionViewl1TracksToken_
 
const std::string outputCollectionName_
 
l1tVertexFinder::AlgoSettings settings_
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::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 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<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 30 of file VertexProducer.h.

Member Typedef Documentation

◆ TTTrackCollectionView

Definition at line 36 of file VertexProducer.h.

Constructor & Destructor Documentation

◆ VertexProducer()

VertexProducer::VertexProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 19 of file VertexProducer.cc.

References outputCollectionName_, settings_, and l1tVertexFinder::AlgoSettings::vx_algo().

20  : l1TracksToken_(consumes<TTTrackCollectionView>(iConfig.getParameter<edm::InputTag>("l1TracksInputTag"))),
21  tTopoToken(esConsumes<TrackerTopology, TrackerTopologyRcd>()),
22  outputCollectionName_(iConfig.getParameter<std::string>("l1VertexCollectionName")),
23  settings_(AlgoSettings(iConfig)) {
24  // Get configuration parameters
25 
26  switch (settings_.vx_algo()) {
27  case Algorithm::fastHisto:
28  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using the fastHisto binning algorithm";
29  break;
30  case Algorithm::fastHistoEmulation:
31  edm::LogInfo("VertexProducer")
32  << "VertexProducer::Finding vertices using the emulation version of the fastHisto binning algorithm";
33  break;
34  case Algorithm::fastHistoLooseAssociation:
35  edm::LogInfo("VertexProducer")
36  << "VertexProducer::Finding vertices using the fastHistoLooseAssociation binning algorithm";
37  break;
38  case Algorithm::GapClustering:
39  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a gap clustering algorithm";
40  break;
41  case Algorithm::agglomerativeHierarchical:
42  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a Simple Merge Clustering algorithm";
43  break;
44  case Algorithm::DBSCAN:
45  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a DBSCAN algorithm";
46  break;
47  case Algorithm::PVR:
48  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a PVR algorithm";
49  break;
50  case Algorithm::adaptiveVertexReconstruction:
51  edm::LogInfo("VertexProducer")
52  << "VertexProducer::Finding vertices using an AdaptiveVertexReconstruction algorithm";
53  break;
54  case Algorithm::HPV:
55  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a Highest Pt Vertex algorithm";
56  break;
57  case Algorithm::Kmeans:
58  edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using a kmeans algorithm";
59  break;
60  }
61 
62  //--- Define EDM output to be written to file (if required)
63  if (settings_.vx_algo() == Algorithm::fastHistoEmulation) {
64  produces<l1t::VertexWordCollection>(outputCollectionName_ + "Emulation");
65  } else {
66  produces<l1t::VertexCollection>(outputCollectionName_);
67  }
68 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
const std::string outputCollectionName_
Log< level::Info, false > LogInfo
const edm::EDGetTokenT< TTTrackCollectionView > l1TracksToken_
Algorithm vx_algo() const
Definition: AlgoSettings.h:34
l1tVertexFinder::AlgoSettings settings_

◆ ~VertexProducer()

VertexProducer::~VertexProducer ( )
inlineoverride

Definition at line 33 of file VertexProducer.h.

33 {}

Member Function Documentation

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 70 of file VertexProducer.cc.

References l1tVertexFinder::VertexFinder::adaptiveVertexReconstruction(), l1tVertexFinder::VertexFinder::agglomerativeHierarchicalClustering(), l1tVertexFinder::VertexFinder::DBSCAN(), l1tVertexFinder::VertexFinder::fastHisto(), l1tVertexFinder::VertexFinder::fastHistoEmulation(), l1tVertexFinder::VertexFinder::fastHistoLooseAssociation(), l1tVertexFinder::VertexFinder::findPrimaryVertex(), l1tVertexFinder::VertexFinder::GapClustering(), edm::EventSetup::getData(), l1tVertexFinder::VertexFinder::HPV(), iEvent, l1tVertexFinder::VertexFinder::Kmeans(), hltEgammaEleL1TrkIsoL1Seeded_cfi::l1Tracks, eostools::move(), l1tVertexFinder::VertexFinder::PVR(), l1tVertexFinder::VertexFinder::sortVerticesInPt(), HLT_2022v12_cff::track, l1tVertexFinder::VertexFinder::vertices(), l1tVertexFinder::VertexFinder::verticesEmulation(), and extraflags_cff::vtx.

70  {
72  iEvent.getByToken(l1TracksToken_, l1TracksHandle);
73 
74  std::vector<l1tVertexFinder::L1Track> l1Tracks;
75  l1Tracks.reserve(l1TracksHandle->size());
76  if (settings_.debug() > 1) {
77  edm::LogInfo("VertexProducer") << "produce::Processing " << l1TracksHandle->size() << " tracks";
78  }
79  for (const auto& track : l1TracksHandle->ptrs()) {
80  auto l1track = L1Track(track);
81  // Check the minimum pT of the tracks
82  // This is left here because it represents the smallest pT to be sent by the track finding boards
83  // This has less to do with the algorithms than the constraints of what will be sent to the vertexing algorithm
84  if (l1track.pt() >= settings_.vx_TrackMinPt()) {
85  l1Tracks.push_back(l1track);
86  } else {
87  if (settings_.debug() > 2) {
88  edm::LogInfo("VertexProducer") << "produce::Removing track with too low of a pt (" << l1track.pt() << ")\n"
89  << " word = " << l1track.getTTTrackPtr()->getTrackWord().to_string(2);
90  }
91  }
92  }
93  if (settings_.debug() > 1) {
94  edm::LogInfo("VertexProducer") << "produce::Processing " << l1Tracks.size() << " tracks after minimum pt cut of"
95  << settings_.vx_TrackMinPt() << " GeV";
96  }
97 
99 
100  switch (settings_.vx_algo()) {
101  case Algorithm::fastHisto: {
102  const TrackerTopology& tTopo = iSetup.getData(tTopoToken);
103  vf.fastHisto(&tTopo);
104  break;
105  }
106  case Algorithm::fastHistoEmulation:
107  vf.fastHistoEmulation();
108  break;
109  case Algorithm::fastHistoLooseAssociation:
110  vf.fastHistoLooseAssociation();
111  break;
112  case Algorithm::GapClustering:
113  vf.GapClustering();
114  break;
115  case Algorithm::agglomerativeHierarchical:
116  vf.agglomerativeHierarchicalClustering();
117  break;
118  case Algorithm::DBSCAN:
119  vf.DBSCAN();
120  break;
121  case Algorithm::PVR:
122  vf.PVR();
123  break;
124  case Algorithm::adaptiveVertexReconstruction:
125  vf.adaptiveVertexReconstruction();
126  break;
127  case Algorithm::HPV:
128  vf.HPV();
129  break;
130  case Algorithm::Kmeans:
131  vf.Kmeans();
132  break;
133  }
134 
135  vf.sortVerticesInPt();
136  vf.findPrimaryVertex();
137 
138  // //=== Store output EDM track and hardware stub collections.
139  if (settings_.vx_algo() == Algorithm::fastHistoEmulation) {
140  std::unique_ptr<l1t::VertexWordCollection> product_emulation =
141  std::make_unique<l1t::VertexWordCollection>(vf.verticesEmulation().begin(), vf.verticesEmulation().end());
142  iEvent.put(std::move(product_emulation), outputCollectionName_ + "Emulation");
143  } else {
144  std::unique_ptr<l1t::VertexCollection> product(new std::vector<l1t::Vertex>());
145  for (const auto& vtx : vf.vertices()) {
146  product->emplace_back(vtx.vertex());
147  }
148  iEvent.put(std::move(product), outputCollectionName_);
149  }
150 }
std::vector< Ptr< value_type > > const & ptrs() const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
size_type size() const
const std::string outputCollectionName_
unsigned int debug() const
Definition: AlgoSettings.h:77
int iEvent
Definition: GenABIO.cc:224
bool getData(T &iHolder) const
Definition: EventSetup.h:122
Log< level::Info, false > LogInfo
const edm::EDGetTokenT< TTTrackCollectionView > l1TracksToken_
TTTrack< Ref_Phase2TrackerDigi_ > L1Track
Definition: L1Track.h:8
Algorithm vx_algo() const
Definition: AlgoSettings.h:34
def move(src, dest)
Definition: eostools.py:511
l1tVertexFinder::AlgoSettings settings_

Member Data Documentation

◆ l1TracksToken_

const edm::EDGetTokenT<TTTrackCollectionView> VertexProducer::l1TracksToken_
private

Definition at line 41 of file VertexProducer.h.

◆ outputCollectionName_

const std::string VertexProducer::outputCollectionName_
private

Definition at line 43 of file VertexProducer.h.

Referenced by VertexProducer().

◆ settings_

l1tVertexFinder::AlgoSettings VertexProducer::settings_
private

Definition at line 45 of file VertexProducer.h.

Referenced by VertexProducer().

◆ tTopoToken

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> VertexProducer::tTopoToken
private

Definition at line 42 of file VertexProducer.h.