22 #include "fastjet/PseudoJet.hh"
39 produces<edm::ValueMap<float> > (
"PuppiWeights");
40 produces<edm::ValueMap<LorentzVector> > (
"PuppiP4s");
41 produces<PFOutputCollection>();
65 pReco.
pt = itPF->pt();
66 pReco.
eta = itPF->eta();
67 pReco.
phi = itPF->phi();
68 pReco.
m = itPF->mass();
69 pReco.
charge = itPF->charge();
78 for(reco::VertexCollection::const_iterator iV = pvCol->begin(); iV!=pvCol->end(); ++iV) {
85 if(pDZ > -9999) pVtxId = 0;
87 if(iV->trackWeight(pPF->
trackRef())>0) {
105 if(closestVtx == 0) pReco.
vtxId = -1;
106 if(closestVtx != 0) pReco.
vtxId = pVtxId;
111 if(closestVtx != 0 && pVtxId == 0 && fabs(pReco.
charge) > 0) pReco.
id = 1;
112 if(closestVtx != 0 && pVtxId > 0 && fabs(pReco.
charge) > 0) pReco.
id = 2;
114 if(
fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) <
fDZCut) && fabs(pReco.
charge) > 0) pReco.
id = 1;
115 if(
fUseDZ && pDZ > -9999 && closestVtx == 0 && (fabs(pDZ) >
fDZCut) && fabs(pReco.
charge) > 0) pReco.
id = 2;
128 lPupFiller.
insert(hPFProduct,lWeights.begin(),lWeights.end());
140 const std::vector<fastjet::PseudoJet> lCandidates =
fPuppiContainer->puppiParticles();
144 for (
auto i0 = hPFProduct->begin(),
145 i0begin = hPFProduct->begin(),
146 i0end = hPFProduct->end(); i0 != i0end; ++i0 ) {
154 int val = i0 - i0begin;
157 auto puppiMatched = find_if( lCandidates.begin(), lCandidates.end(), [&val]( fastjet::PseudoJet
const &
i ){
return i.user_index() == val; } );
158 if ( puppiMatched != lCandidates.end() ) {
159 pVec.SetPxPyPzE(puppiMatched->px(),puppiMatched->py(),puppiMatched->pz(),puppiMatched->E());
161 pVec.SetPxPyPzE( 0, 0, 0, 0);
164 puppiP4s.push_back( pVec );
170 p4PupFiller.
insert(hPFProduct,puppiP4s.begin(), puppiP4s.end() );
173 iEvent.
put(lPupOut,
"PuppiWeights");
174 iEvent.
put(p4PupOut,
"PuppiP4s");
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< reco::PFCandidate > PFOutputCollection
#define DEFINE_FWK_MODULE(type)
void insert(const H &h, I begin, I end)
std::vector< RecoObj > fRecoObjCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< LorentzVector > LorentzVectorCollection
math::XYZTLorentzVector LorentzVector
const reco::VertexRef vertexRef() const
std::unique_ptr< PuppiContainer > fPuppiContainer
edm::EDGetTokenT< VertexCollection > tokenVertices_
reco::TrackRef trackRef() const
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
PuppiProducer(const edm::ParameterSet &)
virtual void beginRun(edm::Run &, edm::EventSetup const &)
virtual void endLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParticleType translatePdgIdToType(int pdgid) const
Particle reconstructed by the particle flow algorithm.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
reco::GsfTrackRef gsfTrackRef() const
edm::EDGetTokenT< CandidateView > tokenPFCandidates_
std::auto_ptr< PFOutputCollection > fPuppiCandidates
const_iterator end() const
virtual void endRun(edm::Run &, edm::EventSetup const &)
virtual void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
virtual float dxy() const
dxy with respect to the PV ref
const PVAssoc fromPV() const
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
virtual float dz() const
dz with respect to the PV ref