46 return p.Z()-v.Z() - ((p.X()-v.X()) * c.
px() + (p.Y()-v.Y())*c.
py()) * c.
pz()/(c.
pt()*c.
pt());
56 PVOrigs_(consumes<
reco::
VertexCollection>(iConfig.getParameter<edm::InputTag>(
"originalVertices"))),
57 TKOrigs_(consumes<
reco::
TrackCollection>(iConfig.getParameter<edm::InputTag>(
"originalTracks"))),
58 minPtForTrackProperties_(iConfig.getParameter<double>(
"minPtForTrackProperties"))
60 produces< std::vector<pat::PackedCandidate> > ();
61 produces< edm::Association<pat::PackedCandidateCollection> > ();
62 produces< edm::Association<reco::PFCandidateCollection> > ();
77 std::vector<reco::Candidate>::const_iterator cand;
80 iEvent.
getByToken( CandsFromPVLoose_, candsFromPVLoose );
82 iEvent.
getByToken( CandsFromPVTight_, candsFromPVTight );
86 if (ptr.ptr().id() == cands.
id()) {
88 }
else if (ptr.backPtr().id() == cands.
id()) {
91 throw cms::Exception(
"Configuration",
"The elements from 'inputCollectionFromPVLoose' don't point to 'inputCollection'\n");
95 if (ptr.ptr().id() == cands.
id()) {
97 }
else if (ptr.backPtr().id() == cands.
id()) {
100 throw cms::Exception(
"Configuration",
"The elements from 'inputCollectionFromPVTight' don't point to 'inputCollection'\n");
113 PVpos = PV->position();
119 std::auto_ptr< std::vector<pat::PackedCandidate> > outPtrP(
new std::vector<pat::PackedCandidate> );
120 std::vector<int> mapping(cands->size());
121 std::vector<int> mappingTk(TKOrigs->size(), -1);
123 std::vector<int> jetOrder;
124 std::vector<int> jetOrderReverse;
125 for(
unsigned int i=0;
i<cands->size();
i++) jetOrderReverse.push_back(-1);
129 for(
unsigned int i=0;
i<dau.size();
i++)
131 if((*cands)[dau[
i].key()].trackRef().isNonnull() && (*cands)[dau[
i].key()].pt() > minPtForTrackProperties_){
132 jetOrder.push_back(dau[
i].
key());
133 jetOrderReverse[jetOrder.back()]=jetOrder.size()-1;
136 for(
unsigned int i=0;
i<dau.size();
i++)
138 if(!((*cands)[dau[
i].
key()].trackRef().isNonnull() && (*cands)[dau[
i].
key()].
pt() > minPtForTrackProperties_)){
139 jetOrder.push_back(dau[
i].
key());
140 jetOrderReverse[jetOrder.back()]=jetOrder.size()-1;
145 for(
unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
146 if(jetOrderReverse[ic]==-1 && (*cands)[ic].trackRef().isNonnull() && (*cands)[ic].pt() > minPtForTrackProperties_)
148 jetOrder.push_back(ic);
149 jetOrderReverse[jetOrder.back()]=jetOrder.size()-1;
154 for(
unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
155 if(jetOrderReverse[ic]==-1)
157 jetOrder.push_back(ic);
158 jetOrderReverse[jetOrder.back()]=jetOrder.size()-1;
165 for(
unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
171 float phiAtVtx = cand.
phi();
182 phiAtVtx = ctrack->
phi();
194 outPtrP->back().setLostInnerHits( lostHits );
195 if(outPtrP->back().pt() > minPtForTrackProperties_) {
196 outPtrP->back().setTrackProperties(*ctrack);
203 outPtrP->back().setFromPV( fromPV[ic] );
207 outPtrP->back().setMuonID(cand.
muonRef()->isStandAloneMuon(), cand.
muonRef()->isGlobalMuon());
211 outPtrP->back().setFromPV( fromPV[ic] );
230 pf2pcFiller.
insert(cands, jetOrderReverse.begin(), jetOrderReverse.end());
231 pc2pfFiller.
insert(oh , jetOrder.begin(), jetOrder.end());
233 pf2pcFiller.
insert(cands, mapping.begin(), mapping.end());
234 pc2pfFiller.
insert(oh , mapping.begin(), mapping.end());
237 pf2pcFiller.
insert(TKOrigs, mappingTk.begin(), mappingTk.end());
edm::EDGetTokenT< reco::PFCandidateFwdPtrVector > CandsFromPVLoose_
float calcDz(reco::Candidate::Point p, reco::Candidate::Point v, const reco::Candidate &c)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual int pdgId() const GCC11_FINAL
PDG identifier.
#define DEFINE_FWK_MODULE(type)
int numberOfLostHits() const
Sin< T >::type sin(const T &t)
virtual double pz() const =0
z coordinate of momentum vector
void insert(const H &h, I begin, I end)
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
const Point & referencePoint() const
Reference point on the track.
edm::EDGetTokenT< reco::TrackCollection > TKOrigs_
reco::TrackRef trackRef() const
bool isNonnull() const
Checks for non-null.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
virtual float pt() const =0
transverse momentum
PATPackedCandidateProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::PFCandidateCollection > Cands_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
virtual const Point & vertex() const
vertex position (overwritten by PF...)
const HitPattern & trackerExpectedHitsInner() const
Access the hit pattern counting (in the Tracker) the number of expected crossed layers before the fir...
virtual double py() const =0
y coordinate of momentum vector
edm::EDGetTokenT< reco::VertexCollection > PVs_
edm::EDGetTokenT< reco::PFCandidateFwdPtrVector > CandsFromPVTight_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
reco::MuonRef muonRef() const
virtual double px() const =0
x coordinate of momentum vector
LostInnerHits
Enumerator specifying the.
std::vector< CandidatePtr > daughters
collection of references to daughters
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual const PolarLorentzVector & polarP4() const GCC11_FINAL
four-momentum Lorentz vector
std::vector< PFCandidateFwdPtr > PFCandidateFwdPtrVector
vector of "forward" reference
XYZPointD XYZPoint
point in space with cartesian internal representation
key_type key() const
Accessor for product key.
Analysis-level calorimeter jet class.
~PATPackedCandidateProducer()
float calcDxy(float dx, float dy, float phi)
Particle reconstructed by the particle flow algorithm.
virtual void produce(edm::Event &, const edm::EventSetup &)
reco::GsfTrackRef gsfTrackRef() const
const daughters & daughterPtrVector() const
references to daughtes
math::XYZPoint Point
point in the space
double minPtForTrackProperties_
ProductID id() const
Accessor for product ID.
bool hasValidHitInFirstPixelBarrel() const
edm::EDGetTokenT< reco::VertexCollection > PVOrigs_