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

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from PF_PU_AssoMapAlgos
std::vector< reco::VertexRefCreateVertexVector (edm::Handle< reco::VertexCollection >)
 
int DefineQuality (int, int, double)
 
void EraseVertex (std::vector< reco::VertexRef > &, reco::VertexRef)
 
VertexStepPair FindAssociation (const reco::TrackRef &, const std::vector< reco::VertexRef > &, edm::ESHandle< MagneticField >, edm::ESHandle< GlobalTrackingGeometry >, 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 40 of file PF_PU_AssoMap.h.

Constructor & Destructor Documentation

◆ PF_PU_AssoMap()

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

Definition at line 26 of file PF_PU_AssoMap.cc.

26  : PF_PU_AssoMapAlgos(iConfig, consumesCollector()) {
27  //now do what ever other initialization is needed
28 
29  input_AssociationType_ = iConfig.getParameter<edm::InputTag>("AssociationType");
30 
31  token_TrackCollection_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("TrackCollection"));
32 
33  //register your products
34 
35  if (input_AssociationType_.label() == "TracksToVertex") {
36  produces<TrackToVertexAssMap>();
37  } else {
38  if (input_AssociationType_.label() == "VertexToTracks") {
39  produces<VertexToTrackAssMap>();
40  } else {
41  if (input_AssociationType_.label() == "Both") {
42  produces<TrackToVertexAssMap>();
43  produces<VertexToTrackAssMap>();
44  } else {
45  std::cout << "No correct InputTag for AssociationType!" << std::endl;
46  std::cout << "Won't produce any AssociationMap!" << std::endl;
47  }
48  }
49  }
50 }

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

◆ ~PF_PU_AssoMap()

PF_PU_AssoMap::~PF_PU_AssoMap ( )
override

Definition at line 52 of file PF_PU_AssoMap.cc.

52  {
53  // do anything here that needs to be done at destruction time
54  // (e.g. close files, deallocate resources etc.)
55 }

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 87 of file PF_PU_AssoMap.cc.

87  {
88  //The following says we do not know what parameters are allowed so do no validation
89  // Please change this to state exactly what you do use, even if it is no parameters
91  desc.setUnknown();
92  descriptions.addDefault(desc);
93 }

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

◆ produce()

void PF_PU_AssoMap::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 62 of file PF_PU_AssoMap.cc.

62  {
63  using namespace edm;
64  using namespace std;
65  using namespace reco;
66 
67  //get the input track collection
68  Handle<TrackCollection> trkcollH;
69  iEvent.getByToken(token_TrackCollection_, trkcollH);
70 
71  string asstype = input_AssociationType_.label();
72 
74 
75  if (asstype == "TracksToVertex" || asstype == "VertexToTracks" || asstype == "Both") {
76  auto mappings = createMappings(trkcollH);
77  if (asstype == "TracksToVertex" || asstype == "Both") {
78  iEvent.put(SortAssociationMap(&(*mappings.first), trkcollH));
79  }
80  if (asstype == "VertexToTracks" || asstype == "Both") {
81  iEvent.put(std::move(mappings.second));
82  }
83  }
84 }

References PF_PU_AssoMapAlgos::createMappings(), PF_PU_AssoMapAlgos::GetInputCollections(), iEvent, input_AssociationType_, edm::InputTag::label(), eostools::move(), PF_PU_AssoMapAlgos::SortAssociationMap(), and token_TrackCollection_.

Member Data Documentation

◆ input_AssociationType_

edm::InputTag PF_PU_AssoMap::input_AssociationType_
private

Definition at line 52 of file PF_PU_AssoMap.h.

Referenced by PF_PU_AssoMap(), and produce().

◆ token_TrackCollection_

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

Definition at line 54 of file PF_PU_AssoMap.h.

Referenced by PF_PU_AssoMap(), and produce().

PF_PU_AssoMapAlgos::createMappings
std::pair< std::unique_ptr< TrackToVertexAssMap >, std::unique_ptr< VertexToTrackAssMap > > createMappings(edm::Handle< reco::TrackCollection > trkcollH)
Definition: PF_PU_AssoMapAlgos.cc:109
edm
HLT enums.
Definition: AlignableModifier.h:19
PF_PU_AssoMapAlgos::GetInputCollections
virtual void GetInputCollections(edm::Event &, const edm::EventSetup &)
Definition: PF_PU_AssoMapAlgos.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
edm::Handle
Definition: AssociativeIterator.h:50
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
PF_PU_AssoMap::token_TrackCollection_
edm::EDGetTokenT< reco::TrackCollection > token_TrackCollection_
Definition: PF_PU_AssoMap.h:54
iEvent
int iEvent
Definition: GenABIO.cc:224
PF_PU_AssoMapAlgos::SortAssociationMap
std::unique_ptr< TrackToVertexAssMap > SortAssociationMap(TrackToVertexAssMap *, edm::Handle< reco::TrackCollection >)
Definition: PF_PU_AssoMapAlgos.cc:178
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PF_PU_AssoMapAlgos::PF_PU_AssoMapAlgos
PF_PU_AssoMapAlgos(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
Definition: PF_PU_AssoMapAlgos.h:87
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
PF_PU_AssoMap::input_AssociationType_
edm::InputTag input_AssociationType_
Definition: PF_PU_AssoMap.h:52