CMS 3D CMS Logo

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

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

Inheritance diagram for PFCand_AssoMap:
edm::stream::EDProducer<> PFCand_AssoMapAlgos PF_PU_AssoMapAlgos

Public Member Functions

 PFCand_AssoMap (const edm::ParameterSet &)
 
 ~PFCand_AssoMap () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from PFCand_AssoMapAlgos
std::pair< std::unique_ptr< PFCandToVertexAssMap >, std::unique_ptr< VertexToPFCandAssMap > > createMappings (edm::Handle< reco::PFCandidateCollection > pfCandH, const edm::EventSetup &iSetup)
 
std::unique_ptr< PFCandToVertexAssMapCreatePFCandToVertexMap (edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
 
std::unique_ptr< VertexToPFCandAssMapCreateVertexToPFCandMap (edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
 
void GetInputCollections (edm::Event &, const edm::EventSetup &) override
 
 PFCand_AssoMapAlgos (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
std::unique_ptr< PFCandToVertexAssMapSortPFCandAssociationMap (PFCandToVertexAssMap *, edm::EDProductGetter const *getter)
 
- Public Member Functions inherited from PF_PU_AssoMapAlgos
std::pair< std::unique_ptr< TrackToVertexAssMap >, std::unique_ptr< VertexToTrackAssMap > > createMappings (edm::Handle< reco::TrackCollection > trkcollH, const edm::EventSetup &iSetup)
 
std::unique_ptr< TrackToVertexAssMapCreateTrackToVertexMap (edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
 
std::unique_ptr< VertexToTrackAssMapCreateVertexToTrackMap (edm::Handle< reco::TrackCollection >, 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::PFCandidateCollectiontoken_PFCandidates_
 

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
 
- 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 >, const edm::EventSetup &, edm::Handle< reco::BeamSpot >, int)
 

Detailed Description

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

Definition at line 36 of file PFCand_AssoMap.h.

Constructor & Destructor Documentation

◆ PFCand_AssoMap()

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

Definition at line 33 of file PFCand_AssoMap.cc.

33  : PFCand_AssoMapAlgos(iConfig, consumesCollector()) {
34  //now do what ever other initialization is needed
35 
36  input_AssociationType_ = iConfig.getParameter<edm::InputTag>("AssociationType");
37 
39  consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidateCollection"));
40 
41  //register your products
42 
43  if (input_AssociationType_.label() == "PFCandsToVertex") {
44  produces<PFCandToVertexAssMap>();
45  } else {
46  if (input_AssociationType_.label() == "VertexToPFCands") {
47  produces<VertexToPFCandAssMap>();
48  } else {
49  if (input_AssociationType_.label() == "Both") {
50  produces<PFCandToVertexAssMap>();
51  produces<VertexToPFCandAssMap>();
52  } else {
53  std::cout << "No correct InputTag for AssociationType!" << std::endl;
54  std::cout << "Won't produce any AssociationMap!" << std::endl;
55  }
56  }
57  }
58 }

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

◆ ~PFCand_AssoMap()

PFCand_AssoMap::~PFCand_AssoMap ( )
override

Definition at line 60 of file PFCand_AssoMap.cc.

60 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 92 of file PFCand_AssoMap.cc.

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

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

◆ produce()

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

Definition at line 67 of file PFCand_AssoMap.cc.

67  {
68  using namespace edm;
69  using namespace std;
70  using namespace reco;
71 
72  //get the input pfCandidateCollection
74  iEvent.getByToken(token_PFCandidates_, pfCandH);
75 
76  string asstype = input_AssociationType_.label();
77 
79 
80  if (asstype == "PFCandsToVertex" || asstype == "VertexToPFCands" || asstype == "Both") {
81  auto mappings = createMappings(pfCandH, iSetup);
82  if (asstype == "PFCandsToVertex" || asstype == "Both") {
83  iEvent.put(SortPFCandAssociationMap(&(*mappings.first), &iEvent.productGetter()));
84  }
85  if (asstype == "VertexToPFCands" || asstype == "Both") {
86  iEvent.put(std::move(mappings.second));
87  }
88  }
89 }

References PFCand_AssoMapAlgos::createMappings(), PFCand_AssoMapAlgos::GetInputCollections(), iEvent, input_AssociationType_, edm::InputTag::label(), eostools::move(), PFCand_AssoMapAlgos::SortPFCandAssociationMap(), and token_PFCandidates_.

Member Data Documentation

◆ input_AssociationType_

edm::InputTag PFCand_AssoMap::input_AssociationType_
private

Definition at line 48 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().

◆ token_PFCandidates_

edm::EDGetTokenT<reco::PFCandidateCollection> PFCand_AssoMap::token_PFCandidates_
private

Definition at line 50 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().

PFCand_AssoMapAlgos::PFCand_AssoMapAlgos
PFCand_AssoMapAlgos(const edm::ParameterSet &, edm::ConsumesCollector &&)
Definition: PFCand_AssoMapAlgos.cc:14
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
PFCand_AssoMapAlgos::GetInputCollections
void GetInputCollections(edm::Event &, const edm::EventSetup &) override
Definition: PFCand_AssoMapAlgos.cc:27
PFCand_AssoMapAlgos::createMappings
std::pair< std::unique_ptr< PFCandToVertexAssMap >, std::unique_ptr< VertexToPFCandAssMap > > createMappings(edm::Handle< reco::PFCandidateCollection > pfCandH, const edm::EventSetup &iSetup)
Definition: PFCand_AssoMapAlgos.cc:43
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
PFCand_AssoMap::token_PFCandidates_
edm::EDGetTokenT< reco::PFCandidateCollection > token_PFCandidates_
Definition: PFCand_AssoMap.h:50
PFCand_AssoMap::input_AssociationType_
edm::InputTag input_AssociationType_
Definition: PFCand_AssoMap.h:48
iEvent
int iEvent
Definition: GenABIO.cc:224
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
PFCand_AssoMapAlgos::SortPFCandAssociationMap
std::unique_ptr< PFCandToVertexAssMap > SortPFCandAssociationMap(PFCandToVertexAssMap *, edm::EDProductGetter const *getter)
Definition: PFCand_AssoMapAlgos.cc:127
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15