59 std::vector<size_t>
idx(v.size());
60 for (
size_t i = 0;
i !=
idx.size(); ++
i)
idx[
i] =
i;
79 float calcDxy(
float dx,
float dy,
float phi) {
83 return p.Z()-v.Z() - ((p.X()-v.X()) * c.
px() + (p.Y()-v.Y())*c.
py()) * c.
pz()/(c.
pt()*c.
pt());
92 PVAssoQuality_(consumes<edm::ValueMap<int> >(iConfig.getParameter<edm::
InputTag>(
"vertexAssociator"))),
95 PuppiWeight_(consumes<edm::ValueMap<float> >(iConfig.getParameter<edm::
InputTag>(
"PuppiSrc"))),
97 PuppiCands_(consumes<std::vector<
reco::PFCandidate > >(iConfig.getParameter<edm::
InputTag>(
"PuppiSrc"))),
98 SVWhiteList_(consumes<edm::
View<
reco::CompositePtrCandidate > >(iConfig.getParameter<edm::
InputTag>(
"secondaryVerticesForWhiteList"))),
99 minPtForTrackProperties_(iConfig.getParameter<double>(
"minPtForTrackProperties"))
101 produces< std::vector<pat::PackedCandidate> > ();
102 produces< edm::Association<pat::PackedCandidateCollection> > ();
103 produces< edm::Association<reco::PFCandidateCollection> > ();
114 std::vector<reco::Candidate>::const_iterator cand;
117 iEvent.
getByToken( PuppiWeight_, puppiWeight );
119 iEvent.
getByToken( PuppiCandsMap_, puppiCandsMap );
122 std::vector<int> mappingPuppi(puppiCands->size());
130 iEvent.
getByToken(PVAssoQuality_,assoQualityHandle);
135 iEvent.
getByToken(SVWhiteList_,svWhiteListHandle);
137 std::set<unsigned int> whiteList;
138 for(
unsigned int i=0;
i<svWhiteList.
size();
i++)
140 for(
unsigned int j=0;
j< svWhiteList[
i].numberOfSourceCandidatePtrs();
j++) {
142 if(c.
id() == cands.
id()) whiteList.insert(c.
key());
156 std::auto_ptr< std::vector<pat::PackedCandidate> > outPtrP(
new std::vector<pat::PackedCandidate> );
157 std::vector<int> mapping(cands->size());
158 std::vector<int> mappingReverse(cands->size());
159 std::vector<int> mappingTk(TKOrigs->size(), -1);
161 for(
unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
163 float phiAtVtx = cand.
phi();
173 for(
size_t ii=0;
ii<PVs->size();
ii++){
174 float dz=
std::abs(ctrack->
dz( ((*PVs)[
ii]).position()));
175 if(dz<dist) {pvi=
ii;dist=dz; }
188 phiAtVtx = ctrack->
phi();
205 outPtrP->back().setLostInnerHits( lostHits );
206 if(outPtrP->back().pt() > minPtForTrackProperties_ || whiteList.find(ic)!=whiteList.end()) {
207 outPtrP->back().setTrackProperties(*ctrack);
214 outPtrP->back().setMuonID(cand.
muonRef()->isStandAloneMuon(), cand.
muonRef()->isGlobalMuon());
220 PVpos = PV->position();
229 outPtrP->back().setPuppiWeight( (*puppiWeight)[pkref]);
230 mappingPuppi[((*puppiCandsMap)[pkref]).
key()]=ic;
240 std::auto_ptr< std::vector<pat::PackedCandidate> > outPtrPSorted(
new std::vector<pat::PackedCandidate> );
241 std::vector<size_t> order=sort_indexes(*outPtrP);
242 std::vector<size_t> reverseOrder(order.size());
243 for(
size_t i=0,nc=cands->size();
i<nc;
i++) {
244 outPtrPSorted->push_back((*outPtrP)[order[
i]]);
245 reverseOrder[order[
i]] =
i;
246 mappingReverse[order[
i]]=
i;
250 for(
size_t i=0,ntk=mappingTk.size();
i<ntk;
i++){
251 if(mappingTk[
i] >= 0)
252 mappingTk[
i]=reverseOrder[mappingTk[
i]];
255 for(
size_t i=0,ntk=mappingPuppi.size();
i<ntk;
i++){
256 mappingPuppi[
i]=reverseOrder[mappingPuppi[
i]];
266 pf2pcFiller.
insert(cands, mappingReverse.begin(), mappingReverse.end());
267 pc2pfFiller.
insert(oh , order.begin(), order.end());
269 pf2pcFiller.
insert(TKOrigs, mappingTk.begin(), mappingTk.end());
270 pf2pcFiller.
insert(puppiCands, mappingPuppi.begin(), mappingPuppi.end());
const Point & referencePoint() const
Reference point on the track.
virtual int pdgId() const
PDG identifier.
float calcDz(reco::Candidate::Point p, reco::Candidate::Point v, const reco::Candidate &c)
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
#define DEFINE_FWK_MODULE(type)
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
virtual double pt() const
transverse momentum
key_type key() const
Accessor for product key.
virtual double eta() const
momentum pseudorapidity
edm::EDGetTokenT< edm::View< reco::CompositePtrCandidate > > SVWhiteList_
const reco::VertexRef vertexRef() const
bool candsOrdering(pat::PackedCandidate i, pat::PackedCandidate j)
ProductID id() const
Accessor for product ID.
edm::EDGetTokenT< reco::TrackCollection > TKOrigs_
edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > PuppiCandsMap_
reco::TrackRef trackRef() const
PATPackedCandidateProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::PFCandidateCollection > Cands_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
virtual int charge() const
electric charge
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual double py() const =0
y coordinate of momentum vector
edm::EDGetTokenT< reco::VertexCollection > PVs_
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
edm::EDGetTokenT< std::vector< reco::PFCandidate > > PuppiCands_
reco::MuonRef muonRef() const
virtual double px() const =0
x coordinate of momentum vector
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
LostInnerHits
Enumerator specifying the.
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
T const * product() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
XYZPointD XYZPoint
point in space with cartesian internal representation
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::vector< size_t > sort_indexes(const std::vector< T > &v)
ProductID id() const
Accessor for product ID.
~PATPackedCandidateProducer()
int numberOfLostHits(HitCategory category) const
float calcDxy(float dx, float dy, float phi)
Particle reconstructed by the particle flow algorithm.
virtual const PolarLorentzVector & polarP4() const
four-momentum Lorentz vector
virtual void produce(edm::Event &, const edm::EventSetup &)
reco::GsfTrackRef gsfTrackRef() const
static int qualityMap[8]
conversion map from quality flags used in PV association and miniAOD one
math::XYZPoint Point
point in the space
double minPtForTrackProperties_
bool hasValidHitInFirstPixelBarrel() const
edm::EDGetTokenT< edm::ValueMap< int > > PVAssoQuality_
edm::EDGetTokenT< edm::Association< reco::VertexCollection > > PVAsso_
edm::EDGetTokenT< edm::ValueMap< float > > PuppiWeight_
virtual double phi() const
momentum azimuthal angle
edm::EDGetTokenT< reco::VertexCollection > PVOrigs_