CMS 3D CMS Logo

PATObject.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef DataFormats_PatCandidates_PATObject_h
5 #define DataFormats_PatCandidates_PATObject_h
6 
22 #include <vector>
23 #include <string>
24 #include <iosfwd>
25 
28 
30 
33 
35 
37 
38 namespace pat {
40  const std::string &get_empty_str();
41 
42  template <class ObjectType>
43  class PATObject : public ObjectType {
44  public:
46 
48  PATObject();
50  PATObject(const ObjectType &obj);
54  PATObject(const edm::Ptr<ObjectType> &ref);
56  ~PATObject() override {}
57  // returns a clone // NO: ObjectType can be an abstract type like reco::Candidate
58  // virtual PATObject<ObjectType> * clone() const ; // for which the clone() can't be defined
59 
61  const reco::Candidate *originalObject() const;
64 
68 
72  const TriggerObjectStandAlone *triggerObjectMatch(const size_t idx = 0) const;
76  const trigger::TriggerObjectType triggerObjectType) const;
77  const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const unsigned triggerObjectType) const {
78  return triggerObjectMatchesByType(trigger::TriggerObjectType(triggerObjectType));
79  };
80  // for backward compatibility
81  const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID(const unsigned triggerObjectType) const {
82  return triggerObjectMatchesByType(trigger::TriggerObjectType(triggerObjectType));
83  };
86  const size_t idx = 0) const;
87  const TriggerObjectStandAlone *triggerObjectMatchByType(const unsigned triggerObjectType,
88  const size_t idx = 0) const {
89  return triggerObjectMatchByType(trigger::TriggerObjectType(triggerObjectType), idx);
90  };
91  // for backward compatibility
92  const TriggerObjectStandAlone *triggerObjectMatchByFilterID(const unsigned triggerObjectType,
93  const size_t idx = 0) const {
94  return triggerObjectMatchByType(trigger::TriggerObjectType(triggerObjectType), idx);
95  };
98  // for RooT command line
101  };
103  const TriggerObjectStandAlone *triggerObjectMatchByCollection(const std::string &coll, const size_t idx = 0) const;
104  // for RooT command line
105  const TriggerObjectStandAlone *triggerObjectMatchByCollection(const char *coll, const size_t idx = 0) const {
107  };
110  // for RooT command line
112  return triggerObjectMatchesByCondition(std::string(nameCondition));
113  };
116  const size_t idx = 0) const;
117  // for RooT command line
118  const TriggerObjectStandAlone *triggerObjectMatchByCondition(const char *nameCondition,
119  const size_t idx = 0) const {
120  return triggerObjectMatchByCondition(std::string(nameCondition), idx);
121  };
126  const bool algoCondAccepted = true) const;
127  // for RooT command line
129  const bool algoCondAccepted = true) const {
130  return triggerObjectMatchesByAlgorithm(std::string(nameAlgorithm), algoCondAccepted);
131  };
132  // for the cut string parser
134  const unsigned algoCondAccepted) const {
135  return triggerObjectMatchesByAlgorithm(nameAlgorithm, bool(algoCondAccepted));
136  };
137  // for RooT command line and the cut string parser
139  const unsigned algoCondAccepted) const {
140  return triggerObjectMatchesByAlgorithm(std::string(nameAlgorithm), bool(algoCondAccepted));
141  };
146  const bool algoCondAccepted = true,
147  const size_t idx = 0) const;
148  // for RooT command line
149  const TriggerObjectStandAlone *triggerObjectMatchByAlgorithm(const char *nameAlgorithm,
150  const bool algoCondAccepted = true,
151  const size_t idx = 0) const {
152  return triggerObjectMatchByAlgorithm(std::string(nameAlgorithm), algoCondAccepted, idx);
153  };
154  // for the cut string parser
156  const unsigned algoCondAccepted,
157  const size_t idx = 0) const {
158  return triggerObjectMatchByAlgorithm(nameAlgorithm, bool(algoCondAccepted), idx);
159  };
160  // for RooT command line and the cut string parser
161  const TriggerObjectStandAlone *triggerObjectMatchByAlgorithm(const char *nameAlgorithm,
162  const unsigned algoCondAccepted,
163  const size_t idx = 0) const {
164  return triggerObjectMatchByAlgorithm(std::string(nameAlgorithm), bool(algoCondAccepted), idx);
165  };
168  // for RooT command line
170  return triggerObjectMatchesByFilter(std::string(labelFilter));
171  };
174  const size_t idx = 0) const;
175  // for RooT command line
176  const TriggerObjectStandAlone *triggerObjectMatchByFilter(const char *labelFilter, const size_t idx = 0) const {
177  return triggerObjectMatchByFilter(std::string(labelFilter), idx);
178  };
185  const bool pathLastFilterAccepted = false,
186  const bool pathL3FilterAccepted = true) const;
187  // for RooT command line
189  const bool pathLastFilterAccepted = false,
190  const bool pathL3FilterAccepted = true) const {
191  return triggerObjectMatchesByPath(std::string(namePath), pathLastFilterAccepted, pathL3FilterAccepted);
192  };
193  // for the cut string parser
195  const unsigned pathLastFilterAccepted,
196  const unsigned pathL3FilterAccepted = 1) const {
197  return triggerObjectMatchesByPath(namePath, bool(pathLastFilterAccepted), bool(pathL3FilterAccepted));
198  };
199  // for RooT command line and the cut string parser
201  const unsigned pathLastFilterAccepted,
202  const unsigned pathL3FilterAccepted = 1) const {
204  std::string(namePath), bool(pathLastFilterAccepted), bool(pathL3FilterAccepted));
205  };
212  const bool pathLastFilterAccepted = false,
213  const bool pathL3FilterAccepted = true,
214  const size_t idx = 0) const;
215  // for RooT command line
217  const bool pathLastFilterAccepted = false,
218  const bool pathL3FilterAccepted = true,
219  const size_t idx = 0) const {
220  return triggerObjectMatchByPath(std::string(namePath), pathLastFilterAccepted, pathL3FilterAccepted, idx);
221  };
222  // for the cut string parser
224  const unsigned pathLastFilterAccepted,
225  const unsigned pathL3FilterAccepted = 1,
226  const size_t idx = 0) const {
227  return triggerObjectMatchByPath(namePath, bool(pathLastFilterAccepted), bool(pathL3FilterAccepted), idx);
228  };
229  // for RooT command line and the cut string parser
231  const unsigned pathLastFilterAccepted,
232  const unsigned pathL3FilterAccepted = 1,
233  const size_t idx = 0) const {
235  std::string(namePath), bool(pathLastFilterAccepted), bool(pathL3FilterAccepted), idx);
236  };
239  triggerObjectMatchesEmbedded_.push_back(trigObj);
240  };
243  for (std::vector<TriggerObjectStandAlone>::iterator it = triggerObjectMatchesEmbedded_.begin(),
245  it != ed;
246  ++it)
247  it->unpackPathNames(names);
248  }
249 
251  const pat::LookupTableRecord &efficiency(const std::string &name) const;
253  std::vector<std::pair<std::string, pat::LookupTableRecord> > efficiencies() const;
255  const std::vector<std::string> &efficiencyNames() const { return efficiencyNames_; }
257  const std::vector<pat::LookupTableRecord> &efficiencyValues() const { return efficiencyValues_; }
262 
266  if (idx >= genParticlesSize())
267  return reco::GenParticleRef();
269  }
280  // implementation note: uint8_t instead of bool, because the string parser doesn't allow bool currently
281  reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge = 0) const;
282 
285  const reco::GenParticle *genParticle(size_t idx = 0) const {
287  return ref.isNonnull() ? ref.get() : nullptr;
288  }
290  size_t genParticlesSize() const {
291  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
292  }
295  std::vector<reco::GenParticleRef> genParticleRefs() const;
296 
298  void setGenParticleRef(const reco::GenParticleRef &ref, bool embed = false);
301  void addGenParticleRef(const reco::GenParticleRef &ref);
303  void setGenParticle(const reco::GenParticle &particle);
306  void embedGenParticle();
307 
309  bool hasOverlaps(const std::string &label) const;
312  const reco::CandidatePtrVector &overlaps(const std::string &label) const;
314  const std::vector<std::string> &overlapLabels() const { return overlapLabels_; }
319 
321  template <typename T>
322  const T *userData(const std::string &key) const {
324  return (data != nullptr ? data->template get<T>() : nullptr);
325  }
327  bool hasUserData(const std::string &key) const { return (userDataObject_(key) != nullptr); }
331  return (data != nullptr ? data->typeName() : get_empty_str());
332  };
334  const std::vector<std::string> &userDataNames() const { return userDataLabels_; }
335 
338  const void *userDataBare(const std::string &key) const {
340  return (data != nullptr ? data->bareData() : nullptr);
341  }
342 
347  template <typename T>
348  void addUserData(const std::string &label, const T &data, bool transientOnly = false, bool overwrite = false) {
349  std::unique_ptr<pat::UserData> made(pat::UserData::make<T>(data, transientOnly));
350  addUserDataObject_(label, std::move(made), overwrite);
351  }
352 
355  void addUserDataFromPtr(const std::string &label, const edm::Ptr<pat::UserData> &data, bool overwrite = false) {
356  std::unique_ptr<pat::UserData> cloned(data->clone());
358  }
359 
362  float userFloat(const std::string &key) const;
364  std::vector<float> userFloatRange(const std::string &key) const;
366  float userFloat(const char *key) const { return userFloat(std::string(key)); }
367 
369  void addUserFloat(const std::string &label, float data, const bool overwrite = false);
371  const std::vector<std::string> &userFloatNames() const { return userFloatLabels_; }
373  bool hasUserFloat(const std::string &key) const {
374  auto it = std::lower_bound(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
375  return (it != userFloatLabels_.cend() && *it == key);
376  }
378  bool hasUserFloat(const char *key) const { return hasUserFloat(std::string(key)); }
379 
382  int32_t userInt(const std::string &key) const;
384  std::vector<int> userIntRange(const std::string &key) const;
386  void addUserInt(const std::string &label, int32_t data, const bool overwrite = false);
388  const std::vector<std::string> &userIntNames() const { return userIntLabels_; }
390  bool hasUserInt(const std::string &key) const {
391  auto it = std::lower_bound(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
392  return (it != userIntLabels_.cend() && *it == key);
393  }
394 
399  void addUserCand(const std::string &label, const reco::CandidatePtr &data, const bool overwrite = false);
401  const std::vector<std::string> &userCandNames() const { return userCandLabels_; }
403  bool hasUserCand(const std::string &key) const {
404  auto it = std::lower_bound(userCandLabels_.cbegin(), userCandLabels_.cend(), key);
405  return (it != userCandLabels_.cend() && *it == key);
406  }
407 
408  // === New Kinematic Resolutions
411  const pat::CandKinResolution &getKinResolution(const std::string &label = "") const;
412 
414  bool hasKinResolution(const std::string &label = "") const;
415 
418 
420  double resolEta(const std::string &label = "") const { return getKinResolution(label).resolEta(this->p4()); }
421 
423  double resolTheta(const std::string &label = "") const { return getKinResolution(label).resolTheta(this->p4()); }
424 
426  double resolPhi(const std::string &label = "") const { return getKinResolution(label).resolPhi(this->p4()); }
427 
429  double resolE(const std::string &label = "") const { return getKinResolution(label).resolE(this->p4()); }
430 
432  double resolEt(const std::string &label = "") const { return getKinResolution(label).resolEt(this->p4()); }
433 
435  double resolP(const std::string &label = "") const { return getKinResolution(label).resolP(this->p4()); }
436 
438  double resolPt(const std::string &label = "") const { return getKinResolution(label).resolPt(this->p4()); }
439 
441  double resolPInv(const std::string &label = "") const { return getKinResolution(label).resolPInv(this->p4()); }
442 
444  double resolPx(const std::string &label = "") const { return getKinResolution(label).resolPx(this->p4()); }
445 
447  double resolPy(const std::string &label = "") const { return getKinResolution(label).resolPy(this->p4()); }
448 
450  double resolPz(const std::string &label = "") const { return getKinResolution(label).resolPz(this->p4()); }
451 
454  double resolM(const std::string &label = "") const { return getKinResolution(label).resolM(this->p4()); }
455 
456  protected:
457  // reference back to the original object
459 
462 
464  std::vector<pat::LookupTableRecord> efficiencyValues_;
466  std::vector<std::string> efficiencyNames_;
467 
469  std::vector<reco::GenParticleRef> genParticleRef_;
471  std::vector<reco::GenParticle> genParticleEmbedded_;
472 
474  std::vector<std::string> overlapLabels_;
476  std::vector<reco::CandidatePtrVector> overlapItems_;
477 
479  std::vector<std::string> userDataLabels_;
481  // User float values
482  std::vector<std::string> userFloatLabels_;
483  std::vector<float> userFloats_;
484  // User int values
485  std::vector<std::string> userIntLabels_;
486  std::vector<int32_t> userInts_;
487  // User candidate matches
488  std::vector<std::string> userCandLabels_;
489  std::vector<reco::CandidatePtr> userCands_;
490 
492  std::vector<pat::CandKinResolution> kinResolutions_;
495  std::vector<std::string> kinResolutionLabels_;
496 
497  void addUserDataObject_(const std::string &label, std::unique_ptr<pat::UserData> value, bool overwrite = false);
498 
499  private:
500  const pat::UserData *userDataObject_(const std::string &key) const;
501  };
502 
503  template <class ObjectType>
505 
506  template <class ObjectType>
508 
509  template <class ObjectType>
511  : ObjectType(*ref),
512  refToOrig_(ref.id(),
513  ref.get(),
514  ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
515  // which happens to be true, otherwise the line before this throws ex. already
516  {}
517 
518  template <class ObjectType>
519  PATObject<ObjectType>::PATObject(const edm::Ptr<ObjectType> &ref) : ObjectType(*ref), refToOrig_(ref) {}
520 
521  template <class ObjectType>
523  if (refToOrig_.isNull()) {
524  // this object was not produced from a reference, so no link to the
525  // original object exists -> return a 0-pointer
526  return nullptr;
527  } else if (!refToOrig_.isAvailable()) {
529  << "The original collection from which this PAT object was made is not present any more in the event, hence "
530  "you cannot access the originating object anymore.";
531  } else {
532  return refToOrig_.get();
533  }
534  }
535 
536  template <class ObjectType>
538  return refToOrig_;
539  }
540 
541  template <class ObjectType>
543  if (idx >= triggerObjectMatches().size())
544  return nullptr;
545  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, idx);
546  return ref.isNonnull() ? ref.get() : nullptr;
547  }
548 
549  template <class ObjectType>
551  const trigger::TriggerObjectType triggerObjectType) const {
553  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
554  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasTriggerObjectType(triggerObjectType))
555  matches.push_back(*(triggerObjectMatch(i)));
556  }
557  return matches;
558  }
559 
560  template <class ObjectType>
562  const trigger::TriggerObjectType triggerObjectType, const size_t idx) const {
563  std::vector<size_t> refs;
564  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
565  if (triggerObjectMatch(i) != nullptr && triggerObjectMatch(i)->hasTriggerObjectType(triggerObjectType))
566  refs.push_back(i);
567  }
568  if (idx >= refs.size())
569  return nullptr;
570  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
571  return ref.isNonnull() ? ref.get() : nullptr;
572  }
573 
574  template <class ObjectType>
576  const std::string &coll) const {
578  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
579  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasCollection(coll))
580  matches.push_back(*(triggerObjectMatch(i)));
581  }
582  return matches;
583  }
584 
585  template <class ObjectType>
587  const size_t idx) const {
588  std::vector<size_t> refs;
589  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
590  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasCollection(coll)) {
591  refs.push_back(i);
592  }
593  }
594  if (idx >= refs.size())
595  return nullptr;
596  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
597  return ref.isNonnull() ? ref.get() : nullptr;
598  }
599 
600  template <class ObjectType>
602  const std::string &nameCondition) const {
604  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
605  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasConditionName(nameCondition))
606  matches.push_back(*(triggerObjectMatch(i)));
607  }
608  return matches;
609  }
610 
611  template <class ObjectType>
613  const size_t idx) const {
614  std::vector<size_t> refs;
615  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
616  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasConditionName(nameCondition))
617  refs.push_back(i);
618  }
619  if (idx >= refs.size())
620  return nullptr;
621  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
622  return ref.isNonnull() ? ref.get() : nullptr;
623  }
624 
625  template <class ObjectType>
627  const std::string &nameAlgorithm, const bool algoCondAccepted) const {
629  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
630  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasAlgorithmName(nameAlgorithm, algoCondAccepted))
631  matches.push_back(*(triggerObjectMatch(i)));
632  }
633  return matches;
634  }
635 
636  template <class ObjectType>
638  const bool algoCondAccepted,
639  const size_t idx) const {
640  std::vector<size_t> refs;
641  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
642  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasAlgorithmName(nameAlgorithm, algoCondAccepted))
643  refs.push_back(i);
644  }
645  if (idx >= refs.size())
646  return nullptr;
647  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
648  return ref.isNonnull() ? ref.get() : nullptr;
649  }
650 
651  template <class ObjectType>
653  const std::string &labelFilter) const {
655  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
656  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasFilterLabel(labelFilter))
657  matches.push_back(*(triggerObjectMatch(i)));
658  }
659  return matches;
660  }
661 
662  template <class ObjectType>
664  const size_t idx) const {
665  std::vector<size_t> refs;
666  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
667  if (triggerObjectMatch(i) != 0 && triggerObjectMatch(i)->hasFilterLabel(labelFilter))
668  refs.push_back(i);
669  }
670  if (idx >= refs.size())
671  return nullptr;
672  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
673  return ref.isNonnull() ? ref.get() : nullptr;
674  }
675 
676  template <class ObjectType>
678  const std::string &namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted) const {
680  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
681  if (triggerObjectMatch(i) != nullptr &&
682  triggerObjectMatch(i)->hasPathName(namePath, pathLastFilterAccepted, pathL3FilterAccepted))
683  matches.push_back(*(triggerObjectMatch(i)));
684  }
685  return matches;
686  }
687 
688  template <class ObjectType>
690  const bool pathLastFilterAccepted,
691  const bool pathL3FilterAccepted,
692  const size_t idx) const {
693  std::vector<size_t> refs;
694  for (size_t i = 0; i < triggerObjectMatches().size(); ++i) {
695  if (triggerObjectMatch(i) != nullptr &&
696  triggerObjectMatch(i)->hasPathName(namePath, pathLastFilterAccepted, pathL3FilterAccepted))
697  refs.push_back(i);
698  }
699  if (idx >= refs.size())
700  return nullptr;
701  TriggerObjectStandAloneRef ref(&triggerObjectMatchesEmbedded_, refs.at(idx));
702  return ref.isNonnull() ? ref.get() : nullptr;
703  }
704 
705  template <class ObjectType>
707  // find the name in the (sorted) list of names
708  auto it = std::lower_bound(efficiencyNames_.cbegin(), efficiencyNames_.cend(), name);
709  if ((it == efficiencyNames_.end()) || (*it != name)) {
710  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
711  }
712  return efficiencyValues_[std::distance(efficiencyNames_.cbegin(), it)];
713  }
714 
715  template <class ObjectType>
716  std::vector<std::pair<std::string, pat::LookupTableRecord> > PATObject<ObjectType>::efficiencies() const {
717  std::vector<std::pair<std::string, pat::LookupTableRecord> > ret;
718  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
719  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
720  for (; itn != edn; ++itn, ++itv) {
721  ret.emplace_back(*itn, *itv);
722  }
723  return ret;
724  }
725 
726  template <class ObjectType>
728  // look for the name, or to the place where we can insert it without violating the alphabetic order
729  auto it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
730  const auto dist = std::distance(efficiencyNames_.begin(), it);
731  if (it == efficiencyNames_.end()) { // insert at the end
732  efficiencyNames_.push_back(name);
733  efficiencyValues_.push_back(value);
734  } else if (*it == name) { // replace existing
735  efficiencyValues_[dist] = value;
736  } else { // insert in the middle :-(
737  efficiencyNames_.insert(it, name);
738  efficiencyValues_.insert(efficiencyValues_.begin() + dist, value);
739  }
740  }
741 
742  template <class ObjectType>
744  genParticleRef_ = std::vector<reco::GenParticleRef>(1, ref);
745  genParticleEmbedded_.clear();
746  if (embed)
747  embedGenParticle();
748  }
749 
750  template <class ObjectType>
752  if (!genParticleEmbedded_.empty()) { // we're embedding
753  if (ref.isNonnull())
754  genParticleEmbedded_.push_back(*ref);
755  } else {
756  genParticleRef_.push_back(ref);
757  }
758  }
759 
760  template <class ObjectType>
762  genParticleEmbedded_.clear();
763  genParticleEmbedded_.push_back(particle);
764  genParticleRef_.clear();
765  }
766 
767  template <class ObjectType>
769  genParticleEmbedded_.clear();
770  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end();
771  ++it) {
772  if (it->isNonnull())
773  genParticleEmbedded_.push_back(**it);
774  }
775  genParticleRef_.clear();
776  }
777 
778  template <class ObjectType>
779  std::vector<reco::GenParticleRef> PATObject<ObjectType>::genParticleRefs() const {
780  if (genParticleEmbedded_.empty())
781  return genParticleRef_;
782  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
783  for (size_t i = 0, n = ret.size(); i < n; ++i) {
784  ret[i] = reco::GenParticleRef(&genParticleEmbedded_, i);
785  }
786  return ret;
787  }
788 
789  template <class ObjectType>
791  // get a vector, avoiding an unneeded copy if there is no embedding
792  const std::vector<reco::GenParticleRef> &vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
793  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
794  if (ref->isNonnull()) {
795  const reco::GenParticle &g = **ref;
796  if ((status != 0) && (g.status() != status))
797  continue;
798  if (pdgId == 0) {
799  return *ref;
800  } else if (!autoCharge) {
801  if (pdgId == g.pdgId())
802  return *ref;
803  } else if (abs(pdgId) == abs(g.pdgId())) {
804  // I want pdgId > 0 to match "correct charge" (for charged particles)
805  if (g.charge() == 0)
806  return *ref;
807  else if ((this->charge() == 0) && (pdgId == g.pdgId()))
808  return *ref;
809  else if (g.charge() * this->charge() * pdgId > 0)
810  return *ref;
811  }
812  }
813  }
814  return reco::GenParticleRef();
815  }
816 
817  template <class ObjectType>
819  auto match = std::lower_bound(overlapLabels_.cbegin(), overlapLabels_.cend(), label);
820  return (match != overlapLabels_.end() && *match == label);
821  }
822 
823  template <class ObjectType>
825  auto match = std::lower_bound(overlapLabels_.cbegin(), overlapLabels_.cend(), label);
826  if (match == overlapLabels_.cend() || *match != label)
827  return get_empty_cpv();
828  return overlapItems_[std::distance(overlapLabels_.begin(), match)];
829  }
830 
831  template <class ObjectType>
833  auto match = std::lower_bound(overlapLabels_.begin(), overlapLabels_.end(), label);
834  const auto dist = std::distance(overlapLabels_.begin(), match);
835  if (match == overlapLabels_.end() || *match != label) {
836  overlapLabels_.insert(match, label);
837  overlapItems_.insert(overlapItems_.begin() + dist, overlaps);
838  } else {
839  overlapItems_[dist] = overlaps;
840  }
841  }
842 
843  template <class ObjectType>
845  auto it = std::lower_bound(userDataLabels_.cbegin(), userDataLabels_.cend(), key);
846  if (it != userDataLabels_.cend() && *it == key) {
847  return &userDataObjects_[std::distance(userDataLabels_.cbegin(), it)];
848  }
849  return nullptr;
850  }
851 
852  template <class ObjectType>
854  std::unique_ptr<pat::UserData> data,
855  bool overwrite) {
856  auto it = std::lower_bound(userDataLabels_.begin(), userDataLabels_.end(), label);
857  const auto dist = std::distance(userDataLabels_.begin(), it);
858  if (it == userDataLabels_.end() || *it != label) {
859  userDataLabels_.insert(it, label);
860  userDataObjects_.insert(userDataObjects_.begin() + dist, std::move(data));
861  } else if (overwrite) {
862  userDataObjects_.set(dist, std::move(data));
863  } else {
864  //create a range by adding behind the first entry
865  userDataLabels_.insert(it + 1, label);
866  userDataObjects_.insert(userDataObjects_.begin() + dist + 1, std::move(data));
867  }
868  }
869 
870  template <class ObjectType>
872  auto it = std::lower_bound(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
873  if (it != userFloatLabels_.cend() && *it == key) {
874  return userFloats_[std::distance(userFloatLabels_.cbegin(), it)];
875  }
876  throwMissingLabel("UserFloat", key, userFloatLabels_);
877  return std::numeric_limits<float>::quiet_NaN();
878  }
879 
880  template <class ObjectType>
881  std::vector<float> PATObject<ObjectType>::userFloatRange(const std::string &key) const {
882  auto range = std::equal_range(userFloatLabels_.cbegin(), userFloatLabels_.cend(), key);
883  std::vector<float> result;
884  result.reserve(std::distance(range.first, range.second));
885  for (auto it = range.first; it != range.second; ++it) {
886  result.push_back(userFloats_[std::distance(userFloatLabels_.cbegin(), it)]);
887  }
888  return result;
889  }
890 
891  template <class ObjectType>
892  void PATObject<ObjectType>::addUserFloat(const std::string &label, float data, const bool overwrite) {
893  auto it = std::lower_bound(userFloatLabels_.begin(), userFloatLabels_.end(), label);
894  const auto dist = std::distance(userFloatLabels_.begin(), it);
895  if (it == userFloatLabels_.end() || *it != label) {
896  userFloatLabels_.insert(it, label);
897  userFloats_.insert(userFloats_.begin() + dist, data);
898  } else if (overwrite) {
899  userFloats_[dist] = data;
900  } else {
901  //create a range by adding behind the first entry
902  userFloatLabels_.insert(it + 1, label);
903  userFloats_.insert(userFloats_.begin() + dist + 1, data);
904  }
905  }
906 
907  template <class ObjectType>
909  auto it = std::lower_bound(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
910  if (it != userIntLabels_.cend() && *it == key) {
911  return userInts_[std::distance(userIntLabels_.cbegin(), it)];
912  }
913  throwMissingLabel("UserInt", key, userIntLabels_);
915  }
916 
917  template <class ObjectType>
918  std::vector<int> PATObject<ObjectType>::userIntRange(const std::string &key) const {
919  auto range = std::equal_range(userIntLabels_.cbegin(), userIntLabels_.cend(), key);
920  std::vector<int> result;
921  result.reserve(std::distance(range.first, range.second));
922  for (auto it = range.first; it != range.second; ++it) {
923  result.push_back(userInts_[std::distance(userIntLabels_.cbegin(), it)]);
924  }
925  return result;
926  }
927 
928  template <class ObjectType>
929  void PATObject<ObjectType>::addUserInt(const std::string &label, int data, bool overwrite) {
930  auto it = std::lower_bound(userIntLabels_.begin(), userIntLabels_.end(), label);
931  const auto dist = std::distance(userIntLabels_.begin(), it);
932  if (it == userIntLabels_.end() || *it != label) {
933  userIntLabels_.insert(it, label);
934  userInts_.insert(userInts_.begin() + dist, data);
935  } else if (overwrite) {
936  userInts_[dist] = data;
937  } else {
938  //create a range by adding behind the first entry
939  userIntLabels_.insert(it + 1, label);
940  userInts_.insert(userInts_.begin() + dist + 1, data);
941  }
942  }
943 
944  template <class ObjectType>
946  auto it = std::lower_bound(userCandLabels_.cbegin(), userCandLabels_.cend(), key);
947  if (it != userCandLabels_.cend()) {
948  return userCands_[std::distance(userCandLabels_.begin(), it)];
949  }
950  return reco::CandidatePtr();
951  }
952 
953  template <class ObjectType>
955  const reco::CandidatePtr &data,
956  const bool overwrite) {
957  auto it = std::lower_bound(userCandLabels_.begin(), userCandLabels_.end(), label);
958  const auto dist = std::distance(userCandLabels_.begin(), it);
959  if (it == userCandLabels_.end() || *it != label) {
960  userCandLabels_.insert(it, label);
961  userCands_.insert(userCands_.begin() + dist, data);
962  } else if (overwrite) {
963  userCands_[dist] = data;
964  } else {
965  userCandLabels_.insert(it + 1, label);
966  userCands_.insert(userCands_.begin() + dist + 1, data);
967  }
968  }
969 
970  template <class ObjectType>
972  const bool has_unlabelled = (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
973  if (label.empty()) {
974  if (has_unlabelled) {
975  return kinResolutions_[0];
976  } else {
977  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
978  }
979  } else {
980  auto match = std::lower_bound(kinResolutionLabels_.cbegin(), kinResolutionLabels_.cend(), label);
981  const auto dist = std::distance(kinResolutionLabels_.begin(), match);
982  const size_t increment = (has_unlabelled ? 1 : 0);
983  if (match == kinResolutionLabels_.end() || *match != label) {
984  cms::Exception ex("Missing Data");
985  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
986  ex << "The known labels are: ";
987  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.cbegin();
988  it != kinResolutionLabels_.cend();
989  ++it) {
990  ex << "'" << *it << "' ";
991  }
992  ex << "\n";
993  throw ex;
994  } else {
995  return kinResolutions_[dist + increment];
996  }
997  }
998  }
999 
1000  template <class ObjectType>
1002  if (label.empty()) {
1003  return (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
1004  } else {
1005  auto match = std::lower_bound(kinResolutionLabels_.cbegin(), kinResolutionLabels_.cend(), label);
1006  return (match != kinResolutionLabels_.cend() && *match == label);
1007  }
1008  }
1009 
1010  template <class ObjectType>
1012  const bool has_unlabelled = (kinResolutionLabels_.size() + 1 == kinResolutions_.size());
1013  if (label.empty()) {
1014  if (has_unlabelled) {
1015  // There is already an un-labelled object. Replace it
1016  kinResolutions_[0] = resol;
1017  } else {
1018  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
1019  // (for an empty vector, this should not cost more than push_back)
1020  kinResolutions_.insert(kinResolutions_.begin(), resol);
1021  }
1022  } else {
1023  auto match = std::lower_bound(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
1024  const auto dist = std::distance(kinResolutionLabels_.begin(), match);
1025  const size_t increment = (has_unlabelled ? 1 : 0);
1026  if (match != kinResolutionLabels_.end() && *match == label) {
1027  // Existing object: replace
1028  kinResolutions_[dist + increment] = resol;
1029  } else {
1030  kinResolutionLabels_.insert(match, label);
1031  kinResolutions_.insert(kinResolutions_.begin() + dist + increment, resol);
1032  }
1033  }
1034  }
1035 
1036 } // namespace pat
1037 
1038 #endif
trigger::TriggerObjectType
TriggerObjectType
Definition: TriggerTypeDefs.h:23
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
pat::PATObject::efficiencyValues
const std::vector< pat::LookupTableRecord > & efficiencyValues() const
Returns the list of the values of the stored efficiencies (the ordering is the same as in efficiencyN...
Definition: PATObject.h:257
pat::PATObject::setOverlaps
void setOverlaps(const std::string &label, const reco::CandidatePtrVector &overlaps)
Definition: PATObject.h:832
pat::UserData
Base class for data that users can add to pat objects.
Definition: UserData.h:23
pat::CandKinResolution::resolP
double resolP(const LorentzVector &p4) const
Resolution on p, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:44
embed
#define embed
Definition: AMPTWrapper.h:188
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
reco::GenParticleRef
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
Definition: GenParticleFwd.h:17
pat::PATObject::overlapLabels
const std::vector< std::string > & overlapLabels() const
Returns the labels of the overlap tests that found at least one overlap.
Definition: PATObject.h:314
muonClassificationByHits_cfi.addGenParticleRef
def addGenParticleRef(patMuonProducer, label='classByHitsGlbOrTrk')
Definition: muonClassificationByHits_cfi.py:75
pat::throwMissingLabel
void throwMissingLabel(const std::string &what, const std::string &bad_label, const std::vector< std::string > &available)
Definition: throwMissingLabel.cc:7
pat::PATObject::efficiencyValues_
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:464
mps_fire.i
i
Definition: mps_fire.py:428
pat::PATObject::userDataBare
const void * userDataBare(const std::string &key) const
Definition: PATObject.h:338
pat::PATObject::triggerObjectMatchByPath
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:689
l1ParticleFlow_cff.resol
resol
Definition: l1ParticleFlow_cff.py:17
pat::PATObject::triggerObjectMatches
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:70
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pat::PATObject::triggerObjectMatchesByFilterID
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID(const unsigned triggerObjectType) const
Definition: PATObject.h:81
pat::PATObject::hasUserData
bool hasUserData(const std::string &key) const
Check if user data with a specific type is present.
Definition: PATObject.h:327
pat::PATObject::userData
const T * userData(const std::string &key) const
Returns user-defined data. Returns NULL if the data is not present, or not of type T.
Definition: PATObject.h:322
pat::PATObject::addTriggerObjectMatch
void addTriggerObjectMatch(const TriggerObjectStandAlone &trigObj)
add a trigger match
Definition: PATObject.h:238
pat::PATObject::triggerObjectMatchByAlgorithm
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const char *nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:149
pat::PATObject::triggerObjectMatchesByType
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:550
cropTnPTrees.cloned
cloned
Definition: cropTnPTrees.py:37
pat::PATObject::triggerObjectMatchByFilter
const TriggerObjectStandAlone * triggerObjectMatchByFilter(const char *labelFilter, const size_t idx=0) const
Definition: PATObject.h:176
pat::PATObject::kinResolutionLabels_
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:495
pat::PATObject::resolPInv
double resolPInv(const std::string &label="") const
Resolution on 1/p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:441
reco::GenParticle
Definition: GenParticle.h:21
mps_update.status
status
Definition: mps_update.py:68
pat::PATObject::genParticleById
reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const
Definition: PATObject.h:790
pat::TriggerObjectStandAlone
Analysis-level trigger object class (stand-alone)
Definition: TriggerObjectStandAlone.h:32
pat::CandKinResolution::resolPx
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:53
pat::PATObject::triggerObjectMatchByFilter
const TriggerObjectStandAlone * triggerObjectMatchByFilter(const std::string &labelFilter, const size_t idx=0) const
get one matched HLT object used in a certain HLT filter by index
Definition: PATObject.h:663
oniaPATMuonsWithTrigger_cff.matches
matches
Definition: oniaPATMuonsWithTrigger_cff.py:77
pat::PATObject::base_type
ObjectType base_type
Definition: PATObject.h:45
pat::CandKinResolution::resolPhi
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:32
pat::PATObject::triggerObjectMatchesByAlgorithm
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:626
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
pat::CandKinResolution::resolPInv
double resolPInv(const LorentzVector &p4) const
Resolution on 1/p, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:50
pat::PATObject::genParticlesSize
size_t genParticlesSize() const
Number of generator level particles stored as ref or embedded.
Definition: PATObject.h:290
CandKinResolution.h
pat::PATObject::addGenParticleRef
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:751
pat::PATObject::addUserInt
void addUserInt(const std::string &label, int32_t data, const bool overwrite=false)
Set user-defined int.
Definition: PATObject.h:929
pat::PATObject::triggerObjectMatchByAlgorithm
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:637
pat::PATObject::hasOverlaps
bool hasOverlaps(const std::string &label) const
Returns true if there was at least one overlap for this test label.
Definition: PATObject.h:818
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
pat::PATObject::resolPhi
double resolPhi(const std::string &label="") const
Resolution on phi, possibly with a label to specify which resolution to use.
Definition: PATObject.h:426
pat::PATObject::efficiencies
std::vector< std::pair< std::string, pat::LookupTableRecord > > efficiencies() const
Returns the efficiencies as <name,value> pairs (by value)
Definition: PATObject.h:716
pat::PATObject::userFloat
float userFloat(const std::string &key) const
Definition: PATObject.h:871
pat::PATObject::userIntRange
std::vector< int > userIntRange(const std::string &key) const
returns a range of values corresponding to key
Definition: PATObject.h:918
pat::PATObject::triggerObjectMatchByCondition
const TriggerObjectStandAlone * triggerObjectMatchByCondition(const std::string &nameCondition, const size_t idx=0) const
get one matched L1 object used in a succeeding object combination of a certain L1 condition by index
Definition: PATObject.h:612
pat::PATObject::hasUserCand
bool hasUserCand(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:403
pat::PATObject::triggerObjectMatchesByCondition
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition(const std::string &nameCondition) const
get all matched L1 objects used in a succeeding object combination of a certain L1 condition
Definition: PATObject.h:601
edm::Ref< GenParticleCollection >
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
pat::PATObject::userDataObjects_
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:480
GenParticle.h
CandidateFwd.h
pat::PATObject::addUserDataFromPtr
void addUserDataFromPtr(const std::string &label, const edm::Ptr< pat::UserData > &data, bool overwrite=false)
Definition: PATObject.h:355
pat::PATObject::triggerObjectMatchesByFilter
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const char *labelFilter) const
Definition: PATObject.h:169
pat::PATObject::overlapLabels_
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:474
edm::errors::ProductNotFound
Definition: EDMException.h:33
pat::PATObject::userInts_
std::vector< int32_t > userInts_
Definition: PATObject.h:486
pat::PATObject::triggerObjectMatchByCollection
const TriggerObjectStandAlone * triggerObjectMatchByCollection(const std::string &coll, const size_t idx=0) const
get one matched trigger object from a certain collection by index
Definition: PATObject.h:586
pat::PATObject::resolTheta
double resolTheta(const std::string &label="") const
Resolution on theta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:423
pat::PATObject::resolP
double resolP(const std::string &label="") const
Resolution on p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:435
pat::PATObject::refToOrig_
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:458
edm::PtrVector< Candidate >
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
pat::CandKinResolution::resolPy
double resolPy(const LorentzVector &p4) const
Resolution on py, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:56
pat::PATObject::triggerObjectMatchesByFilter
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const std::string &labelFilter) const
get all matched HLT objects used in a certain HLT filter
Definition: PATObject.h:652
pat::PATObject::genParticleRefs
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:779
pat::PATObject::overlaps
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:824
pat::PATObject::addUserData
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
Definition: PATObject.h:348
pat::PATObject::triggerObjectMatchByFilterID
const TriggerObjectStandAlone * triggerObjectMatchByFilterID(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:92
pat::PATObject::hasUserFloat
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:373
mps_fire.end
end
Definition: mps_fire.py:242
pat::PATObject
Templated PAT object container.
Definition: PATObject.h:43
pat::PATObject::resolPy
double resolPy(const std::string &label="") const
Resolution on py, possibly with a label to specify which resolution to use.
Definition: PATObject.h:447
pat::get_empty_cpv
const reco::CandidatePtrVector & get_empty_cpv()
Definition: PATObject.cc:4
pat::PATObject::triggerObjectMatchByCondition
const TriggerObjectStandAlone * triggerObjectMatchByCondition(const char *nameCondition, const size_t idx=0) const
Definition: PATObject.h:118
pat::PATObject::userCand
reco::CandidatePtr userCand(const std::string &key) const
Definition: PATObject.h:945
pat::PATObject::~PATObject
~PATObject() override
destructor
Definition: PATObject.h:56
pat::PATObject::userFloatRange
std::vector< float > userFloatRange(const std::string &key) const
return a range of values corresponding to key
Definition: PATObject.h:881
pat::PATObject::triggerObjectMatchByAlgorithm
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:155
pat::CandKinResolution::resolM
double resolM(const LorentzVector &p4) const
Definition: CandKinResolution.cc:41
pat::PATObject::hasUserFloat
bool hasUserFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:378
pat::PATObject::addUserDataObject_
void addUserDataObject_(const std::string &label, std::unique_ptr< pat::UserData > value, bool overwrite=false)
Definition: PATObject.h:853
pat::PATObject::addUserCand
void addUserCand(const std::string &label, const reco::CandidatePtr &data, const bool overwrite=false)
Set user-defined int.
Definition: PATObject.h:954
pat::get_empty_str
const std::string & get_empty_str()
Definition: PATObject.cc:9
throwMissingLabel.h
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
pat::CandKinResolution
Definition: CandKinResolution.h:10
pat::PATObject::triggerObjectMatchByAlgorithm
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:161
pat::PATObject::efficiency
const pat::LookupTableRecord & efficiency(const std::string &name) const
Returns an efficiency given its name.
Definition: PATObject.h:706
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
analyzePatCleaning_cfg.overlaps
overlaps
Definition: analyzePatCleaning_cfg.py:9
pat::PATObject::originalObjectRef
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
Definition: PATObject.h:537
pat::PATObject::hasUserInt
bool hasUserInt(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:390
pat::PATObject::userCands_
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:489
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
pat::PATObject::triggerObjectMatchByPath
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:223
pat::PATObject::userIntLabels_
std::vector< std::string > userIntLabels_
Definition: PATObject.h:485
pat::PATObject::triggerObjectMatchesByAlgorithm
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:133
pat::PATObject::userFloat
float userFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:366
ecaldqm::binning::ObjectType
ObjectType
Definition: MESetBinningUtils.h:18
pat::PATObject::userDataObjectType
const std::string & userDataObjectType(const std::string &key) const
Get human-readable type of user data object, for debugging.
Definition: PATObject.h:329
pat::PATObject::triggerObjectMatch
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:542
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
pat::PATObject::genParticleRef_
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:469
UserData.h
pat::CandKinResolution::resolPt
double resolPt(const LorentzVector &p4) const
Resolution on pt, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:47
pat::PATObject::triggerObjectMatchesByCollection
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:575
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::PATObject::userDataObject_
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:844
electronProducer_cfi.efficiencies
efficiencies
Definition: electronProducer_cfi.py:76
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
Ptr.h
pat::PATObject::setGenParticle
void setGenParticle(const reco::GenParticle &particle)
Set the generator level particle from a particle not in the Event (embedding it, of course)
Definition: PATObject.h:761
pat::PATObject::addUserFloat
void addUserFloat(const std::string &label, float data, const bool overwrite=false)
Set user-defined float.
Definition: PATObject.h:892
pat::PATObject::resolPt
double resolPt(const std::string &label="") const
Resolution on pt, possibly with a label to specify which resolution to use.
Definition: PATObject.h:438
pat::TriggerObjectStandAloneCollection
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
Definition: TriggerObjectStandAlone.h:219
pat::PATObject::resolPx
double resolPx(const std::string &label="") const
Resolution on px, possibly with a label to specify which resolution to use.
Definition: PATObject.h:444
p4
double p4[4]
Definition: TauolaWrapper.h:92
value
Definition: value.py:1
pat::PATObject::userFloatNames
const std::vector< std::string > & userFloatNames() const
Get list of user-defined float names.
Definition: PATObject.h:371
pat::PATObject::efficiencyNames_
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:466
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:677
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:117
pat::CandKinResolution::resolE
double resolE(const LorentzVector &p4) const
Resolution on energy, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:35
pat
Definition: HeavyIon.h:7
pat::PATObject::genParticleEmbedded_
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:471
pat::PATObject::triggerObjectMatchByPath
const TriggerObjectStandAlone * triggerObjectMatchByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:230
pat::PATObject::triggerObjectMatchesByAlgorithm
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:128
pat::PATObject::triggerObjectMatchByType
const TriggerObjectStandAlone * triggerObjectMatchByType(const trigger::TriggerObjectType triggerObjectType, const size_t idx=0) const
get one matched trigger object of a certain type by index
Definition: PATObject.h:561
pat::PATObject::setGenParticleRef
void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false)
Set the generator level particle reference.
Definition: PATObject.h:743
get
#define get
pat::PATObject::resolEta
double resolEta(const std::string &label="") const
Resolution on eta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:420
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::PATObject::efficiencyNames
const std::vector< std::string > & efficiencyNames() const
Returns the list of the names of the stored efficiencies.
Definition: PATObject.h:255
pat::PATObject::PATObject
PATObject()
default constructor
Definition: PATObject.h:504
pat::PATObject::kinResolutions_
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:492
edm::Ptr
Definition: AssociationVector.h:31
reco::Candidate
Definition: Candidate.h:27
pat::PATObject::originalObject
const reco::Candidate * originalObject() const
access to the original object; returns zero for null Ref and throws for unavailable collection
Definition: PATObject.h:522
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:188
pat::PATObject::triggerObjectMatchesByCollection
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const char *coll) const
Definition: PATObject.h:99
pat::PATObject::userCandLabels_
std::vector< std::string > userCandLabels_
Definition: PATObject.h:488
pat::PATObject::triggerObjectMatchesByType
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const unsigned triggerObjectType) const
Definition: PATObject.h:77
pat::PATObject::setEfficiency
void setEfficiency(const std::string &name, const pat::LookupTableRecord &value)
Definition: PATObject.h:727
pat::PATObject::resolM
double resolM(const std::string &label="") const
Definition: PATObject.h:454
pat::CandKinResolution::resolTheta
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:29
eostools.move
def move(src, dest)
Definition: eostools.py:511
pat::CandKinResolution::resolPz
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:59
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:200
pat::PATObject::resolPz
double resolPz(const std::string &label="") const
Resolution on pz, possibly with a label to specify which resolution to use.
Definition: PATObject.h:450
pat::PATObject::triggerObjectMatchByPath
const TriggerObjectStandAlone * triggerObjectMatchByPath(const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:216
pat::PATObject::genParticle
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:285
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
T
long double T
Definition: Basic3DVectorLD.h:48
relativeConstraints.value
value
Definition: relativeConstraints.py:53
Exception
Definition: hltDiff.cc:245
pat::PATObject::hasKinResolution
bool hasKinResolution(const std::string &label="") const
Check if the kinematic resolutions are stored into this object (possibly specifying a label for them)
Definition: PATObject.h:1001
edm::TriggerNames
Definition: TriggerNames.h:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pat::PATObject::userIntNames
const std::vector< std::string > & userIntNames() const
Get list of user-defined int names.
Definition: PATObject.h:388
pat::PATObject::resolEt
double resolEt(const std::string &label="") const
Resolution on et, possibly with a label to specify which resolution to use.
Definition: PATObject.h:432
edm::RefToBase
Definition: AssociativeIterator.h:54
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:194
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
pat::PATObject::triggerObjectMatchesEmbedded_
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:461
pat::PATObject::userDataLabels_
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:479
mps_fire.result
result
Definition: mps_fire.py:311
cms::Exception
Definition: Exception.h:70
Candidate.h
reco::CandidatePtr
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
OwnVector.h
pat::PATObject::triggerObjectMatchByType
const TriggerObjectStandAlone * triggerObjectMatchByType(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:87
pat::PATObject::triggerObjectMatchesByCondition
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition(const char *nameCondition) const
Definition: PATObject.h:111
pat::PATObject::userInt
int32_t userInt(const std::string &key) const
Definition: PATObject.h:908
pat::PATObject::embedGenParticle
void embedGenParticle()
Definition: PATObject.h:768
pat::PATObject::unpackTriggerObjectPathNames
void unpackTriggerObjectPathNames(const edm::TriggerNames &names)
unpack path names of matched trigger objects (if they were packed before embedding,...
Definition: PATObject.h:242
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746
crabWrapper.key
key
Definition: crabWrapper.py:19
pat::CandKinResolution::resolEta
double resolEta(const LorentzVector &p4) const
Resolution on eta, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:26
TriggerObjectStandAlone.h
pat::LookupTableRecord
Class to store the result of a lookup table fetch, e.g. for efficiencies.
Definition: LookupTableRecord.h:19
pat::PATObject::triggerObjectMatchByCollection
const TriggerObjectStandAlone * triggerObjectMatchByCollection(const char *coll, const size_t idx=0) const
Definition: PATObject.h:105
pat::PATObject::triggerObjectMatchesByAlgorithm
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:138
label
const char * label
Definition: PFTauDecayModeTools.cc:11
pat::PATObject::genParticleRef
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:265
pat::PATObject::userDataNames
const std::vector< std::string > & userDataNames() const
Get list of user data object names.
Definition: PATObject.h:334
pat::CandKinResolution::resolEt
double resolEt(const LorentzVector &p4) const
Resolution on et, given the 4-momentum of the associated Candidate.
Definition: CandKinResolution.cc:38
pat::PATObject::userFloatLabels_
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:482
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
edm::OwnVector< pat::UserData >
pat::PATObject::resolE
double resolE(const std::string &label="") const
Resolution on energy, possibly with a label to specify which resolution to use.
Definition: PATObject.h:429
pat::PATObject::userFloats_
std::vector< float > userFloats_
Definition: PATObject.h:483
pat::PATObject::getKinResolution
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:971
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
LookupTableRecord.h
pat::PATObject::userCandNames
const std::vector< std::string > & userCandNames() const
Get list of user-defined cand names.
Definition: PATObject.h:401
pat::PATObject::overlapItems_
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:476
pat::PATObject::setKinResolution
void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="")
Add a kinematic resolution to this object (possibly with a label)
Definition: PATObject.h:1011