CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 edm::stream::EDProducerBase PF_PU_AssoMapAlgos edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFCand_AssoMap (const edm::ParameterSet &)
 
 ~PFCand_AssoMap ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 
- Public Member Functions inherited from PFCand_AssoMapAlgos
std::auto_ptr
< PFCandToVertexAssMap
CreatePFCandToVertexMap (edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
 
std::auto_ptr
< VertexToPFCandAssMap
CreateVertexToPFCandMap (edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
 
void GetInputCollections (edm::Event &, const edm::EventSetup &)
 
 PFCand_AssoMapAlgos (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
std::auto_ptr
< PFCandToVertexAssMap
SortPFCandAssociationMap (PFCandToVertexAssMap *, edm::EDProductGetter const *getter)
 
- Public Member Functions inherited from PF_PU_AssoMapAlgos
std::auto_ptr
< TrackToVertexAssMap
CreateTrackToVertexMap (edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
 
std::auto_ptr
< VertexToTrackAssMap
CreateVertexToTrackMap (edm::Handle< reco::TrackCollection >, const edm::EventSetup &)
 
 PF_PU_AssoMapAlgos (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 
 PF_PU_AssoMapAlgos (const edm::ParameterSet &, edm::ConsumesCollector &)
 
std::auto_ptr
< TrackToVertexAssMap
SortAssociationMap (TrackToVertexAssMap *)
 

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

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

Private Attributes

edm::InputTag input_AssociationType_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
token_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 pf candidates and their particular most probable vertex with a quality of this association

Definition at line 37 of file PFCand_AssoMap.h.

Constructor & Destructor Documentation

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

Definition at line 33 of file PFCand_AssoMap.cc.

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

34 {
35 
36  //now do what ever other initialization is needed
37 
38  input_AssociationType_ = iConfig.getParameter<edm::InputTag>("AssociationType");
39 
40  token_PFCandidates_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidateCollection"));
41 
42  //register your products
43 
44  if ( input_AssociationType_.label() == "PFCandsToVertex" ) {
45  produces<PFCandToVertexAssMap>();
46  } else {
47  if ( input_AssociationType_.label() == "VertexToPFCands" ) {
48  produces<VertexToPFCandAssMap>();
49  } else {
50  if ( input_AssociationType_.label() == "Both" ) {
51  produces<PFCandToVertexAssMap>();
52  produces<VertexToPFCandAssMap>();
53  } else {
54  std::cout << "No correct InputTag for AssociationType!" << std::endl;
55  std::cout << "Won't produce any AssociationMap!" << std::endl;
56  }
57  }
58  }
59 
60 }
T getParameter(std::string const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::InputTag input_AssociationType_
edm::EDGetTokenT< reco::PFCandidateCollection > token_PFCandidates_
std::string const & label() const
Definition: InputTag.h:43
tuple cout
Definition: gather_cfg.py:121
PFCand_AssoMapAlgos(const edm::ParameterSet &, edm::ConsumesCollector &&)
PFCand_AssoMap::~PFCand_AssoMap ( )

Definition at line 63 of file PFCand_AssoMap.cc.

64 {
65 }

Member Function Documentation

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

Definition at line 103 of file PFCand_AssoMap.cc.

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

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

Implements edm::stream::EDProducerBase.

Definition at line 74 of file PFCand_AssoMap.cc.

References PFCand_AssoMapAlgos::CreatePFCandToVertexMap(), PFCand_AssoMapAlgos::CreateVertexToPFCandMap(), edm::Event::getByToken(), PFCand_AssoMapAlgos::GetInputCollections(), input_AssociationType_, edm::InputTag::label(), edm::Event::productGetter(), edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, PFCand_AssoMapAlgos::SortPFCandAssociationMap(), and token_PFCandidates_.

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

75 {
76 
77  using namespace edm;
78  using namespace std;
79  using namespace reco;
80 
81  //get the input pfCandidateCollection
83  iEvent.getByToken(token_PFCandidates_,pfCandH);
84 
85  string asstype = input_AssociationType_.label();
86 
88 
89  if ( ( asstype == "PFCandsToVertex" ) || ( asstype == "Both" ) ) {
90  auto_ptr<PFCandToVertexAssMap> PFCand2Vertex = CreatePFCandToVertexMap(pfCandH, iSetup);
91  iEvent.put( SortPFCandAssociationMap( &(*PFCand2Vertex), &iEvent.productGetter() ) );
92  }
93 
94  if ( ( asstype == "VertexToPFCands" ) || ( asstype == "Both" ) ) {
95  auto_ptr<VertexToPFCandAssMap> Vertex2PFCand = CreateVertexToPFCandMap(pfCandH, iSetup);
96  iEvent.put( Vertex2PFCand );
97  }
98 
99 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
EDProductGetter const & productGetter() const
Definition: Event.cc:53
std::auto_ptr< PFCandToVertexAssMap > SortPFCandAssociationMap(PFCandToVertexAssMap *, edm::EDProductGetter const *getter)
std::auto_ptr< VertexToPFCandAssMap > CreateVertexToPFCandMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
std::auto_ptr< PFCandToVertexAssMap > CreatePFCandToVertexMap(edm::Handle< reco::PFCandidateCollection >, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
edm::InputTag input_AssociationType_
edm::EDGetTokenT< reco::PFCandidateCollection > token_PFCandidates_
void GetInputCollections(edm::Event &, const edm::EventSetup &)
std::string const & label() const
Definition: InputTag.h:43

Member Data Documentation

edm::InputTag PFCand_AssoMap::input_AssociationType_
private

Definition at line 49 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().

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

Definition at line 51 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().