25 #include "fastjet/PseudoJet.hh"
48 produces<edm::ValueMap<float> > ();
49 produces<edm::ValueMap<LorentzVector> > ();
50 produces< edm::ValueMap<reco::CandidatePtr> >();
52 produces<PFOutputCollection>();
55 produces<double> (
"PuppiNAlgos");
56 produces<std::vector<double>> (
"PuppiRawAlphas");
57 produces<std::vector<double>> (
"PuppiAlphas");
58 produces<std::vector<double>> (
"PuppiAlphasMed");
59 produces<std::vector<double>> (
"PuppiAlphasRms");
79 const reco::VertexCollection::const_iterator vtxEnd = pvCol->end();
80 for (reco::VertexCollection::const_iterator vtxIter = pvCol->begin(); vtxEnd != vtxIter; ++vtxIter) {
90 pReco.
pt = itPF->pt();
91 pReco.
eta = itPF->eta();
92 pReco.
phi = itPF->phi();
93 pReco.
m = itPF->mass();
95 pReco.
charge = itPF->charge();
106 int closestVtxForUnassociateds = -9999;
107 for(reco::VertexCollection::const_iterator iV = pvCol->begin(); iV!=pvCol->end(); ++iV) {
114 if(pDZ > -9999) pVtxId = 0;
116 if(iV->trackWeight(pPF->
trackRef())>0) {
121 double tmpdz = 99999;
124 if (fabs(tmpdz) < curdz){
126 closestVtxForUnassociateds = pVtxId;
133 if (closestVtx != 0 && fabs(pReco.
charge) > 0 && pVtxId > 0) tmpFromPV = 0;
134 if (closestVtx != 0 && fabs(pReco.
charge) > 0 && pVtxId == 0) tmpFromPV = 3;
135 if (closestVtx == 0 && fabs(pReco.
charge) > 0 && closestVtxForUnassociateds == 0) tmpFromPV = 2;
136 if (closestVtx == 0 && fabs(pReco.
charge) > 0 && closestVtxForUnassociateds != 0) tmpFromPV = 1;
140 if (fabs(pReco.
charge) == 0){ pReco.
id = 0; }
142 if (tmpFromPV == 0){ pReco.
id = 2; }
143 if (tmpFromPV == 3){ pReco.
id = 1; }
144 if (tmpFromPV == 1 || tmpFromPV == 2){
161 if (fabs(pReco.
charge) == 0){ pReco.
id = 0; }
162 if (fabs(pReco.
charge) > 0){
163 if (lPack->
fromPV() == 0){ pReco.
id = 2; }
182 std::vector<double> lWeights;
183 std::vector<fastjet::PseudoJet> lCandidates;
194 float curpupweight = -1.;
204 lWeights.push_back(curpupweight);
205 fastjet::PseudoJet curjet( curpupweight*lPack->
px(), curpupweight*lPack->
py(), curpupweight*lPack->
pz(), curpupweight*lPack->
energy());
206 curjet.set_user_index(lPackCtr);
207 lCandidates.push_back(curjet);
215 lPupFiller.
insert(hPFProduct,lWeights.begin(),lWeights.end());
230 std::vector<reco::CandidatePtr>
values(hPFProduct->size());
233 for (
auto i0 = hPFProduct->begin(),
234 i0begin = hPFProduct->begin(),
235 i0end = hPFProduct->end(); i0 != i0end; ++i0 ) {
242 int val = i0 - i0begin;
245 auto puppiMatched = find_if( lCandidates.begin(), lCandidates.end(), [&val]( fastjet::PseudoJet
const &
i ){
return i.user_index() == val; } );
246 if ( puppiMatched != lCandidates.end() ) {
247 pVec.SetPxPyPzE(puppiMatched->px(),puppiMatched->py(),puppiMatched->pz(),puppiMatched->E());
250 pVec.SetPxPyPzE( 0, 0, 0, 0);
253 puppiP4s.push_back( pVec );
261 p4PupFiller.
insert(hPFProduct,puppiP4s.begin(), puppiP4s.end() );
265 iEvent.
put(p4PupOut);
267 for(
unsigned int ic=0, nc = oh->size(); ic < nc; ++ic) {
284 std::auto_ptr<std::vector<double> > theAlphas(
new std::vector<double>(
fPuppiContainer->puppiAlphas()));
285 std::auto_ptr<std::vector<double> > theAlphasMed(
new std::vector<double>(
fPuppiContainer->puppiAlphasMed()));
286 std::auto_ptr<std::vector<double> > theAlphasRms(
new std::vector<double>(
fPuppiContainer->puppiAlphasRMS()));
287 std::auto_ptr<std::vector<double> > alphas(
new std::vector<double>(
fPuppiContainer->puppiRawAlphas()));
288 std::auto_ptr<double> nalgos(
new double(
fPuppiContainer->puppiNAlgos()));
290 iEvent.
put(alphas,
"PuppiRawAlphas");
291 iEvent.
put(nalgos,
"PuppiNAlgos");
292 iEvent.
put(theAlphas,
"PuppiAlphas");
293 iEvent.
put(theAlphasMed,
"PuppiAlphasMed");
294 iEvent.
put(theAlphasRms,
"PuppiAlphasRms");
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
virtual void produce(edm::Event &, const edm::EventSetup &)
bool isNonnull() const
Checks for non-null.
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< RecoObj > fRecoObjCollection
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< LorentzVector > LorentzVectorCollection
void setSourceCandidatePtr(const PFCandidatePtr &ptr)
math::XYZTLorentzVector LorentzVector
const reco::VertexRef vertexRef() const
std::unique_ptr< PuppiContainer > fPuppiContainer
edm::EDGetTokenT< VertexCollection > tokenVertices_
reco::TrackRef trackRef() const
void addDefault(ParameterSetDescription const &psetDescription)
const_iterator begin() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const PVAssoc fromPV(size_t ipv=0) const
virtual double py() const
y coordinate of momentum vector
virtual double energy() const
energy
PuppiProducer(const edm::ParameterSet &)
virtual void beginRun(edm::Run &, edm::EventSetup const &)
virtual void endLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
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_
std::auto_ptr< PFOutputCollection > fPuppiCandidates
const_iterator end() const
virtual void endRun(edm::Run &, edm::EventSetup const &)
virtual double px() const
x coordinate of momentum vector
virtual void beginLuminosityBlock(edm::LuminosityBlock &, edm::EventSetup const &)
virtual float dxy() const
dxy with respect to the PV ref
virtual double pz() const
z coordinate of momentum vector