84 const reco::VertexCollection::const_iterator vtxEnd = pvCol->end();
85 for (reco::VertexCollection::const_iterator vtxIter = pvCol->begin(); vtxEnd != vtxIter; ++vtxIter) {
95 pReco.
pt = itPF->pt();
96 pReco.
eta = itPF->eta();
97 pReco.
phi = itPF->phi();
98 pReco.
m = itPF->mass();
100 pReco.
charge = itPF->charge();
107 if(lPack ==
nullptr ) {
111 int closestVtxForUnassociateds = -9999;
112 for(reco::VertexCollection::const_iterator iV = pvCol->begin(); iV!=pvCol->end(); ++iV) {
119 if(pDZ > -9999) pVtxId = 0;
121 if(iV->trackWeight(pPF->
trackRef())>0) {
126 double tmpdz = 99999;
131 closestVtxForUnassociateds = pVtxId;
138 if (closestVtx !=
nullptr &&
std::abs(pReco.
charge) > 0 && pVtxId > 0) tmpFromPV = 0;
139 if (closestVtx !=
nullptr &&
std::abs(pReco.
charge) > 0 && pVtxId == 0) tmpFromPV = 3;
140 if (closestVtx ==
nullptr &&
std::abs(pReco.
charge) > 0 && closestVtxForUnassociateds == 0) tmpFromPV = 2;
141 if (closestVtx ==
nullptr &&
std::abs(pReco.
charge) > 0 && closestVtxForUnassociateds != 0) tmpFromPV = 1;
147 if (tmpFromPV == 0){ pReco.
id = 2; }
148 if (tmpFromPV == 3){ pReco.
id = 1; }
149 if (tmpFromPV == 1 || tmpFromPV == 2){
167 if (lPack->
fromPV() == 0){ pReco.
id = 2; }
186 std::vector<double> lWeights;
187 std::vector<fastjet::PseudoJet> lCandidates;
198 float curpupweight = -1.;
199 if(lPack ==
nullptr ) {
207 lWeights.push_back(curpupweight);
208 fastjet::PseudoJet curjet( curpupweight*lPack->
px(), curpupweight*lPack->
py(), curpupweight*lPack->
pz(), curpupweight*lPack->
energy());
209 curjet.set_user_index(lPackCtr);
210 lCandidates.push_back(curjet);
218 lPupFiller.insert(hPFProduct,lWeights.begin(),lWeights.end());
234 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
236 for (
auto i0 = hPFProduct->
begin(),
237 i0begin = hPFProduct->
begin(),
238 i0end = hPFProduct->
end(); i0 != i0end; ++i0 ) {
239 std::unique_ptr<pat::PackedCandidate> pCand;
240 std::unique_ptr<reco::PFCandidate> pfCand;
252 int val = i0 - i0begin;
255 auto puppiMatched = find_if( lCandidates.begin(), lCandidates.end(), [&
val]( fastjet::PseudoJet
const &
i ){
return i.user_index() ==
val; } );
256 if ( puppiMatched != lCandidates.end() ) {
257 pVec.SetPxPyPzE(puppiMatched->px(),puppiMatched->py(),puppiMatched->pz(),puppiMatched->E());
259 pVec.SetPxPyPzE( 0, 0, 0, 0);
261 puppiP4s.push_back( pVec );
265 pCand->setSourceCandidatePtr( i0->sourceCandidatePtr(0) );
269 pfCand->setSourceCandidatePtr( i0->sourceCandidatePtr(0) );
276 p4PupFiller.insert(hPFProduct,puppiP4s.begin(), puppiP4s.end() );
283 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
289 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
306 std::unique_ptr<std::vector<double> > theAlphas(
new std::vector<double>(
fPuppiContainer->puppiAlphas()));
307 std::unique_ptr<std::vector<double> > theAlphasMed(
new std::vector<double>(
fPuppiContainer->puppiAlphasMed()));
308 std::unique_ptr<std::vector<double> > theAlphasRms(
new std::vector<double>(
fPuppiContainer->puppiAlphasRMS()));
309 std::unique_ptr<std::vector<double> > alphas(
new std::vector<double>(
fPuppiContainer->puppiRawAlphas()));
310 std::unique_ptr<double> nalgos(
new double(
fPuppiContainer->puppiNAlgos()));
float puppiWeight() const
Set both weights at once (with option for only full PUPPI)
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
double px() const override
x coordinate of momentum vector
float puppiWeightNoLep() const
Weight from full PUPPI.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< reco::PFCandidate > PFOutputCollection
std::vector< pat::PackedCandidate > PackedOutputCollection
std::vector< RecoObj > fRecoObjCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
const reco::VertexRef vertexRef() const
std::unique_ptr< PuppiContainer > fPuppiContainer
double pz() const override
z coordinate of momentum vector
edm::EDGetTokenT< VertexCollection > tokenVertices_
double py() const override
y coordinate of momentum vector
reco::TrackRef trackRef() const
const_iterator begin() const
const PVAssoc fromPV(size_t ipv=0) const
std::unique_ptr< PackedOutputCollection > fPackedPuppiCandidates
Abs< T >::type abs(const T &t)
double energy() const override
energy
math::XYZTLorentzVector LorentzVector
const LorentzVector & p4() const final
four-momentum Lorentz vector
edm::View< reco::Candidate > CandidateView
std::vector< LorentzVector > LorentzVectorCollection
T const * product() const
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_
const_iterator end() const
virtual float dxy() const
dxy with respect to the PV ref
std::unique_ptr< PFOutputCollection > fPuppiCandidates