![]() |
![]() |
#include <CommonTools/RecoUtils/plugins/PFCand_AssoMap.cc>
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_PFCandidates_ |
Description: Produces a map with association between pf candidates and their particular most probable vertex with a quality of this association
Definition at line 33 of file PFCand_AssoMap.h.
PFCand_AssoMap::PFCand_AssoMap | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 98 of file PFCand_AssoMap.cc.
References edm::ParameterSet::getParameter(), and input_PFCandidates_.
:PF_PU_AssoMapAlgos(iConfig) { //register your products produces<PFCandVertexAssMap>(); //now do what ever other initialization is needed input_PFCandidates_ = iConfig.getParameter<InputTag>("PFCandidateCollection"); }
PFCand_AssoMap::~PFCand_AssoMap | ( | ) |
Definition at line 112 of file PFCand_AssoMap.cc.
{ }
void PFCand_AssoMap::fillDescriptions | ( | edm::ConfigurationDescriptions & | descriptions | ) | [static] |
Reimplemented from edm::EDProducer.
Definition at line 180 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 123 of file PFCand_AssoMap.cc.
References PF_PU_AssoMapAlgos::DoTrackAssociation(), edm::Event::getByLabel(), PF_PU_AssoMapAlgos::GetFirstVertex(), PF_PU_AssoMapAlgos::GetInputCollections(), i, input_PFCandidates_, edm::Ref< C, T, F >::isNull(), edm::Event::put(), PFCand_NoPU_WithAM_Algos::SortAssociationMap(), and CommonMethods::weight().
{ //std::cout << "<PFCand_AssoMap::produce>:" << std::endl; auto_ptr<PFCandVertexAssMap> pfCandAM(new PFCandVertexAssMap() ); //get the input pfCandidateCollection Handle<PFCandidateCollection> pfCandInH; iEvent.getByLabel(input_PFCandidates_,pfCandInH); if ( !PF_PU_AssoMapAlgos::GetInputCollections(iEvent,iSetup) ) return; VertexRef FirstVtxRef = PF_PU_AssoMapAlgos::GetFirstVertex(); for( unsigned i=0; i<pfCandInH->size(); i++ ) { PFCandidateRef candref(pfCandInH, i); float weight; VertexPfcQuality VtxPfcQual; TrackRef PFCtrackref = candref->trackRef(); if ( PFCtrackref.isNull() ){ //the pfcand has no reference to a general track, therefore its mostly uncharged //it will allways be associated to the first vertex, //this was found out to be the best solution w.r.t. jet-pt response //weight set to -3. weight = -3.; VtxPfcQual = make_pair(FirstVtxRef, make_pair(candref, weight)); } else { VertexTrackQuality VtxTrkQual = PF_PU_AssoMapAlgos::DoTrackAssociation(PFCtrackref, iSetup); VtxPfcQual = make_pair(VtxTrkQual.first, make_pair(candref, VtxTrkQual.second.second)); } //std::cout << "associating candidate: Pt = " << VtxPfcQual.second.first->pt() << "," // << " eta = " << VtxPfcQual.second.first->eta() << ", phi = " << VtxPfcQual.second.first->phi() // << " to vertex: z = " << VtxPfcQual.first->position().z() << " with quality q = " << VtxPfcQual.second.second << std::endl; // Insert the best vertex and the pair of candidate and the quality of this association in the map pfCandAM->insert(VtxPfcQual.first, VtxPfcQual.second); } iEvent.put( PFCand_NoPU_WithAM_Algos::SortAssociationMap( &(*pfCandAM) ) ); }
Definition at line 45 of file PFCand_AssoMap.h.
Referenced by PFCand_AssoMap(), and produce().