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 
44  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
45 
46  // sorting of cands to maximize the zlib compression
47  static bool candsOrdering(pat::PackedCandidate const &i, pat::PackedCandidate const &j) {
48  if (std::abs(i.charge()) == std::abs(j.charge())) {
49  if (i.charge() != 0) {
50  if (i.hasTrackDetails() and !j.hasTrackDetails())
51  return true;
52  if (!i.hasTrackDetails() and j.hasTrackDetails())
53  return false;
54  if (i.covarianceSchema() > j.covarianceSchema())
55  return true;
56  if (i.covarianceSchema() < j.covarianceSchema())
57  return false;
58  }
59  if (i.vertexRef() == j.vertexRef())
60  return i.eta() > j.eta();
61  else
62  return i.vertexRef().key() < j.vertexRef().key();
63  }
64  return std::abs(i.charge()) > std::abs(j.charge());
65  }
66 
67  template <typename T>
68  static std::vector<size_t> sort_indexes(const std::vector<T> &v) {
69  std::vector<size_t> idx(v.size());
70  for (size_t i = 0; i != idx.size(); ++i)
71  idx[i] = i;
72  std::sort(idx.begin(), idx.end(), [&v](size_t i1, size_t i2) { return candsOrdering(v[i1], v[i2]); });
73  return idx;
74  }
75 
76  private:
77  // if PuppiSrc && PuppiNoLepSrc are empty, usePuppi is false
78  // otherwise assumes that if they are set, you wanted to use puppi and will
79  // throw an exception if the puppis are not found
80  const bool usePuppi_;
81 
93  std::vector<edm::EDGetTokenT<edm::View<reco::Candidate>>> SVWhiteLists_;
96 
101  const std::vector<int> covariancePackingSchemas_;
102 
103  const std::vector<int> pfCandidateTypesForHcalDepth_;
105 
106  const bool storeTiming_;
107  const bool storePfGammaEnFr_;
108 
109  // for debugging
110  float calcDxy(float dx, float dy, float phi) const { return -dx * std::sin(phi) + dy * std::cos(phi); }
112  return p.Z() - v.Z() - ((p.X() - v.X()) * c.px() + (p.Y() - v.Y()) * c.py()) * c.pz() / (c.pt() * c.pt());
113  }
114  };
115 } // namespace pat
116 
118  : usePuppi_(!iConfig.getParameter<edm::InputTag>("PuppiSrc").encode().empty() ||
119  !iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc").encode().empty()),
120  Cands_(consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("inputCollection"))),
121  PVs_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("inputVertices"))),
122  PVAsso_(
123  consumes<edm::Association<reco::VertexCollection>>(iConfig.getParameter<edm::InputTag>("vertexAssociator"))),
124  PVAssoQuality_(consumes<edm::ValueMap<int>>(iConfig.getParameter<edm::InputTag>("vertexAssociator"))),
125  PVOrigs_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("originalVertices"))),
126  TKOrigs_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("originalTracks"))),
127  PuppiWeight_(usePuppi_ ? consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("PuppiSrc"))
128  : edm::EDGetTokenT<edm::ValueMap<float>>()),
129  PuppiWeightNoLep_(usePuppi_ ? consumes<edm::ValueMap<float>>(iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc"))
130  : edm::EDGetTokenT<edm::ValueMap<float>>()),
132  ? consumes<edm::ValueMap<reco::CandidatePtr>>(iConfig.getParameter<edm::InputTag>("PuppiSrc"))
133  : edm::EDGetTokenT<edm::ValueMap<reco::CandidatePtr>>()),
134  PuppiCands_(usePuppi_ ? consumes<std::vector<reco::PFCandidate>>(iConfig.getParameter<edm::InputTag>("PuppiSrc"))
135  : edm::EDGetTokenT<std::vector<reco::PFCandidate>>()),
137  usePuppi_ ? consumes<std::vector<reco::PFCandidate>>(iConfig.getParameter<edm::InputTag>("PuppiNoLepSrc"))
138  : edm::EDGetTokenT<std::vector<reco::PFCandidate>>()),
139  storeChargedHadronIsolation_(!iConfig.getParameter<edm::InputTag>("chargedHadronIsolation").encode().empty()),
141  consumes<edm::ValueMap<bool>>(iConfig.getParameter<edm::InputTag>("chargedHadronIsolation"))),
142  minPtForChargedHadronProperties_(iConfig.getParameter<double>("minPtForChargedHadronProperties")),
143  minPtForTrackProperties_(iConfig.getParameter<double>("minPtForTrackProperties")),
144  minPtForLowQualityTrackProperties_(iConfig.getParameter<double>("minPtForLowQualityTrackProperties")),
145  covarianceVersion_(iConfig.getParameter<int>("covarianceVersion")),
146  covariancePackingSchemas_(iConfig.getParameter<std::vector<int>>("covariancePackingSchemas")),
147  pfCandidateTypesForHcalDepth_(iConfig.getParameter<std::vector<int>>("pfCandidateTypesForHcalDepth")),
148  storeHcalDepthEndcapOnly_(iConfig.getParameter<bool>("storeHcalDepthEndcapOnly")),
149  storeTiming_(iConfig.getParameter<bool>("storeTiming")),
150  storePfGammaEnFr_(iConfig.getParameter<bool>("storePfGammaEnFractions")) {
151  std::vector<edm::InputTag> sv_tags =
152  iConfig.getParameter<std::vector<edm::InputTag>>("secondaryVerticesForWhiteList");
153  for (const auto &itag : sv_tags) {
155  }
156 
157  produces<std::vector<pat::PackedCandidate>>();
158  produces<edm::Association<pat::PackedCandidateCollection>>();
159  produces<edm::Association<reco::PFCandidateCollection>>();
160 
161  if (not pfCandidateTypesForHcalDepth_.empty())
162  produces<edm::ValueMap<pat::HcalDepthEnergyFractions>>("hcalDepthEnergyFractions");
163 }
164 
166 
169  iEvent.getByToken(Cands_, cands);
170 
174  edm::Handle<edm::ValueMap<float>> puppiWeightNoLep;
176  std::vector<reco::CandidatePtr> puppiCandsNoLepPtrs;
177  if (usePuppi_) {
178  iEvent.getByToken(PuppiWeight_, puppiWeight);
179  iEvent.getByToken(PuppiCandsMap_, puppiCandsMap);
180  iEvent.getByToken(PuppiCands_, puppiCands);
181  iEvent.getByToken(PuppiWeightNoLep_, puppiWeightNoLep);
182  iEvent.getByToken(PuppiCandsNoLep_, puppiCandsNoLep);
183  for (auto pup : *puppiCandsNoLep) {
184  puppiCandsNoLepPtrs.push_back(pup.sourceCandidatePtr(0));
185  }
186  }
187  std::vector<int> mappingPuppi(usePuppi_ ? puppiCands->size() : 0);
188 
190  iEvent.getByToken(PVOrigs_, PVOrigs);
191 
193  iEvent.getByToken(PVAsso_, assoHandle);
194  edm::Handle<edm::ValueMap<int>> assoQualityHandle;
195  iEvent.getByToken(PVAssoQuality_, assoQualityHandle);
196  const edm::Association<reco::VertexCollection> &associatedPV = *(assoHandle.product());
197  const edm::ValueMap<int> &associationQuality = *(assoQualityHandle.product());
198 
199  edm::Handle<edm::ValueMap<bool>> chargedHadronIsolationHandle;
201  iEvent.getByToken(ChargedHadronIsolation_, chargedHadronIsolationHandle);
202 
203  std::set<unsigned int> whiteList;
204  std::set<reco::TrackRef> whiteListTk;
205  for (auto itoken : SVWhiteLists_) {
206  edm::Handle<edm::View<reco::Candidate>> svWhiteListHandle;
207  iEvent.getByToken(itoken, svWhiteListHandle);
208  const edm::View<reco::Candidate> &svWhiteList = *(svWhiteListHandle.product());
209  for (unsigned int i = 0; i < svWhiteList.size(); i++) {
210  // Whitelist via Ptrs
211  for (unsigned int j = 0; j < svWhiteList[i].numberOfSourceCandidatePtrs(); j++) {
212  const edm::Ptr<reco::Candidate> &c = svWhiteList[i].sourceCandidatePtr(j);
213  if (c.id() == cands.id())
214  whiteList.insert(c.key());
215  }
216  // Whitelist via RecoCharged
217  for (auto dau = svWhiteList[i].begin(); dau != svWhiteList[i].end(); dau++) {
218  const reco::RecoChargedCandidate *chCand = dynamic_cast<const reco::RecoChargedCandidate *>(&(*dau));
219  if (chCand != nullptr) {
220  whiteListTk.insert(chCand->track());
221  }
222  }
223  }
224  }
225 
227  iEvent.getByToken(PVs_, PVs);
228  reco::VertexRef PV(PVs.id());
229  reco::VertexRefProd PVRefProd(PVs);
230  math::XYZPoint PVpos;
231 
232  std::vector<pat::HcalDepthEnergyFractions> hcalDepthEnergyFractions;
233  hcalDepthEnergyFractions.reserve(cands->size());
234  std::vector<pat::HcalDepthEnergyFractions> hcalDepthEnergyFractions_Ordered;
235  hcalDepthEnergyFractions_Ordered.reserve(cands->size());
236 
238  iEvent.getByToken(TKOrigs_, TKOrigs);
239  auto outPtrP = std::make_unique<std::vector<pat::PackedCandidate>>();
240  std::vector<int> mapping(cands->size());
241  std::vector<int> mappingReverse(cands->size());
242  std::vector<int> mappingTk(TKOrigs->size(), -1);
243 
244  for (unsigned int ic = 0, nc = cands->size(); ic < nc; ++ic) {
245  const reco::PFCandidate &cand = (*cands)[ic];
246  const reco::Track *ctrack = nullptr;
247  if ((abs(cand.pdgId()) == 11 || cand.pdgId() == 22) && cand.gsfTrackRef().isNonnull()) {
248  ctrack = &*cand.gsfTrackRef();
249  } else if (cand.trackRef().isNonnull()) {
250  ctrack = &*cand.trackRef();
251  }
252  if (ctrack) {
253  float dist = 1e99;
254  int pvi = -1;
255  for (size_t ii = 0; ii < PVs->size(); ii++) {
256  float dz = std::abs(ctrack->dz(((*PVs)[ii]).position()));
257  if (dz < dist) {
258  pvi = ii;
259  dist = dz;
260  }
261  }
262  PV = reco::VertexRef(PVs, pvi);
263  math::XYZPoint vtx = cand.vertex();
265  const reco::VertexRef &PVOrig = associatedPV[reco::CandidatePtr(cands, ic)];
266  if (PVOrig.isNonnull())
267  PV = reco::VertexRef(PVs,
268  PVOrig.key()); // WARNING: assume the PV slimmer is keeping same order
269  int quality = associationQuality[reco::CandidatePtr(cands, ic)];
270  // if ((size_t)pvi!=PVOrig.key()) std::cout << "not closest in Z"
271  // << pvi << " " << PVOrig.key() << " " << cand.pt() << " " <<
272  // quality << std::endl; TrajectoryStateOnSurface tsos =
273  // extrapolator.extrapolate(trajectoryStateTransform::initialFreeState(*ctrack,&*magneticField),
274  // RecoVertex::convertPos(PV->position()));
275  // vtx = tsos.globalPosition();
276  // phiAtVtx = tsos.globalDirection().phi();
277  vtx = ctrack->referencePoint();
278  float ptTrk = ctrack->pt();
279  float etaAtVtx = ctrack->eta();
280  float phiAtVtx = ctrack->phi();
281 
283  if (nlost == 0) {
286  }
287  } else {
289  }
290 
291  outPtrP->push_back(
292  pat::PackedCandidate(cand.polarP4(), vtx, ptTrk, etaAtVtx, phiAtVtx, cand.pdgId(), PVRefProd, PV.key()));
293  outPtrP->back().setAssociationQuality(pat::PackedCandidate::PVAssociationQuality(qualityMap[quality]));
294  outPtrP->back().setCovarianceVersion(covarianceVersion_);
295  if (cand.trackRef().isNonnull() && PVOrig.isNonnull() && PVOrig->trackWeight(cand.trackRef()) > 0.5 &&
296  quality == 7) {
297  outPtrP->back().setAssociationQuality(pat::PackedCandidate::UsedInFitTight);
298  }
299  // properties of the best track
300  outPtrP->back().setLostInnerHits(lostHits);
301  if (outPtrP->back().pt() > minPtForTrackProperties_ || outPtrP->back().ptTrk() > minPtForTrackProperties_ ||
302  whiteList.find(ic) != whiteList.end() ||
303  (cand.trackRef().isNonnull() && whiteListTk.find(cand.trackRef()) != whiteListTk.end())) {
304  outPtrP->back().setFirstHit(ctrack->hitPattern().getHitPattern(reco::HitPattern::TRACK_HITS, 0));
305  if (abs(outPtrP->back().pdgId()) == 22) {
306  outPtrP->back().setTrackProperties(*ctrack, covariancePackingSchemas_[4], covarianceVersion_);
307  } else {
308  if (ctrack->hitPattern().numberOfValidPixelHits() > 0) {
309  outPtrP->back().setTrackProperties(*ctrack,
311  covarianceVersion_); // high quality
312  } else {
313  outPtrP->back().setTrackProperties(*ctrack, covariancePackingSchemas_[1], covarianceVersion_);
314  }
315  }
316  // outPtrP->back().setTrackProperties(*ctrack,tsos.curvilinearError());
317  } else {
318  if (outPtrP->back().pt() > minPtForLowQualityTrackProperties_) {
319  if (ctrack->hitPattern().numberOfValidPixelHits() > 0)
320  outPtrP->back().setTrackProperties(*ctrack,
322  covarianceVersion_); // low quality, with pixels
323  else
324  outPtrP->back().setTrackProperties(*ctrack,
326  covarianceVersion_); // low quality, without pixels
327  }
328  }
329 
330  // these things are always for the CKF track
331  outPtrP->back().setTrackHighPurity(cand.trackRef().isNonnull() &&
332  cand.trackRef()->quality(reco::Track::highPurity));
333  if (cand.muonRef().isNonnull()) {
334  outPtrP->back().setMuonID(cand.muonRef()->isStandAloneMuon(), cand.muonRef()->isGlobalMuon());
335  }
336  } else {
337  if (!PVs->empty()) {
338  PV = reco::VertexRef(PVs, 0);
339  PVpos = PV->position();
340  }
341 
342  outPtrP->push_back(pat::PackedCandidate(
343  cand.polarP4(), PVpos, cand.pt(), cand.eta(), cand.phi(), cand.pdgId(), PVRefProd, PV.key()));
344  outPtrP->back().setAssociationQuality(
346  }
347 
348  // neutrals and isolated charged hadrons
349 
350  bool isIsolatedChargedHadron = false;
352  const edm::ValueMap<bool> &chargedHadronIsolation = *(chargedHadronIsolationHandle.product());
353  isIsolatedChargedHadron =
354  ((cand.pt() > minPtForChargedHadronProperties_) && (chargedHadronIsolation[reco::PFCandidateRef(cands, ic)]));
355  outPtrP->back().setIsIsolatedChargedHadron(isIsolatedChargedHadron);
356  }
357 
358  if (abs(cand.pdgId()) == 1 || abs(cand.pdgId()) == 130) {
359  outPtrP->back().setHcalFraction(cand.hcalEnergy() / (cand.ecalEnergy() + cand.hcalEnergy()));
360  } else if ((cand.charge() || (storePfGammaEnFr_ && cand.pdgId() == 22)) && cand.pt() > 0.5) {
361  outPtrP->back().setHcalFraction(cand.hcalEnergy() / (cand.ecalEnergy() + cand.hcalEnergy()));
362  outPtrP->back().setCaloFraction((cand.hcalEnergy() + cand.ecalEnergy()) / cand.energy());
363  } else {
364  outPtrP->back().setHcalFraction(0);
365  outPtrP->back().setCaloFraction(0);
366  }
367 
368  if (isIsolatedChargedHadron) {
369  outPtrP->back().setRawCaloFraction((cand.rawEcalEnergy() + cand.rawHcalEnergy()) / cand.energy());
370  outPtrP->back().setRawHcalFraction(cand.rawHcalEnergy() / (cand.rawEcalEnergy() + cand.rawHcalEnergy()));
371  } else {
372  outPtrP->back().setRawCaloFraction(0);
373  outPtrP->back().setRawHcalFraction(0);
374  }
375 
376  std::vector<float> dummyVector;
377  dummyVector.clear();
378  pat::HcalDepthEnergyFractions hcalDepthEFrac(dummyVector);
379 
380  // storing HcalDepthEnergyFraction information
384  fabs(outPtrP->back().eta()) > 1.3) { // storeHcalDepthEndcapOnly_==false -> store all eta of
385  // selected PF types, if true, only |eta|>1.3 of selected
386  // PF types will be stored
387  std::vector<float> hcalDepthEnergyFractionTmp(cand.hcalDepthEnergyFractions().begin(),
388  cand.hcalDepthEnergyFractions().end());
389  hcalDepthEFrac.reset(hcalDepthEnergyFractionTmp);
390  }
391  }
392  hcalDepthEnergyFractions.push_back(hcalDepthEFrac);
393 
394  // specifically this is the PFLinker requirements to apply the e/gamma
395  // regression
396  if (cand.particleId() == reco::PFCandidate::e ||
397  (cand.particleId() == reco::PFCandidate::gamma && cand.mva_nothing_gamma() > 0.)) {
398  outPtrP->back().setGoodEgamma();
399  }
400 
401  if (usePuppi_) {
402  reco::PFCandidateRef pkref(cands, ic);
403  // outPtrP->back().setPuppiWeight( (*puppiWeight)[pkref]);
404 
405  float puppiWeightVal = (*puppiWeight)[pkref];
406  float puppiWeightNoLepVal = 0.0;
407  // Check the "no lepton" puppi weights.
408  // If present, then it is not a lepton, use stored weight
409  // If absent, it is a lepton, so set the weight to 1.0
410  if (puppiWeightNoLep.isValid()) {
411  // Look for the pointer inside the "no lepton" candidate collection.
412  auto pkrefPtr = pkref->sourceCandidatePtr(0);
413 
414  bool foundNoLep = false;
415  for (size_t ipcnl = 0; ipcnl < puppiCandsNoLepPtrs.size(); ipcnl++) {
416  if (puppiCandsNoLepPtrs[ipcnl] == pkrefPtr) {
417  foundNoLep = true;
418  puppiWeightNoLepVal =
419  puppiCandsNoLep->at(ipcnl).pt() / cand.pt(); // a hack for now, should use the value map
420  break;
421  }
422  }
423  if (!foundNoLep || puppiWeightNoLepVal > 1) {
424  puppiWeightNoLepVal = 1.0;
425  }
426  }
427  outPtrP->back().setPuppiWeight(puppiWeightVal, puppiWeightNoLepVal);
428 
429  mappingPuppi[((*puppiCandsMap)[pkref]).key()] = ic;
430  }
431 
432  if (storeTiming_ && cand.isTimeValid()) {
433  outPtrP->back().setTime(cand.time(), cand.timeError());
434  }
435 
436  mapping[ic] = ic; // trivial at the moment!
437  if (cand.trackRef().isNonnull() && cand.trackRef().id() == TKOrigs.id()) {
438  mappingTk[cand.trackRef().key()] = ic;
439  }
440  }
441 
442  auto outPtrPSorted = std::make_unique<std::vector<pat::PackedCandidate>>();
443  std::vector<size_t> order = sort_indexes(*outPtrP);
444  std::vector<size_t> reverseOrder(order.size());
445  for (size_t i = 0, nc = cands->size(); i < nc; i++) {
446  outPtrPSorted->push_back((*outPtrP)[order[i]]);
447  reverseOrder[order[i]] = i;
448  mappingReverse[order[i]] = i;
449  hcalDepthEnergyFractions_Ordered.push_back(hcalDepthEnergyFractions[order[i]]);
450  }
451 
452  // Fix track association for sorted candidates
453  for (size_t i = 0, ntk = mappingTk.size(); i < ntk; i++) {
454  if (mappingTk[i] >= 0)
455  mappingTk[i] = reverseOrder[mappingTk[i]];
456  }
457 
458  for (size_t i = 0, ntk = mappingPuppi.size(); i < ntk; i++) {
459  mappingPuppi[i] = reverseOrder[mappingPuppi[i]];
460  }
461 
463 
464  // now build the two maps
465  auto pf2pc = std::make_unique<edm::Association<pat::PackedCandidateCollection>>(oh);
466  auto pc2pf = std::make_unique<edm::Association<reco::PFCandidateCollection>>(cands);
469  pf2pcFiller.insert(cands, mappingReverse.begin(), mappingReverse.end());
470  pc2pfFiller.insert(oh, order.begin(), order.end());
471  // include also the mapping track -> packed PFCand
472  pf2pcFiller.insert(TKOrigs, mappingTk.begin(), mappingTk.end());
473  if (usePuppi_)
474  pf2pcFiller.insert(puppiCands, mappingPuppi.begin(), mappingPuppi.end());
475 
476  pf2pcFiller.fill();
477  pc2pfFiller.fill();
478  iEvent.put(std::move(pf2pc));
479  iEvent.put(std::move(pc2pf));
480 
481  // HCAL depth energy fraction additions using ValueMap
482  auto hcalDepthEnergyFractionsV = std::make_unique<edm::ValueMap<HcalDepthEnergyFractions>>();
483  edm::ValueMap<HcalDepthEnergyFractions>::Filler fillerHcalDepthEnergyFractions(*hcalDepthEnergyFractionsV);
484  fillerHcalDepthEnergyFractions.insert(
485  cands, hcalDepthEnergyFractions_Ordered.begin(), hcalDepthEnergyFractions_Ordered.end());
486  fillerHcalDepthEnergyFractions.fill();
487 
488  if (not pfCandidateTypesForHcalDepth_.empty())
489  iEvent.put(std::move(hcalDepthEnergyFractionsV), "hcalDepthEnergyFractions");
490 }
491 
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:720
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:684
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:690
void reset(std::vector< float > v)
double pt() const
track transverse momentum
Definition: TrackBase.h:660
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:648
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:485
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