83 const reco::VertexCollection::const_iterator vtxEnd = pvCol->end();
84 for (reco::VertexCollection::const_iterator vtxIter = pvCol->begin(); vtxEnd != vtxIter; ++vtxIter) {
92 for(
auto const& aPF : *pfCol) {
95 pReco.
eta = aPF.eta();
96 pReco.
phi = aPF.phi();
99 pReco.
charge = aPF.charge();
105 if(lPack ==
nullptr ) {
109 int closestVtxForUnassociateds = -9999;
112 for(
auto const& aV : *pvCol) {
115 pDZ = aTrackRef->dz(aV.position());
116 pD0 = aTrackRef->d0();
122 if(pDZ > -9999) pVtxId = 0;
129 double tmpdz = 99999;
130 if ( aTrackRef.
isNonnull() ) tmpdz = aTrackRef ->
dz(aV.position());
134 closestVtxForUnassociateds = pVtxId;
142 if (closestVtx !=
nullptr && pVtxId > 0) tmpFromPV = 0;
143 if (closestVtx !=
nullptr && pVtxId == 0) tmpFromPV = 3;
144 if (closestVtx ==
nullptr && closestVtxForUnassociateds == 0) tmpFromPV = 2;
145 if (closestVtx ==
nullptr && closestVtxForUnassociateds != 0) tmpFromPV = 1;
152 if (tmpFromPV == 0) {
157 }
else if (tmpFromPV == 3){ pReco.
id = 1; }
158 else if (tmpFromPV == 1 || tmpFromPV == 2){
182 if (lPack->
fromPV() == 0){
187 if (lPack->
fromPV(puVtx_idx) >= 2) {
217 std::vector<double> lWeights;
218 std::vector<PuppiCandidate> lCandidates;
227 for(
auto const& aPF : *pfCol) {
229 float curpupweight = -1.;
230 if(lPack ==
nullptr ) {
238 lWeights.push_back(curpupweight);
240 curjet.
px = curpupweight*lPack->
px();
241 curjet.
py = curpupweight*lPack->
py();
242 curjet.
pz = curpupweight*lPack->
pz();
243 curjet.
e = curpupweight*lPack->
energy();
244 curjet.
pt = curpupweight*lPack->
pt();
245 curjet.
eta = lPack->
eta();
247 curjet.
phi = lPack->
phi();
248 curjet.
m = curpupweight*lPack->
mass();
249 lCandidates.push_back(curjet);
257 lPupFiller.insert(hPFProduct,lWeights.begin(),lWeights.end());
273 std::vector<reco::CandidatePtr>
values(hPFProduct->
size());
276 for (
auto const& aCand : *hPFProduct) {
278 std::unique_ptr<pat::PackedCandidate> pCand;
279 std::unique_ptr<reco::PFCandidate> pfCand;
294 if ( iPuppiMatched >= 0 ) {
295 auto const& puppiMatched = lCandidates[iPuppiMatched];
296 pVec.SetPxPyPzE(puppiMatched.px,puppiMatched.py,puppiMatched.pz,puppiMatched.e);
299 pCand->setPuppiWeight(pCand->puppiWeight(),lWeights[
val]);
301 pCand->setPuppiWeight(lWeights[val],pCand->puppiWeightNoLep());
304 pVec.SetPxPyPzE( 0, 0, 0, 0);
306 pCand->setPuppiWeight(0,0);
309 puppiP4s.push_back( pVec );
313 pCand->setSourceCandidatePtr( aCand.sourceCandidatePtr(0) );
317 pfCand->setSourceCandidatePtr( aCand.sourceCandidatePtr(0) );
324 p4PupFiller.insert(hPFProduct,puppiP4s.begin(), puppiP4s.end() );
331 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
337 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
354 std::unique_ptr<std::vector<double> > theAlphas(
new std::vector<double>(
fPuppiContainer->puppiAlphas()));
355 std::unique_ptr<std::vector<double> > theAlphasMed(
new std::vector<double>(
fPuppiContainer->puppiAlphasMed()));
356 std::unique_ptr<std::vector<double> > theAlphasRms(
new std::vector<double>(
fPuppiContainer->puppiAlphasRMS()));
357 std::unique_ptr<std::vector<double> > alphas(
new std::vector<double>(
fPuppiContainer->puppiRawAlphas()));
358 std::unique_ptr<double> nalgos(
new double(
fPuppiContainer->puppiNAlgos()));
float puppiWeight() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
bool fUseFromPVLooseTight
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.
double fDZCutForChargedFromPUVtxs
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
double rapidity() const override
rapidity
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
double pt() const override
transverse momentum
edm::View< reco::Candidate > CandidateView
std::vector< LorentzVector > LorentzVectorCollection
double eta() const override
momentum pseudorapidity
double phi() const override
momentum azimuthal angle
T const * product() const
ParticleType translatePdgIdToType(int pdgid) const
uint fNumOfPUVtxsForCharged
double mass() const override
mass
Particle reconstructed by the particle flow algorithm.
reco::GsfTrackRef gsfTrackRef() const
edm::EDGetTokenT< CandidateView > tokenPFCandidates_
virtual float dxy() const
dxy with respect to the PV ref
std::unique_ptr< PFOutputCollection > fPuppiCandidates