CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
TemplatedVertexArbitrator< InputContainer, VTX > Class Template Reference

#include <TemplatedVertexArbitrator.h>

Inheritance diagram for TemplatedVertexArbitrator< InputContainer, VTX >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< VTX > Product
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase 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
 

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es) override
 
 TemplatedVertexArbitrator (const edm::ParameterSet &params)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::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
 
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)
 
virtual ~ProducerBase () noexcept(false)
 
- 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
 
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::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

std::unique_ptr< TrackVertexArbitration< VTX > > theArbitrator
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::VertexCollectiontoken_primaryVertex
 
edm::EDGetTokenT< Producttoken_secondaryVertex
 
edm::EDGetTokenT< InputContainer > token_tracks
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

template<class InputContainer, class VTX>
class TemplatedVertexArbitrator< InputContainer, VTX >

Definition at line 52 of file TemplatedVertexArbitrator.h.

Member Typedef Documentation

template<class InputContainer , class VTX >
typedef std::vector<VTX> TemplatedVertexArbitrator< InputContainer, VTX >::Product

Definition at line 54 of file TemplatedVertexArbitrator.h.

Constructor & Destructor Documentation

template<class InputContainer , class VTX >
TemplatedVertexArbitrator< InputContainer, VTX >::TemplatedVertexArbitrator ( const edm::ParameterSet params)

Definition at line 72 of file TemplatedVertexArbitrator.h.

References edm::ParameterSet::getParameter(), TemplatedVertexArbitrator< InputContainer, VTX >::theArbitrator, TemplatedVertexArbitrator< InputContainer, VTX >::token_beamSpot, TemplatedVertexArbitrator< InputContainer, VTX >::token_primaryVertex, TemplatedVertexArbitrator< InputContainer, VTX >::token_secondaryVertex, and TemplatedVertexArbitrator< InputContainer, VTX >::token_tracks.

73 {
74  token_primaryVertex = consumes<reco::VertexCollection>(params.getParameter<edm::InputTag>("primaryVertices"));
75  token_secondaryVertex = consumes<Product>(params.getParameter<edm::InputTag>("secondaryVertices"));
76  token_beamSpot = consumes<reco::BeamSpot>(params.getParameter<edm::InputTag>("beamSpot"));
77  token_tracks = consumes<InputContainer>(params.getParameter<edm::InputTag>("tracks"));
78  produces<Product>();
79  theArbitrator.reset( new TrackVertexArbitration<VTX>(params) );
80 }
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
T getParameter(std::string const &) const
edm::EDGetTokenT< Product > token_secondaryVertex
std::unique_ptr< TrackVertexArbitration< VTX > > theArbitrator
edm::EDGetTokenT< InputContainer > token_tracks
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex

Member Function Documentation

template<class InputContainer , class VTX >
void TemplatedVertexArbitrator< InputContainer, VTX >::produce ( edm::Event event,
const edm::EventSetup es 
)
overridevirtual

Definition at line 83 of file TemplatedVertexArbitrator.h.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, tthelpers::buildTT(), edm::EventSetup::get(), eostools::move(), nTracks(), jets_cff::primaryVertices, edm::Handle< T >::product(), MetAnalyzer::pv(), lostTracks_cfi::secondaryVertices, trackingPlots::selectedTracks, TemplatedVertexArbitrator< InputContainer, VTX >::theArbitrator, TemplatedVertexArbitrator< InputContainer, VTX >::token_beamSpot, TemplatedVertexArbitrator< InputContainer, VTX >::token_primaryVertex, TemplatedVertexArbitrator< InputContainer, VTX >::token_secondaryVertex, TemplatedVertexArbitrator< InputContainer, VTX >::token_tracks, HiIsolationCommonParameters_cff::track, and l1t::tracks.

84 {
85  using namespace reco;
86 
88  event.getByToken(token_secondaryVertex, secondaryVertices);
89  Product theSecVertexColl = *(secondaryVertices.product());
90 
92  event.getByToken(token_primaryVertex, primaryVertices);
93 
94  auto recoVertices = std::make_unique<Product>();
95  if(primaryVertices->size()!=0){
96  const reco::Vertex &pv = (*primaryVertices)[0];
97 
99  event.getByToken(token_tracks, tracks);
100 
102  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
103  trackBuilder);
104 
106  event.getByToken(token_beamSpot,beamSpot);
107 
108  std::vector<TransientTrack> selectedTracks;
109  for(typename InputContainer::const_iterator track = tracks->begin();
110  track != tracks->end(); ++track) {
111  selectedTracks.push_back(tthelpers::buildTT(tracks,trackBuilder,track - tracks->begin()));
112  }
113 
114 
115  // const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
116  Product theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, selectedTracks,
117  theSecVertexColl);
118 
119  for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
120  if ( !(nTracks(theRecoVertices[ivtx]) > 1) ) continue;
121  recoVertices->push_back(theRecoVertices[ivtx]);
122  }
123 
124  }
125  event.put(std::move(recoVertices));
126 
127 
128 
129 }
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
const unsigned int nTracks(const reco::Vertex &sv)
edm::EDGetTokenT< Product > token_secondaryVertex
std::unique_ptr< TrackVertexArbitration< VTX > > theArbitrator
edm::EDGetTokenT< InputContainer > token_tracks
def pv(vc)
Definition: MetAnalyzer.py:6
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
T const * product() const
Definition: Handle.h:81
primaryVertices
Definition: jets_cff.py:100
const T & get() const
Definition: EventSetup.h:55
fixed size matrix
reco::TransientTrack buildTT(edm::Handle< reco::TrackCollection > &tracks, edm::ESHandle< TransientTrackBuilder > &trackbuilder, unsigned int k)
Definition: TTHelpers.h:8
def move(src, dest)
Definition: eostools.py:510
template<class InputContainer , class VTX >
bool TemplatedVertexArbitrator< InputContainer, VTX >::trackFilter ( const reco::TrackRef track) const
private

Member Data Documentation

template<class InputContainer , class VTX >
std::unique_ptr<TrackVertexArbitration<VTX> > TemplatedVertexArbitrator< InputContainer, VTX >::theArbitrator
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<reco::BeamSpot> TemplatedVertexArbitrator< InputContainer, VTX >::token_beamSpot
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<reco::VertexCollection> TemplatedVertexArbitrator< InputContainer, VTX >::token_primaryVertex
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<Product> TemplatedVertexArbitrator< InputContainer, VTX >::token_secondaryVertex
private
template<class InputContainer , class VTX >
edm::EDGetTokenT<InputContainer> TemplatedVertexArbitrator< InputContainer, VTX >::token_tracks
private