49 produces<edm::ValueMap<float> > ();
50 produces<edm::ValueMap<LorentzVector> > ();
51 produces< edm::ValueMap<reco::CandidatePtr> >();
53 if (fUseExistingWeights || fClonePackedCands)
54 produces<pat::PackedCandidateCollection>();
56 produces<reco::PFCandidateCollection>();
59 produces<double> (
"PuppiNAlgos");
60 produces<std::vector<double>> (
"PuppiRawAlphas");
61 produces<std::vector<double>> (
"PuppiAlphas");
62 produces<std::vector<double>> (
"PuppiAlphasMed");
63 produces<std::vector<double>> (
"PuppiAlphasRms");
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();
106 if(lPack ==
nullptr ) {
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 !=
nullptr &&
std::abs(pReco.
charge) > 0 && pVtxId > 0) tmpFromPV = 0;
138 if (closestVtx !=
nullptr &&
std::abs(pReco.
charge) > 0 && pVtxId == 0) tmpFromPV = 3;
139 if (closestVtx ==
nullptr &&
std::abs(pReco.
charge) > 0 && closestVtxForUnassociateds == 0) tmpFromPV = 2;
140 if (closestVtx ==
nullptr &&
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<PuppiCandidate> lCandidates;
197 float curpupweight = -1.;
198 if(lPack ==
nullptr ) {
206 lWeights.push_back(curpupweight);
207 PuppiCandidate 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](
PuppiCandidate 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]
T getParameter(std::string const &) const
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
#define DEFINE_FWK_MODULE(type)
void insert(const H &h, I begin, I end)
std::vector< pat::PackedCandidate > PackedOutputCollection
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
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
void addDefault(ParameterSetDescription const &psetDescription)
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
const LorentzVector & p4() const final
four-momentum Lorentz vector
void produce(edm::Event &, const edm::EventSetup &) override
PuppiProducer(const edm::ParameterSet &)
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_
const_iterator end() const
virtual float dxy() const
dxy with respect to the PV ref
~PuppiProducer() override
std::unique_ptr< PFOutputCollection > fPuppiCandidates