CMS 3D CMS Logo

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::EDProducer PFCand_AssoMapAlgos edm::ProducerBase edm::EDConsumerBase PF_PU_AssoMapAlgos edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PFCand_AssoMap (const edm::ParameterSet &)
 ~PFCand_AssoMap ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

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

Private Attributes

edm::InputTag input_AssociationType_
edm::InputTag input_PFCandidates_

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_, input_PFCandidates_, and edm::InputTag::label().

                                                            :PFCand_AssoMapAlgos(iConfig)
{

   //now do what ever other initialization is needed

        input_AssociationType_ = iConfig.getParameter<edm::InputTag>("AssociationType");

        input_PFCandidates_ = iConfig.getParameter<edm::InputTag>("PFCandidateCollection");

   //register your products

        if ( input_AssociationType_.label() == "PFCandsToVertex" ) {
          produces<PFCandToVertexAssMap>();
        } else {
          if ( input_AssociationType_.label() == "VertexToPFCands" ) {
            produces<VertexToPFCandAssMap>();
          } else {
            if ( input_AssociationType_.label() == "Both" ) {
              produces<PFCandToVertexAssMap>();
              produces<VertexToPFCandAssMap>();
            } else {
              std::cout << "No correct InputTag for AssociationType!" << std::endl;
              std::cout << "Won't produce any AssociationMap!" << std::endl;
            }
          }
        }
  
}
PFCand_AssoMap::~PFCand_AssoMap ( )

Definition at line 63 of file PFCand_AssoMap.cc.

{
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 103 of file PFCand_AssoMap.cc.

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

                                                                           {
  //The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}
void PFCand_AssoMap::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 74 of file PFCand_AssoMap.cc.

References PFCand_AssoMapAlgos::CreatePFCandToVertexMap(), PFCand_AssoMapAlgos::CreateVertexToPFCandMap(), edm::Event::getByLabel(), PFCand_AssoMapAlgos::GetInputCollections(), input_AssociationType_, input_PFCandidates_, edm::InputTag::label(), edm::Event::put(), L1Trigger_dataformats::reco, and PFCand_AssoMapAlgos::SortPFCandAssociationMap().

{

  using namespace edm;
  using namespace std;
  using namespace reco;
  
        //get the input pfCandidateCollection
        Handle<PFCandidateCollection> pfCandH;
        iEvent.getByLabel(input_PFCandidates_,pfCandH);
        
        string asstype = input_AssociationType_.label();

        PFCand_AssoMapAlgos::GetInputCollections(iEvent,iSetup);

        if ( ( asstype == "PFCandsToVertex" ) || ( asstype == "Both" ) ) {
          auto_ptr<PFCandToVertexAssMap> PFCand2Vertex = CreatePFCandToVertexMap(pfCandH, iSetup);
          iEvent.put( SortPFCandAssociationMap( &(*PFCand2Vertex) ) );
        }
 
        if ( ( asstype == "VertexToPFCands" ) || ( asstype == "Both" ) ) {
          auto_ptr<VertexToPFCandAssMap> Vertex2PFCand = CreateVertexToPFCandMap(pfCandH, iSetup);
          iEvent.put( Vertex2PFCand );  
        }

}

Member Data Documentation

Definition at line 49 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().

Definition at line 51 of file PFCand_AssoMap.h.

Referenced by PFCand_AssoMap(), and produce().