83 const reco::VertexCollection::const_iterator vtxEnd = pvCol->end();
84 for (reco::VertexCollection::const_iterator vtxIter = pvCol->begin(); vtxEnd != vtxIter; ++vtxIter) {
94 pReco.
pt = itPF->pt();
95 pReco.
eta = itPF->eta();
96 pReco.
phi = itPF->phi();
97 pReco.
m = itPF->mass();
99 pReco.
charge = itPF->charge();
110 int closestVtxForUnassociateds = -9999;
111 for(reco::VertexCollection::const_iterator iV = pvCol->begin(); iV!=pvCol->end(); ++iV) {
118 if(pDZ > -9999) pVtxId = 0;
120 if(iV->trackWeight(pPF->
trackRef())>0) {
125 double tmpdz = 99999;
130 closestVtxForUnassociateds = pVtxId;
137 if (closestVtx != 0 &&
std::abs(pReco.
charge) > 0 && pVtxId > 0) tmpFromPV = 0;
138 if (closestVtx != 0 &&
std::abs(pReco.
charge) > 0 && pVtxId == 0) tmpFromPV = 3;
139 if (closestVtx == 0 &&
std::abs(pReco.
charge) > 0 && closestVtxForUnassociateds == 0) tmpFromPV = 2;
140 if (closestVtx == 0 &&
std::abs(pReco.
charge) > 0 && closestVtxForUnassociateds != 0) tmpFromPV = 1;
146 if (tmpFromPV == 0){ pReco.
id = 2; }
147 if (tmpFromPV == 3){ pReco.
id = 1; }
148 if (tmpFromPV == 1 || tmpFromPV == 2){
166 if (lPack->
fromPV() == 0){ pReco.
id = 2; }
185 std::vector<double> lWeights;
186 std::vector<fastjet::PseudoJet> lCandidates;
197 float curpupweight = -1.;
206 lWeights.push_back(curpupweight);
207 fastjet::PseudoJet curjet( curpupweight*lPack->
px(), curpupweight*lPack->
py(), curpupweight*lPack->
pz(), curpupweight*lPack->
energy());
208 curjet.set_user_index(lPackCtr);
209 lCandidates.push_back(curjet);
217 lPupFiller.insert(hPFProduct,lWeights.begin(),lWeights.end());
233 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
235 for (
auto i0 = hPFProduct->
begin(),
236 i0begin = hPFProduct->
begin(),
237 i0end = hPFProduct->
end(); i0 != i0end; ++i0 ) {
238 std::unique_ptr<pat::PackedCandidate> pCand;
239 std::unique_ptr<reco::PFCandidate> pfCand;
251 int val = i0 - i0begin;
254 auto puppiMatched = find_if( lCandidates.begin(), lCandidates.end(), [&
val]( fastjet::PseudoJet
const &
i ){
return i.user_index() ==
val; } );
255 if ( puppiMatched != lCandidates.end() ) {
256 pVec.SetPxPyPzE(puppiMatched->px(),puppiMatched->py(),puppiMatched->pz(),puppiMatched->E());
258 pVec.SetPxPyPzE( 0, 0, 0, 0);
260 puppiP4s.push_back( pVec );
264 pCand->setSourceCandidatePtr( i0->sourceCandidatePtr(0) );
268 pfCand->setSourceCandidatePtr( i0->sourceCandidatePtr(0) );
275 p4PupFiller.insert(hPFProduct,puppiP4s.begin(), puppiP4s.end() );
282 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
288 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
305 std::unique_ptr<std::vector<double> > theAlphas(
new std::vector<double>(
fPuppiContainer->puppiAlphas()));
306 std::unique_ptr<std::vector<double> > theAlphasMed(
new std::vector<double>(
fPuppiContainer->puppiAlphasMed()));
307 std::unique_ptr<std::vector<double> > theAlphasRms(
new std::vector<double>(
fPuppiContainer->puppiAlphasRMS()));
308 std::unique_ptr<std::vector<double> > alphas(
new std::vector<double>(
fPuppiContainer->puppiRawAlphas()));
309 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.
float puppiWeightNoLep() const
Weight from full PUPPI.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< reco::PFCandidate > PFOutputCollection
math::XYZTLorentzVector LorentzVector
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
edm::EDGetTokenT< VertexCollection > tokenVertices_
reco::TrackRef trackRef() const
const_iterator begin() const
const PVAssoc fromPV(size_t ipv=0) const
virtual double py() const
y coordinate of momentum vector
std::unique_ptr< PackedOutputCollection > fPackedPuppiCandidates
virtual double energy() const
energy
Abs< T >::type abs(const T &t)
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 double px() const
x coordinate of momentum vector
virtual float dxy() const
dxy with respect to the PV ref
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
std::unique_ptr< PFOutputCollection > fPuppiCandidates
virtual double pz() const
z coordinate of momentum vector