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) {
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()));
378 desc.
add<
bool>(
"puppiDiagnostics",
false);
379 desc.
add<
bool>(
"puppiForLeptons",
false);
380 desc.
add<
bool>(
"UseFromPVLooseTight",
false);
381 desc.
add<
bool>(
"UseDeltaZCut",
true);
382 desc.
add<
double>(
"DeltaZCut", 0.3);
383 desc.
add<
double>(
"EtaMinUseDeltaZ", 0.);
384 desc.
add<
double>(
"PtMaxCharged", 0.);
385 desc.
add<
double>(
"EtaMaxCharged", 99999.);
386 desc.
add<
double>(
"PtMaxNeutrals", 200.);
387 desc.
add<
double>(
"PtMaxNeutralsStartSlope", 0.);
388 desc.
add<
uint>(
"NumOfPUVtxsForCharged", 0);
389 desc.
add<
double>(
"DeltaZCutForChargedFromPUVtxs", 0.2);
390 desc.
add<
bool>(
"useExistingWeights",
false);
391 desc.
add<
bool>(
"useWeightsNoLep",
false);
392 desc.
add<
bool>(
"clonePackedCands",
false);
393 desc.
add<
int>(
"vtxNdofCut", 4);
394 desc.
add<
double>(
"vtxZCut", 24);
397 desc.
add<
bool>(
"applyCHS",
true);
398 desc.
add<
bool>(
"invertPuppi",
false);
399 desc.
add<
bool>(
"useExp",
false);
400 desc.
add<
double>(
"MinPuppiWeight", .01);
404 descriptions.
add(
"PuppiProducer", desc);
float puppiWeight() const
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
T getParameter(std::string const &) const
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
static void fillDescriptionsPuppiAlgo(edm::ParameterSetDescription &desc)
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
#define DEFINE_FWK_MODULE(type)
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
double pt() const override
transverse momentum
void produce(edm::Event &, const edm::EventSetup &) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
PuppiProducer(const edm::ParameterSet &)
double eta() const override
momentum pseudorapidity
double phi() const override
momentum azimuthal angle
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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
~PuppiProducer() override
std::unique_ptr< PFOutputCollection > fPuppiCandidates