CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PF_PU_AssoMap Class Reference

#include <CommonTools/RecoUtils/plugins/PFCand_NoPU_WithAM.cc>

Inheritance diagram for PF_PU_AssoMap:
edm::stream::EDProducer<> PF_PU_AssoMapAlgos edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PF_PU_AssoMap (const edm::ParameterSet &)
 
 ~PF_PU_AssoMap () override
 
- 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)
 
- Public Member Functions inherited from PF_PU_AssoMapAlgos
std::auto_ptr< TrackToVertexAssMapCreateTrackToVertexMap (edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
 
std::auto_ptr< VertexToTrackAssMapCreateVertexToTrackMap (edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
 
virtual void GetInputCollections (edm::Event &, const edm::EventSetup &)
 
 PF_PU_AssoMapAlgos (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 PF_PU_AssoMapAlgos (const edm::ParameterSet &, edm::ConsumesCollector &)
 
std::unique_ptr< TrackToVertexAssMapSortAssociationMap (TrackToVertexAssMap *)
 
virtual ~PF_PU_AssoMapAlgos ()(false)
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

edm::InputTag input_AssociationType_
 
edm::EDGetTokenT< reco::TrackCollectiontoken_TrackCollection_
 

Additional Inherited Members

- 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
 
- 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)
 
- Protected Member Functions inherited from PF_PU_AssoMapAlgos
std::vector< reco::VertexRef > * CreateVertexVector (edm::Handle< reco::VertexCollection >)
 
int DefineQuality (int, int, double)
 
void EraseVertex (std::vector< reco::VertexRef > *, reco::VertexRef)
 
VertexStepPair FindAssociation (const reco::TrackRef &, std::vector< reco::VertexRef > *, edm::ESHandle< MagneticField >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
 

Detailed Description

Description: Produces a map with association between tracks and their particular most probable vertex with a quality of this association

Description: Produces collection of tracks associated to the first vertex based on the pf_pu Association Map

Description: Produces a collection of PFCandidates associated to the first vertex based on the association map

Definition at line 41 of file PF_PU_AssoMap.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file PF_PU_AssoMap.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), input_AssociationType_, edm::InputTag::label(), and token_TrackCollection_.

27 {
28 
29  //now do what ever other initialization is needed
30 
31  input_AssociationType_ = iConfig.getParameter<edm::InputTag>("AssociationType");
32 
33  token_TrackCollection_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("TrackCollection"));
34 
35  //register your products
36 
37  if ( input_AssociationType_.label() == "TracksToVertex" ) {
38  produces<TrackToVertexAssMap>();
39  } else {
40  if ( input_AssociationType_.label() == "VertexToTracks" ) {
41  produces<VertexToTrackAssMap>();
42  } else {
43  if ( input_AssociationType_.label() == "Both" ) {
44  produces<TrackToVertexAssMap>();
45  produces<VertexToTrackAssMap>();
46  } else {
47  std::cout << "No correct InputTag for AssociationType!" << std::endl;
48  std::cout << "Won't produce any AssociationMap!" << std::endl;
49  }
50  }
51  }
52 
53 
54 }
T getParameter(std::string const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
PF_PU_AssoMapAlgos(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< reco::TrackCollection > token_TrackCollection_
Definition: PF_PU_AssoMap.h:55
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag input_AssociationType_
Definition: PF_PU_AssoMap.h:53
PF_PU_AssoMap::~PF_PU_AssoMap ( )
override

Definition at line 57 of file PF_PU_AssoMap.cc.

58 {
59 
60  // do anything here that needs to be done at destruction time
61  // (e.g. close files, deallocate resources etc.)
62 
63 }

Member Function Documentation

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

Definition at line 102 of file PF_PU_AssoMap.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

102  {
103  //The following says we do not know what parameters are allowed so do no validation
104  // Please change this to state exactly what you do use, even if it is no parameters
106  desc.setUnknown();
107  descriptions.addDefault(desc);
108 }
void addDefault(ParameterSetDescription const &psetDescription)
void PF_PU_AssoMap::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 72 of file PF_PU_AssoMap.cc.

References PF_PU_AssoMapAlgos::CreateTrackToVertexMap(), PF_PU_AssoMapAlgos::CreateVertexToTrackMap(), edm::Event::getByToken(), PF_PU_AssoMapAlgos::GetInputCollections(), input_AssociationType_, edm::InputTag::label(), eostools::move(), edm::Event::put(), PF_PU_AssoMapAlgos::SortAssociationMap(), and token_TrackCollection_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

73 {
74 
75  using namespace edm;
76  using namespace std;
77  using namespace reco;
78 
79 
80  //get the input track collection
81  Handle<TrackCollection> trkcollH;
82  iEvent.getByToken(token_TrackCollection_, trkcollH);
83 
84  string asstype = input_AssociationType_.label();
85 
87 
88  if ( ( asstype == "TracksToVertex" ) || ( asstype == "Both" ) ) {
89  unique_ptr<TrackToVertexAssMap> Track2Vertex = CreateTrackToVertexMap(trkcollH, iSetup);
90  iEvent.put( SortAssociationMap( &(*Track2Vertex) ) );
91  }
92 
93  if ( ( asstype == "VertexToTracks" ) || ( asstype == "Both" ) ) {
94  unique_ptr<VertexToTrackAssMap> Vertex2Track = CreateVertexToTrackMap(trkcollH, iSetup);
95  iEvent.put(std::move(Vertex2Track));
96  }
97 
98 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
std::unique_ptr< TrackToVertexAssMap > SortAssociationMap(TrackToVertexAssMap *)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::auto_ptr< TrackToVertexAssMap > CreateTrackToVertexMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< reco::TrackCollection > token_TrackCollection_
Definition: PF_PU_AssoMap.h:55
std::string const & label() const
Definition: InputTag.h:36
fixed size matrix
HLT enums.
edm::InputTag input_AssociationType_
Definition: PF_PU_AssoMap.h:53
std::auto_ptr< VertexToTrackAssMap > CreateVertexToTrackMap(edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::InputTag PF_PU_AssoMap::input_AssociationType_
private

Definition at line 53 of file PF_PU_AssoMap.h.

Referenced by PF_PU_AssoMap(), and produce().

edm::EDGetTokenT<reco::TrackCollection> PF_PU_AssoMap::token_TrackCollection_
private

Definition at line 55 of file PF_PU_AssoMap.h.

Referenced by PF_PU_AssoMap(), and produce().