CMS 3D CMS Logo

PATPackedCandidateProducer.cc
Go to the documentation of this file.
1 #include <string>
2 
24 
25 /*#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
26 #include "MagneticField/Engine/interface/MagneticField.h"
27 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
28 #include "RecoVertex/VertexPrimitives/interface/ConvertToFromReco.h"
29 #include
30 "TrackingTools/GeomPropagators/interface/AnalyticalImpactPointExtrapolator.h"
31 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
32 */
33 //#define CRAZYSORT
34 
35 namespace pat {
37 const static int qualityMap[8] = {1, 0, 1, 1, 4, 4, 5, 6};
38 
40 public:
42  ~PATPackedCandidateProducer() override;
43 
45  const edm::EventSetup &) const override;
46 
47  // sorting of cands to maximize the zlib compression
48  static bool candsOrdering(pat::PackedCandidate const &i,
49  pat::PackedCandidate const &j) {
50  if (std::abs(i.charge()) == std::abs(j.charge())) {
51  if (i.charge() != 0) {
52  if (i.hasTrackDetails() and !j.hasTrackDetails())
53  return true;
54  if (!i.hasTrackDetails() and j.hasTrackDetails())
55  return false;
56  if (i.covarianceSchema() > j.covarianceSchema())
57  return true;
58  if (i.covarianceSchema() < j.covarianceSchema())
59  return false;
60  }
61  if (i.vertexRef() == j.vertexRef())
62  return i.eta() > j.eta();
63  else
64  return i.vertexRef().key() < j.vertexRef().key();
65  }
66  return std::abs(i.charge()) > std::abs(j.charge());
67  }
68 
69  template <typename T>
70  static std::vector<size_t> sort_indexes(const std::vector<T> &v) {
71  std::vector<size_t> idx(v.size());
72  for (size_t i = 0; i != idx.size(); ++i)
73  idx[i] = i;
74  std::sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) {
75  return candsOrdering(v[i1], v[i2]);
76  });
77  return idx;
78  }
79 
80 private:
81  // if PuppiSrc && PuppiNoLepSrc are empty, usePuppi is false
82  // otherwise assumes that if they are set, you wanted to use puppi and will
83  // throw an exception if the puppis are not found
84  const bool usePuppi_;
85 
97  std::vector<edm::EDGetTokenT<edm::View<reco::Candidate>>> SVWhiteLists_;
100 
104  const std::vector<int> covariancePackingSchemas_;
105 
106  const std::vector<int> pfCandidateTypesForHcalDepth_;
108 
109  const bool storeTiming_;
110 
111  // for debugging
112  float calcDxy(float dx, float dy, float phi) const {
113  return -dx * std::sin(phi) + dy * std::cos(phi);
114  }
116  const reco::Candidate &c) const {
117  return p.Z() - v.Z() -
118  ((p.X() - v.X()) * c.px() + (p.Y() - v.Y()) * c.py()) * c.pz() /
119  (c.pt() * c.pt());
120  }
121 };
122 } // namespace pat
123 
125  const edm::ParameterSet &iConfig)
126  : usePuppi_(
127  !iConfig.getParameter<edm::InputTag>("PuppiSrc").encode().empty() ||
128  !iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc")
129  .encode()
130  .empty()),
132  iConfig.getParameter<edm::InputTag>("inputCollection"))),
134  iConfig.getParameter<edm::InputTag>("inputVertices"))),
135  PVAsso_(consumes<edm::Association<reco::VertexCollection>>(
136  iConfig.getParameter<edm::InputTag>("vertexAssociator"))),
137  PVAssoQuality_(consumes<edm::ValueMap<int>>(
138  iConfig.getParameter<edm::InputTag>("vertexAssociator"))),
140  iConfig.getParameter<edm::InputTag>("originalVertices"))),
142  iConfig.getParameter<edm::InputTag>("originalTracks"))),
144  ? consumes<edm::ValueMap<float>>(
145  iConfig.getParameter<edm::InputTag>("PuppiSrc"))
146  : edm::EDGetTokenT<edm::ValueMap<float>>()),
148  usePuppi_ ? consumes<edm::ValueMap<float>>(
149  iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc"))
150  : edm::EDGetTokenT<edm::ValueMap<float>>()),
152  usePuppi_ ? consumes<edm::ValueMap<reco::CandidatePtr>>(
153  iConfig.getParameter<edm::InputTag>("PuppiSrc"))
154  : edm::EDGetTokenT<edm::ValueMap<reco::CandidatePtr>>()),
156  ? consumes<std::vector<reco::PFCandidate>>(
157  iConfig.getParameter<edm::InputTag>("PuppiSrc"))
158  : edm::EDGetTokenT<std::vector<reco::PFCandidate>>()),
160  usePuppi_ ? consumes<std::vector<reco::PFCandidate>>(
161  iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc"))
162  : edm::EDGetTokenT<std::vector<reco::PFCandidate>>()),
164  !iConfig.getParameter<edm::InputTag>("chargedHadronIsolation")
165  .encode()
166  .empty()),
168  iConfig.getParameter<edm::InputTag>("chargedHadronIsolation"))),
170  iConfig.getParameter<double>("minPtForChargedHadronProperties")),
172  iConfig.getParameter<double>("minPtForTrackProperties")),
173  covarianceVersion_(iConfig.getParameter<int>("covarianceVersion")),
175  iConfig.getParameter<std::vector<int>>("covariancePackingSchemas")),
176  pfCandidateTypesForHcalDepth_(iConfig.getParameter<std::vector<int>>(
177  "pfCandidateTypesForHcalDepth")),
179  iConfig.getParameter<bool>("storeHcalDepthEndcapOnly")),
180  storeTiming_(iConfig.getParameter<bool>("storeTiming")) {
181  std::vector<edm::InputTag> sv_tags =
182  iConfig.getParameter<std::vector<edm::InputTag>>(
183  "secondaryVerticesForWhiteList");
184  for (auto itag : sv_tags) {
186  }
187 
188  produces<std::vector<pat::PackedCandidate>>();
189  produces<edm::Association<pat::PackedCandidateCollection>>();
190  produces<edm::Association<reco::PFCandidateCollection>>();
191 
192  if (not pfCandidateTypesForHcalDepth_.empty())
194  "hcalDepthEnergyFractions");
195 }
196 
198 
200  edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const {
202  iEvent.getByToken(Cands_, cands);
203 
207  edm::Handle<edm::ValueMap<float>> puppiWeightNoLep;
209  std::vector<reco::CandidatePtr> puppiCandsNoLepPtrs;
210  if (usePuppi_) {
211  iEvent.getByToken(PuppiWeight_, puppiWeight);
212  iEvent.getByToken(PuppiCandsMap_, puppiCandsMap);
213  iEvent.getByToken(PuppiCands_, puppiCands);
214  iEvent.getByToken(PuppiWeightNoLep_, puppiWeightNoLep);
215  iEvent.getByToken(PuppiCandsNoLep_, puppiCandsNoLep);
216  for (auto pup : *puppiCandsNoLep) {
217  puppiCandsNoLepPtrs.push_back(pup.sourceCandidatePtr(0));
218  }
219  }
220  std::vector<int> mappingPuppi(usePuppi_ ? puppiCands->size() : 0);
221 
223  iEvent.getByToken(PVOrigs_, PVOrigs);
224 
226  iEvent.getByToken(PVAsso_, assoHandle);
227  edm::Handle<edm::ValueMap<int>> assoQualityHandle;
228  iEvent.getByToken(PVAssoQuality_, assoQualityHandle);
229  const edm::Association<reco::VertexCollection> &associatedPV =
230  *(assoHandle.product());
231  const edm::ValueMap<int> &associationQuality = *(assoQualityHandle.product());
232 
233  edm::Handle<edm::ValueMap<bool>> chargedHadronIsolationHandle;
235  iEvent.getByToken(ChargedHadronIsolation_, chargedHadronIsolationHandle);
236 
237  std::set<unsigned int> whiteList;
238  std::set<reco::TrackRef> whiteListTk;
239  for (auto itoken : SVWhiteLists_) {
240  edm::Handle<edm::View<reco::Candidate>> svWhiteListHandle;
241  iEvent.getByToken(itoken, svWhiteListHandle);
242  const edm::View<reco::Candidate> &svWhiteList =
243  *(svWhiteListHandle.product());
244  for (unsigned int i = 0; i < svWhiteList.size(); i++) {
245  // Whitelist via Ptrs
246  for (unsigned int j = 0; j < svWhiteList[i].numberOfSourceCandidatePtrs();
247  j++) {
249  svWhiteList[i].sourceCandidatePtr(j);
250  if (c.id() == cands.id())
251  whiteList.insert(c.key());
252  }
253  // Whitelist via RecoCharged
254  for (auto dau = svWhiteList[i].begin(); dau != svWhiteList[i].end();
255  dau++) {
256  const reco::RecoChargedCandidate *chCand =
257  dynamic_cast<const reco::RecoChargedCandidate *>(&(*dau));
258  if (chCand != nullptr) {
259  whiteListTk.insert(chCand->track());
260  }
261  }
262  }
263  }
264 
266  iEvent.getByToken(PVs_, PVs);
267  reco::VertexRef PV(PVs.id());
268  reco::VertexRefProd PVRefProd(PVs);
269  math::XYZPoint PVpos;
270 
271  std::vector<pat::HcalDepthEnergyFractions> hcalDepthEnergyFractions;
272  hcalDepthEnergyFractions.reserve(cands->size());
273  std::vector<pat::HcalDepthEnergyFractions> hcalDepthEnergyFractions_Ordered;
274  hcalDepthEnergyFractions_Ordered.reserve(cands->size());
275 
277  iEvent.getByToken(TKOrigs_, TKOrigs);
278  auto outPtrP = std::make_unique<std::vector<pat::PackedCandidate>>();
279  std::vector<int> mapping(cands->size());
280  std::vector<int> mappingReverse(cands->size());
281  std::vector<int> mappingTk(TKOrigs->size(), -1);
282 
283  for (unsigned int ic = 0, nc = cands->size(); ic < nc; ++ic) {
284  const reco::PFCandidate &cand = (*cands)[ic];
285  const reco::Track *ctrack = nullptr;
286  if ((abs(cand.pdgId()) == 11 || cand.pdgId() == 22) &&
287  cand.gsfTrackRef().isNonnull()) {
288  ctrack = &*cand.gsfTrackRef();
289  } else if (cand.trackRef().isNonnull()) {
290  ctrack = &*cand.trackRef();
291  }
292  if (ctrack) {
293  float dist = 1e99;
294  int pvi = -1;
295  for (size_t ii = 0; ii < PVs->size(); ii++) {
296  float dz = std::abs(ctrack->dz(((*PVs)[ii]).position()));
297  if (dz < dist) {
298  pvi = ii;
299  dist = dz;
300  }
301  }
302  PV = reco::VertexRef(PVs, pvi);
303  math::XYZPoint vtx = cand.vertex();
306  const reco::VertexRef &PVOrig =
307  associatedPV[reco::CandidatePtr(cands, ic)];
308  if (PVOrig.isNonnull())
310  PVs,
311  PVOrig
312  .key()); // WARNING: assume the PV slimmer is keeping same order
313  int quality = associationQuality[reco::CandidatePtr(cands, ic)];
314  // if ((size_t)pvi!=PVOrig.key()) std::cout << "not closest in Z"
315  // << pvi << " " << PVOrig.key() << " " << cand.pt() << " " <<
316  // quality << std::endl; TrajectoryStateOnSurface tsos =
317  // extrapolator.extrapolate(trajectoryStateTransform::initialFreeState(*ctrack,&*magneticField),
318  // RecoVertex::convertPos(PV->position()));
319  // vtx = tsos.globalPosition();
320  // phiAtVtx = tsos.globalDirection().phi();
321  vtx = ctrack->referencePoint();
322  float ptTrk = ctrack->pt();
323  float etaAtVtx = ctrack->eta();
324  float phiAtVtx = ctrack->phi();
325 
326  int nlost = ctrack->hitPattern().numberOfLostHits(
328  if (nlost == 0) {
329  if (ctrack->hitPattern().hasValidHitInPixelLayer(
332  }
333  } else {
334  lostHits = (nlost == 1 ? pat::PackedCandidate::oneLostInnerHit
336  }
337 
338  outPtrP->push_back(pat::PackedCandidate(cand.polarP4(), vtx, ptTrk,
339  etaAtVtx, phiAtVtx, cand.pdgId(),
340  PVRefProd, PV.key()));
341  outPtrP->back().setAssociationQuality(
343  outPtrP->back().setCovarianceVersion(covarianceVersion_);
344  if (cand.trackRef().isNonnull() && PVOrig.isNonnull() &&
345  PVOrig->trackWeight(cand.trackRef()) > 0.5 && quality == 7) {
346  outPtrP->back().setAssociationQuality(
348  }
349  // properties of the best track
350  outPtrP->back().setLostInnerHits(lostHits);
351  if (outPtrP->back().pt() > minPtForTrackProperties_ ||
352  outPtrP->back().ptTrk() > minPtForTrackProperties_ ||
353  whiteList.find(ic) != whiteList.end() ||
354  (cand.trackRef().isNonnull() &&
355  whiteListTk.find(cand.trackRef()) != whiteListTk.end())) {
356  outPtrP->back().setFirstHit(ctrack->hitPattern().getHitPattern(
358  if (abs(outPtrP->back().pdgId()) == 22) {
359  outPtrP->back().setTrackProperties(
361  } else {
362  if (ctrack->hitPattern().numberOfValidPixelHits() > 0) {
363  outPtrP->back().setTrackProperties(
364  *ctrack, covariancePackingSchemas_[0],
365  covarianceVersion_); // high quality
366  } else {
367  outPtrP->back().setTrackProperties(
369  }
370  }
371  // outPtrP->back().setTrackProperties(*ctrack,tsos.curvilinearError());
372  } else {
373  if (outPtrP->back().pt() > 0.5) {
374  if (ctrack->hitPattern().numberOfValidPixelHits() > 0)
375  outPtrP->back().setTrackProperties(
376  *ctrack, covariancePackingSchemas_[2],
377  covarianceVersion_); // low quality, with pixels
378  else
379  outPtrP->back().setTrackProperties(
380  *ctrack, covariancePackingSchemas_[3],
381  covarianceVersion_); // low quality, without pixels
382  }
383  }
384 
385  // these things are always for the CKF track
386  outPtrP->back().setTrackHighPurity(
387  cand.trackRef().isNonnull() &&
388  cand.trackRef()->quality(reco::Track::highPurity));
389  if (cand.muonRef().isNonnull()) {
390  outPtrP->back().setMuonID(cand.muonRef()->isStandAloneMuon(),
391  cand.muonRef()->isGlobalMuon());
392  }
393  } else {
394  if (!PVs->empty()) {
395  PV = reco::VertexRef(PVs, 0);
396  PVpos = PV->position();
397  }
398 
399  outPtrP->push_back(
400  pat::PackedCandidate(cand.polarP4(), PVpos, cand.pt(), cand.eta(),
401  cand.phi(), cand.pdgId(), PVRefProd, PV.key()));
402  outPtrP->back().setAssociationQuality(
405  }
406 
407  // neutrals and isolated charged hadrons
408 
409  bool isIsolatedChargedHadron = false;
412  *(chargedHadronIsolationHandle.product());
413  isIsolatedChargedHadron =
414  ((cand.pt() > minPtForChargedHadronProperties_) &&
415  (chargedHadronIsolation[reco::PFCandidateRef(cands, ic)]));
416  outPtrP->back().setIsIsolatedChargedHadron(isIsolatedChargedHadron);
417  }
418 
419  if (abs(cand.pdgId()) == 1 || abs(cand.pdgId()) == 130) {
420  outPtrP->back().setHcalFraction(cand.hcalEnergy() /
421  (cand.ecalEnergy() + cand.hcalEnergy()));
422  } else if (cand.charge() && cand.pt() > 0.5) {
423  outPtrP->back().setHcalFraction(cand.hcalEnergy() /
424  (cand.ecalEnergy() + cand.hcalEnergy()));
425  outPtrP->back().setCaloFraction((cand.hcalEnergy() + cand.ecalEnergy()) /
426  cand.energy());
427  } else {
428  outPtrP->back().setHcalFraction(0);
429  outPtrP->back().setCaloFraction(0);
430  }
431 
432  if (isIsolatedChargedHadron) {
433  outPtrP->back().setRawCaloFraction(
434  (cand.rawEcalEnergy() + cand.rawHcalEnergy()) / cand.energy());
435  outPtrP->back().setRawHcalFraction(
436  cand.rawHcalEnergy() / (cand.rawEcalEnergy() + cand.rawHcalEnergy()));
437  } else {
438  outPtrP->back().setRawCaloFraction(0);
439  outPtrP->back().setRawHcalFraction(0);
440  }
441 
442  std::vector<float> dummyVector;
443  dummyVector.clear();
444  pat::HcalDepthEnergyFractions hcalDepthEFrac(dummyVector);
445 
446  // storing HcalDepthEnergyFraction information
449  abs(cand.pdgId())) != pfCandidateTypesForHcalDepth_.end()) {
451  fabs(outPtrP->back().eta()) >
452  1.3) { // storeHcalDepthEndcapOnly_==false -> store all eta of
453  // selected PF types, if true, only |eta|>1.3 of selected
454  // PF types will be stored
455  std::vector<float> hcalDepthEnergyFractionTmp(
456  cand.hcalDepthEnergyFractions().begin(),
457  cand.hcalDepthEnergyFractions().end());
458  hcalDepthEFrac.reset(hcalDepthEnergyFractionTmp);
459  }
460  }
461  hcalDepthEnergyFractions.push_back(hcalDepthEFrac);
462 
463  // specifically this is the PFLinker requirements to apply the e/gamma
464  // regression
465  if (cand.particleId() == reco::PFCandidate::e ||
467  cand.mva_nothing_gamma() > 0.)) {
468  outPtrP->back().setGoodEgamma();
469  }
470 
471  if (usePuppi_) {
472  reco::PFCandidateRef pkref(cands, ic);
473  // outPtrP->back().setPuppiWeight( (*puppiWeight)[pkref]);
474 
475  float puppiWeightVal = (*puppiWeight)[pkref];
476  float puppiWeightNoLepVal = 0.0;
477  // Check the "no lepton" puppi weights.
478  // If present, then it is not a lepton, use stored weight
479  // If absent, it is a lepton, so set the weight to 1.0
480  if (puppiWeightNoLep.isValid()) {
481  // Look for the pointer inside the "no lepton" candidate collection.
482  auto pkrefPtr = pkref->sourceCandidatePtr(0);
483 
484  bool foundNoLep = false;
485  for (size_t ipcnl = 0; ipcnl < puppiCandsNoLepPtrs.size(); ipcnl++) {
486  if (puppiCandsNoLepPtrs[ipcnl] == pkrefPtr) {
487  foundNoLep = true;
488  puppiWeightNoLepVal =
489  puppiCandsNoLep->at(ipcnl).pt() /
490  cand.pt(); // a hack for now, should use the value map
491  break;
492  }
493  }
494  if (!foundNoLep || puppiWeightNoLepVal > 1) {
495  puppiWeightNoLepVal = 1.0;
496  }
497  }
498  outPtrP->back().setPuppiWeight(puppiWeightVal, puppiWeightNoLepVal);
499 
500  mappingPuppi[((*puppiCandsMap)[pkref]).key()] = ic;
501  }
502 
503  if (storeTiming_ && cand.isTimeValid()) {
504  outPtrP->back().setTime(cand.time(), cand.timeError());
505  }
506 
507  mapping[ic] = ic; // trivial at the moment!
508  if (cand.trackRef().isNonnull() && cand.trackRef().id() == TKOrigs.id()) {
509  mappingTk[cand.trackRef().key()] = ic;
510  }
511  }
512 
513  auto outPtrPSorted = std::make_unique<std::vector<pat::PackedCandidate>>();
514  std::vector<size_t> order = sort_indexes(*outPtrP);
515  std::vector<size_t> reverseOrder(order.size());
516  for (size_t i = 0, nc = cands->size(); i < nc; i++) {
517  outPtrPSorted->push_back((*outPtrP)[order[i]]);
518  reverseOrder[order[i]] = i;
519  mappingReverse[order[i]] = i;
520  hcalDepthEnergyFractions_Ordered.push_back(
521  hcalDepthEnergyFractions[order[i]]);
522  }
523 
524  // Fix track association for sorted candidates
525  for (size_t i = 0, ntk = mappingTk.size(); i < ntk; i++) {
526  if (mappingTk[i] >= 0)
527  mappingTk[i] = reverseOrder[mappingTk[i]];
528  }
529 
530  for (size_t i = 0, ntk = mappingPuppi.size(); i < ntk; i++) {
531  mappingPuppi[i] = reverseOrder[mappingPuppi[i]];
532  }
533 
535  iEvent.put(std::move(outPtrPSorted));
536 
537  // now build the two maps
538  auto pf2pc =
539  std::make_unique<edm::Association<pat::PackedCandidateCollection>>(oh);
540  auto pc2pf =
541  std::make_unique<edm::Association<reco::PFCandidateCollection>>(cands);
544  pf2pcFiller.insert(cands, mappingReverse.begin(), mappingReverse.end());
545  pc2pfFiller.insert(oh, order.begin(), order.end());
546  // include also the mapping track -> packed PFCand
547  pf2pcFiller.insert(TKOrigs, mappingTk.begin(), mappingTk.end());
548  if (usePuppi_)
549  pf2pcFiller.insert(puppiCands, mappingPuppi.begin(), mappingPuppi.end());
550 
551  pf2pcFiller.fill();
552  pc2pfFiller.fill();
553  iEvent.put(std::move(pf2pc));
554  iEvent.put(std::move(pc2pf));
555 
556  // HCAL depth energy fraction additions using ValueMap
557  auto hcalDepthEnergyFractionsV =
558  std::make_unique<edm::ValueMap<HcalDepthEnergyFractions>>();
560  fillerHcalDepthEnergyFractions(*hcalDepthEnergyFractionsV);
561  fillerHcalDepthEnergyFractions.insert(
562  cands, hcalDepthEnergyFractions_Ordered.begin(),
563  hcalDepthEnergyFractions_Ordered.end());
564  fillerHcalDepthEnergyFractions.fill();
565 
566  if (not pfCandidateTypesForHcalDepth_.empty())
567  iEvent.put(std::move(hcalDepthEnergyFractionsV),
568  "hcalDepthEnergyFractions");
569 }
570 
BranchAliasSetterT< ProductType > produces()
declare what type of product will make and with which optional label
T getParameter(std::string const &) const
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:222
int pdgId() const final
PDG identifier.
const Point & referencePoint() const
Reference point on the track.
Definition: TrackBase.h:714
virtual double pz() const =0
z coordinate of momentum vector
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
double eta() const final
momentum pseudorapidity
const PolarLorentzVector & polarP4() const final
four-momentum Lorentz vector
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:225
int covarianceSchema() const
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
Definition: HitPattern.cc:365
key_type key() const
Definition: Ptr.h:185
const edm::EDGetTokenT< std::vector< reco::PFCandidate > > PuppiCandsNoLep_
ProductID id() const
Definition: HandleBase.cc:15
float mva_nothing_gamma() const
mva for gamma detection
Definition: PFCandidate.h:333
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
const std::array< float, 7 > & hcalDepthEnergyFractions() const
fraction of hcal energy at a given depth (index 0..6 for depth 1..7)
Definition: PFCandidate.h:430
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:15
size_type size() const
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:678
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int charge() const final
electric charge
Definition: LeafCandidate.h:91
float time() const
Definition: PFCandidate.h:421
static const int qualityMap[8]
conversion map from quality flags used in PV association and miniAOD one
const edm::EDGetTokenT< reco::PFCandidateCollection > Cands_
key_type key() const
Accessor for product key.
Definition: Ref.h:263
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const reco::VertexRef vertexRef() const
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
const edm::EDGetTokenT< edm::ValueMap< int > > PVAssoQuality_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: HeavyIon.h:7
const edm::EDGetTokenT< edm::ValueMap< float > > PuppiWeightNoLep_
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:442
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:656
bool isTimeValid() const
do we have a valid time information
Definition: PFCandidate.h:419
virtual double py() const =0
y coordinate of momentum vector
int charge() const override
electric charge
int iEvent
Definition: GenABIO.cc:224
PATPackedCandidateProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:684
void reset(std::vector< float > v)
double pt() const
track transverse momentum
Definition: TrackBase.h:654
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double energy() const final
energy
float calcDxy(float dx, float dy, float phi) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< std::vector< reco::PFCandidate > > PuppiCands_
reco::TrackRef track() const override
reference to a track
static std::vector< size_t > sort_indexes(const std::vector< T > &v)
const edm::EDGetTokenT< reco::TrackCollection > TKOrigs_
const edm::EDGetTokenT< edm::ValueMap< reco::CandidatePtr > > PuppiCandsMap_
bool isValid() const
Definition: HandleBase.h:74
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
reco::MuonRef muonRef() const
Definition: PFCandidate.cc:459
ii
Definition: cuy.py:590
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
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...
Definition: TrackBase.h:642
LostInnerHits
Enumerator specifying the.
double eta() const override
momentum pseudorapidity
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
const edm::EDGetTokenT< edm::ValueMap< bool > > ChargedHadronIsolation_
float calcDz(reco::Candidate::Point p, reco::Candidate::Point v, const reco::Candidate &c) const
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
T const * product() const
Definition: Handle.h:74
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:479
const std::vector< int > covariancePackingSchemas_
virtual double pt() const =0
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
def encode(args, files)
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
const edm::EDGetTokenT< edm::ValueMap< float > > PuppiWeight_
const edm::EDGetTokenT< reco::VertexCollection > PVOrigs_
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:990
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > SVWhiteLists_
fixed size matrix
#define begin
Definition: vmac.h:32
HLT enums.
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:480
const std::vector< int > pfCandidateTypesForHcalDepth_
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:232
int numberOfValidPixelHits() const
Definition: HitPattern.h:916
math::XYZPoint Point
point in the space
Definition: Candidate.h:41
const_iterator end() const
const edm::EDGetTokenT< edm::Association< reco::VertexCollection > > PVAsso_
const edm::EDGetTokenT< reco::VertexCollection > PVs_
virtual double px() const =0
x coordinate of momentum vector
virtual ParticleType particleId() const
Definition: PFCandidate.h:374
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:553
static bool candsOrdering(pat::PackedCandidate const &i, pat::PackedCandidate const &j)
double phi() const final
momentum azimuthal angle
float timeError() const
Definition: PFCandidate.h:423
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
def move(src, dest)
Definition: eostools.py:511
double rawHcalEnergy() const
return raw Hcal energy
Definition: PFCandidate.h:235