CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
23 #include <vector>
24 #include <string>
25 #include <iosfwd>
26 
29 
31 
34 
36 
37 namespace pat {
38 
39 
40  template <class ObjectType>
41  class PATObject : public ObjectType {
42  public:
43 
45 
47  PATObject();
49  PATObject(const ObjectType & obj);
53  PATObject(const edm::Ptr<ObjectType> & ref);
55  virtual ~PATObject() {}
56  // returns a clone // NO: ObjectType can be an abstract type like reco::Candidate
57  // virtual PATObject<ObjectType> * clone() const ; // for which the clone() can't be defined
58 
60  const reco::Candidate * originalObject() const;
63 
67 
71  const TriggerObjectStandAlone * triggerObjectMatch( const size_t idx = 0 ) const;
75  const TriggerObjectStandAloneCollection triggerObjectMatchesByType( const unsigned triggerObjectType ) const {
76  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
77  };
78  // for backward compatibility
79  const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID( const unsigned triggerObjectType ) const {
80  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
81  };
83  const TriggerObjectStandAlone * triggerObjectMatchByType( const trigger::TriggerObjectType triggerObjectType, const size_t idx = 0 ) const;
84  const TriggerObjectStandAlone * triggerObjectMatchByType( const unsigned triggerObjectType, const size_t idx = 0 ) const {
85  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
86  };
87  // for backward compatibility
88  const TriggerObjectStandAlone * triggerObjectMatchByFilterID( const unsigned triggerObjectType, const size_t idx = 0 ) const {
89  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
90  };
93  // for RooT command line
96  };
98  const TriggerObjectStandAlone * triggerObjectMatchByCollection( const std::string & coll, const size_t idx = 0 ) const;
99  // for RooT command line
100  const TriggerObjectStandAlone * triggerObjectMatchByCollection( const char * coll, const size_t idx = 0 ) const {
102  };
105  // for RooT command line
106  const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition( const char * nameCondition ) const {
107  return triggerObjectMatchesByCondition( std::string( nameCondition ) );
108  };
110  const TriggerObjectStandAlone * triggerObjectMatchByCondition( const std::string & nameCondition, const size_t idx = 0 ) const;
111  // for RooT command line
112  const TriggerObjectStandAlone * triggerObjectMatchByCondition( const char * nameCondition, const size_t idx = 0 ) const {
113  return triggerObjectMatchByCondition( std::string( nameCondition ), idx );
114  };
118  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted = true ) const;
119  // for RooT command line
120  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const char * nameAlgorithm, const bool algoCondAccepted = true ) const {
121  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted );
122  };
123  // for the cut string parser
124  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const unsigned algoCondAccepted ) const {
125  return triggerObjectMatchesByAlgorithm( nameAlgorithm, bool( algoCondAccepted ) );
126  };
127  // for RooT command line and the cut string parser
128  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const char * nameAlgorithm, const unsigned algoCondAccepted ) const {
129  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ) );
130  };
134  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted = true, const size_t idx = 0 ) const;
135  // for RooT command line
136  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const char * nameAlgorithm, const bool algoCondAccepted = true, const size_t idx = 0 ) const {
137  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted, idx );
138  };
139  // for the cut string parser
140  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const unsigned algoCondAccepted, const size_t idx = 0 ) const {
141  return triggerObjectMatchByAlgorithm( nameAlgorithm, bool( algoCondAccepted ), idx );
142  };
143  // for RooT command line and the cut string parser
144  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const char * nameAlgorithm, const unsigned algoCondAccepted, const size_t idx = 0 ) const {
145  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ), idx );
146  };
149  // for RooT command line
150  const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter( const char * labelFilter ) const {
151  return triggerObjectMatchesByFilter( std::string( labelFilter ) );
152  };
154  const TriggerObjectStandAlone * triggerObjectMatchByFilter( const std::string & labelFilter, const size_t idx = 0 ) const;
155  // for RooT command line
156  const TriggerObjectStandAlone * triggerObjectMatchByFilter( const char * labelFilter, const size_t idx = 0 ) const {
157  return triggerObjectMatchByFilter( std::string( labelFilter ), idx );
158  };
164  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const std::string & namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true ) const;
165  // for RooT command line
166  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const char * namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true ) const {
167  return triggerObjectMatchesByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted );
168  };
169  // for the cut string parser
170  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const std::string & namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1 ) const {
171  return triggerObjectMatchesByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
172  };
173  // for RooT command line and the cut string parser
174  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const char * namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1 ) const {
175  return triggerObjectMatchesByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
176  };
182  const TriggerObjectStandAlone * triggerObjectMatchByPath( const std::string & namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true, const size_t idx = 0 ) const;
183  // for RooT command line
184  const TriggerObjectStandAlone * triggerObjectMatchByPath( const char * namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true, const size_t idx = 0 ) const {
185  return triggerObjectMatchByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted, idx );
186  };
187  // for the cut string parser
188  const TriggerObjectStandAlone * triggerObjectMatchByPath( const std::string & namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1, const size_t idx = 0 ) const {
189  return triggerObjectMatchByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
190  };
191  // for RooT command line and the cut string parser
192  const TriggerObjectStandAlone * triggerObjectMatchByPath( const char * namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1, const size_t idx = 0 ) const {
193  return triggerObjectMatchByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
194  };
196  void addTriggerObjectMatch( const TriggerObjectStandAlone & trigObj ) { triggerObjectMatchesEmbedded_.push_back( trigObj ); };
199  for (std::vector<TriggerObjectStandAlone>::iterator it = triggerObjectMatchesEmbedded_.begin(), ed = triggerObjectMatchesEmbedded_.end(); it != ed; ++it) it->unpackPathNames(names);
200  }
201 
203  const pat::LookupTableRecord & efficiency(const std::string &name) const ;
205  std::vector<std::pair<std::string,pat::LookupTableRecord> > efficiencies() const ;
207  const std::vector<std::string> & efficiencyNames() const { return efficiencyNames_; }
209  const std::vector<pat::LookupTableRecord> & efficiencyValues() const { return efficiencyValues_; }
214 
218  if (idx >= genParticlesSize()) return reco::GenParticleRef();
220  }
231  // implementation note: uint8_t instead of bool, because the string parser doesn't allow bool currently
232  reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const ;
233 
236  const reco::GenParticle * genParticle(size_t idx=0) const {
238  return ref.isNonnull() ? ref.get() : 0;
239  }
241  size_t genParticlesSize() const {
242  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
243  }
246  std::vector<reco::GenParticleRef> genParticleRefs() const ;
247 
249  void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false) ;
252  void addGenParticleRef(const reco::GenParticleRef &ref) ;
254  void setGenParticle( const reco::GenParticle &particle ) ;
257  void embedGenParticle() ;
258 
260  bool hasOverlaps(const std::string &label) const ;
263  const reco::CandidatePtrVector & overlaps(const std::string &label) const ;
265  const std::vector<std::string> & overlapLabels() const { return overlapLabels_; }
270 
272  template<typename T> const T * userData(const std::string &key) const {
273  const pat::UserData * data = userDataObject_(key);
274  return (data != 0 ? data->template get<T>() : 0);
275 
276  }
278  bool hasUserData(const std::string &key) const {
279  return (userDataObject_(key) != 0);
280  }
283  static const std::string EMPTY("");
284  const pat::UserData * data = userDataObject_(key);
285  return (data != 0 ? data->typeName() : EMPTY);
286  };
288  const std::vector<std::string> & userDataNames() const { return userDataLabels_; }
289 
292  const void * userDataBare(const std::string &key) const {
293  const pat::UserData * data = userDataObject_(key);
294  return (data != 0 ? data->bareData() : 0);
295  }
296 
301  template<typename T>
302  void addUserData( const std::string & label, const T & data, bool transientOnly=false ) {
303  userDataLabels_.push_back(label);
304  userDataObjects_.push_back(pat::UserData::make<T>(data, transientOnly));
305  }
306 
310  userDataLabels_.push_back(label);
311  userDataObjects_.push_back(data->clone());
312  }
313 
316  float userFloat( const std::string & key ) const;
318  float userFloat( const char* key ) const { return userFloat( std::string(key) ); }
319 
321  void addUserFloat( const std::string & label, float data );
323  const std::vector<std::string> & userFloatNames() const { return userFloatLabels_; }
325  bool hasUserFloat( const std::string & key ) const {
326  return std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key) != userFloatLabels_.end();
327  }
329  bool hasUserFloat( const char* key ) const {return hasUserFloat( std::string(key) );}
330 
333  int32_t userInt( const std::string & key ) const;
335  void addUserInt( const std::string & label, int32_t data );
337  const std::vector<std::string> & userIntNames() const { return userIntLabels_; }
339  bool hasUserInt( const std::string & key ) const {
340  return std::find(userIntLabels_.begin(), userIntLabels_.end(), key) != userIntLabels_.end();
341  }
342 
345  reco::CandidatePtr userCand( const std::string & key ) const;
347  void addUserCand( const std::string & label, const reco::CandidatePtr & data );
349  const std::vector<std::string> & userCandNames() const { return userCandLabels_; }
351  bool hasUserCand( const std::string & key ) const {
352  return std::find(userCandLabels_.begin(), userCandLabels_.end(), key) != userCandLabels_.end();
353  }
354 
355  // === New Kinematic Resolutions
358  const pat::CandKinResolution & getKinResolution(const std::string &label="") const ;
359 
361  bool hasKinResolution(const std::string &label="") const ;
362 
364  void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="") ;
365 
367  double resolEta(const std::string &label="") const { return getKinResolution(label).resolEta(this->p4()); }
368 
370  double resolTheta(const std::string &label="") const { return getKinResolution(label).resolTheta(this->p4()); }
371 
373  double resolPhi(const std::string &label="") const { return getKinResolution(label).resolPhi(this->p4()); }
374 
376  double resolE(const std::string &label="") const { return getKinResolution(label).resolE(this->p4()); }
377 
379  double resolEt(const std::string &label="") const { return getKinResolution(label).resolEt(this->p4()); }
380 
382  double resolP(const std::string &label="") const { return getKinResolution(label).resolP(this->p4()); }
383 
385  double resolPt(const std::string &label="") const { return getKinResolution(label).resolPt(this->p4()); }
386 
388  double resolPInv(const std::string &label="") const { return getKinResolution(label).resolPInv(this->p4()); }
389 
391  double resolPx(const std::string &label="") const { return getKinResolution(label).resolPx(this->p4()); }
392 
394  double resolPy(const std::string &label="") const { return getKinResolution(label).resolPy(this->p4()); }
395 
397  double resolPz(const std::string &label="") const { return getKinResolution(label).resolPz(this->p4()); }
398 
401  double resolM(const std::string &label="") const { return getKinResolution(label).resolM(this->p4()); }
402 
403 
404 
405  protected:
406  // reference back to the original object
408 
411 
413  std::vector<pat::LookupTableRecord> efficiencyValues_;
415  std::vector<std::string> efficiencyNames_;
416 
418  std::vector<reco::GenParticleRef> genParticleRef_;
420  std::vector<reco::GenParticle> genParticleEmbedded_;
421 
423  std::vector<std::string> overlapLabels_;
425  std::vector<reco::CandidatePtrVector> overlapItems_;
426 
428  std::vector<std::string> userDataLabels_;
430  // User float values
431  std::vector<std::string> userFloatLabels_;
432  std::vector<float> userFloats_;
433  // User int values
434  std::vector<std::string> userIntLabels_;
435  std::vector<int32_t> userInts_;
436  // User candidate matches
437  std::vector<std::string> userCandLabels_;
438  std::vector<reco::CandidatePtr> userCands_;
439 
441  std::vector<pat::CandKinResolution> kinResolutions_;
444  std::vector<std::string> kinResolutionLabels_;
445 
446  private:
447  const pat::UserData * userDataObject_(const std::string &key) const ;
448  };
449 
450 
451  template <class ObjectType> PATObject<ObjectType>::PATObject() {
452  }
453 
454  template <class ObjectType> PATObject<ObjectType>::PATObject(const ObjectType & obj) :
455  ObjectType(obj),
456  refToOrig_() {
457  }
458 
459  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::RefToBase<ObjectType> & ref) :
460  ObjectType(*ref),
461  refToOrig_(ref.id(), ref.get(), ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
462  // which happens to be true, otherwise the line before this throws ex. already
463  {
464  }
465 
466  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::Ptr<ObjectType> & ref) :
467  ObjectType(*ref),
468  refToOrig_(ref) {
469  }
470 
471  template <class ObjectType> const reco::Candidate * PATObject<ObjectType>::originalObject() const {
472  if (refToOrig_.isNull()) {
473  // this object was not produced from a reference, so no link to the
474  // original object exists -> return a 0-pointer
475  return 0;
476  } else if (!refToOrig_.isAvailable()) {
477  throw edm::Exception(edm::errors::ProductNotFound) << "The original collection from which this PAT object was made is not present any more in the event, hence you cannot access the originating object anymore.";
478  } else {
479  return refToOrig_.get();
480  }
481  }
482 
483  template <class ObjectType>
485 
486  template <class ObjectType>
488  if ( idx >= triggerObjectMatches().size() ) return 0;
489  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, idx );
490  return ref.isNonnull() ? ref.get() : 0;
491  }
492 
493  template <class ObjectType>
496  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
497  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
498  }
499  return matches;
500  }
501 
502  template <class ObjectType>
504  std::vector< size_t > refs;
505  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
506  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) refs.push_back( i );
507  }
508  if ( idx >= refs.size() ) return 0;
509  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
510  return ref.isNonnull() ? ref.get() : 0;
511  }
512 
513  template <class ObjectType>
516  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
517  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
518  }
519  return matches;
520  }
521 
522  template <class ObjectType>
524  std::vector< size_t > refs;
525  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
526  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) {
527  refs.push_back( i );
528  }
529  }
530  if ( idx >= refs.size() ) return 0;
531  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
532  return ref.isNonnull() ? ref.get() : 0;
533  }
534 
535  template <class ObjectType>
538  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
539  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
540  }
541  return matches;
542  }
543 
544  template <class ObjectType>
546  std::vector< size_t > refs;
547  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
548  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) refs.push_back( i );
549  }
550  if ( idx >= refs.size() ) return 0;
551  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
552  return ref.isNonnull() ? ref.get() : 0;
553  }
554 
555  template <class ObjectType>
556  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted ) const {
558  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
559  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
560  }
561  return matches;
562  }
563 
564  template <class ObjectType>
565  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted, const size_t idx ) const {
566  std::vector< size_t > refs;
567  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
568  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) refs.push_back( i );
569  }
570  if ( idx >= refs.size() ) return 0;
571  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
572  return ref.isNonnull() ? ref.get() : 0;
573  }
574 
575  template <class ObjectType>
578  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
579  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
580  }
581  return matches;
582  }
583 
584  template <class ObjectType>
586  std::vector< size_t > refs;
587  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
588  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) refs.push_back( i );
589  }
590  if ( idx >= refs.size() ) return 0;
591  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
592  return ref.isNonnull() ? ref.get() : 0;
593  }
594 
595  template <class ObjectType>
596  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted ) const {
598  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
599  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
600  }
601  return matches;
602  }
603 
604  template <class ObjectType>
605  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted, const size_t idx ) const {
606  std::vector< size_t > refs;
607  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
608  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) refs.push_back( i );
609  }
610  if ( idx >= refs.size() ) return 0;
611  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
612  return ref.isNonnull() ? ref.get() : 0;
613  }
614 
615  template <class ObjectType>
616  const pat::LookupTableRecord &
618  // find the name in the (sorted) list of names
619  std::vector<std::string>::const_iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
620  if ((it == efficiencyNames_.end()) || (*it != name)) {
621  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
622  }
623  return efficiencyValues_[it - efficiencyNames_.begin()];
624  }
625 
626  template <class ObjectType>
627  std::vector<std::pair<std::string,pat::LookupTableRecord> >
629  std::vector<std::pair<std::string,pat::LookupTableRecord> > ret;
630  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
631  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
632  for ( ; itn != edn; ++itn, ++itv) {
633  ret.push_back( std::pair<std::string,pat::LookupTableRecord>(*itn, *itv) );
634  }
635  return ret;
636  }
637 
638  template <class ObjectType>
640  // look for the name, or to the place where we can insert it without violating the alphabetic order
641  std::vector<std::string>::iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
642  if (it == efficiencyNames_.end()) { // insert at the end
643  efficiencyNames_.push_back(name);
644  efficiencyValues_.push_back(value);
645  } else if (*it == name) { // replace existing
646  efficiencyValues_[it - efficiencyNames_.begin()] = value;
647  } else { // insert in the middle :-(
648  efficiencyNames_. insert(it, name);
649  efficiencyValues_.insert( efficiencyValues_.begin() + (it - efficiencyNames_.begin()), value );
650  }
651  }
652 
653  template <class ObjectType>
655  genParticleRef_ = std::vector<reco::GenParticleRef>(1,ref);
656  genParticleEmbedded_.clear();
657  if (embed) embedGenParticle();
658  }
659 
660  template <class ObjectType>
662  if (!genParticleEmbedded_.empty()) { // we're embedding
663  if (ref.isNonnull()) genParticleEmbedded_.push_back(*ref);
664  } else {
665  genParticleRef_.push_back(ref);
666  }
667  }
668 
669  template <class ObjectType>
671  genParticleEmbedded_.clear();
672  genParticleEmbedded_.push_back(particle);
673  genParticleRef_.clear();
674  }
675 
676  template <class ObjectType>
678  genParticleEmbedded_.clear();
679  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end(); ++it) {
680  if (it->isNonnull()) genParticleEmbedded_.push_back(**it);
681  }
682  genParticleRef_.clear();
683  }
684 
685  template <class ObjectType>
686  std::vector<reco::GenParticleRef> PATObject<ObjectType>::genParticleRefs() const {
687  if (genParticleEmbedded_.empty()) return genParticleRef_;
688  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
689  for (size_t i = 0, n = ret.size(); i < n; ++i) {
690  ret[i] = reco::GenParticleRef(&genParticleEmbedded_, i);
691  }
692  return ret;
693  }
694 
695  template <class ObjectType>
697  // get a vector, avoiding an unneeded copy if there is no embedding
698  const std::vector<reco::GenParticleRef> & vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
699  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
700  if (ref->isNonnull()) {
701  const reco::GenParticle & g = **ref;
702  if ((status != 0) && (g.status() != status)) continue;
703  if (pdgId == 0) {
704  return *ref;
705  } else if (!autoCharge) {
706  if (pdgId == g.pdgId()) return *ref;
707  } else if (abs(pdgId) == abs(g.pdgId())) {
708  // I want pdgId > 0 to match "correct charge" (for charged particles)
709  if (g.charge() == 0) return *ref;
710  else if ((this->charge() == 0) && (pdgId == g.pdgId())) return *ref;
711  else if (g.charge()*this->charge()*pdgId > 0) return *ref;
712  }
713  }
714  }
715  return reco::GenParticleRef();
716  }
717 
718  template <class ObjectType>
720  return std::find(overlapLabels_.begin(), overlapLabels_.end(), label) != overlapLabels_.end();
721  }
722 
723  template <class ObjectType>
725  static const reco::CandidatePtrVector EMPTY;
726  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
727  if (match == overlapLabels_.end()) return EMPTY;
728  return overlapItems_[match - overlapLabels_.begin()];
729  }
730 
731  template <class ObjectType>
733  if (!overlaps.empty()) {
734  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
735  if (match == overlapLabels_.end()) {
736  overlapLabels_.push_back(label);
737  overlapItems_.push_back(overlaps);
738  } else {
739  overlapItems_[match - overlapLabels_.begin()] = overlaps;
740  }
741  }
742  }
743 
744  template <class ObjectType>
746  {
747  std::vector<std::string>::const_iterator it = std::find(userDataLabels_.begin(), userDataLabels_.end(), key);
748  if (it != userDataLabels_.end()) {
749  return & userDataObjects_[it - userDataLabels_.begin()];
750  }
751  return 0;
752  }
753 
754  template <class ObjectType>
756  {
757  std::vector<std::string>::const_iterator it = std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key);
758  if (it != userFloatLabels_.end()) {
759  return userFloats_[it - userFloatLabels_.begin()];
760  }
761  return 0.0;
762  }
763 
764  template <class ObjectType>
766  float data )
767  {
768  userFloatLabels_.push_back(label);
769  userFloats_.push_back( data );
770  }
771 
772 
773  template <class ObjectType>
775  {
776  std::vector<std::string>::const_iterator it = std::find(userIntLabels_.begin(), userIntLabels_.end(), key);
777  if (it != userIntLabels_.end()) {
778  return userInts_[it - userIntLabels_.begin()];
779  }
780  return 0;
781  }
782 
783  template <class ObjectType>
785  int data )
786  {
787  userIntLabels_.push_back(label);
788  userInts_.push_back( data );
789  }
790 
791  template <class ObjectType>
793  {
794  std::vector<std::string>::const_iterator it = std::find(userCandLabels_.begin(), userCandLabels_.end(), key);
795  if (it != userCandLabels_.end()) {
796  return userCands_[it - userCandLabels_.begin()];
797  }
798  return reco::CandidatePtr();
799  }
800 
801  template <class ObjectType>
803  const reco::CandidatePtr & data )
804  {
805  userCandLabels_.push_back(label);
806  userCands_.push_back( data );
807  }
808 
809 
810  template <class ObjectType>
812  if (label.empty()) {
813  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
814  return kinResolutions_[0];
815  } else {
816  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
817  }
818  } else {
819  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
820  if (match == kinResolutionLabels_.end()) {
821  cms::Exception ex("Missing Data");
822  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
823  ex << "The known labels are: " ;
824  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.begin(); it != kinResolutionLabels_.end(); ++it) {
825  ex << "'" << *it << "' ";
826  }
827  ex << "\n";
828  throw ex;
829  } else {
830  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
831  // skip un-labelled resolution
832  return kinResolutions_[match - kinResolutionLabels_.begin() + 1];
833  } else {
834  // all are labelled, so this is the real index
835  return kinResolutions_[match - kinResolutionLabels_.begin()];
836  }
837  }
838  }
839  }
840 
841  template <class ObjectType>
843  if (label.empty()) {
844  return (kinResolutionLabels_.size()+1 == kinResolutions_.size());
845  } else {
846  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
847  return match != kinResolutionLabels_.end();
848  }
849  }
850 
851  template <class ObjectType>
853  if (label.empty()) {
854  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
855  // There is already an un-labelled object. Replace it
856  kinResolutions_[0] = resol;
857  } else {
858  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
859  // (for an empty vector, this should not cost more than push_back)
860  kinResolutions_.insert(kinResolutions_.begin(), resol);
861  }
862  } else {
863  std::vector<std::string>::iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
864  if (match != kinResolutionLabels_.end()) {
865  // Existing object: replace
866  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
867  kinResolutions_[(match - kinResolutionLabels_.begin())+1] = resol;
868  } else {
869  kinResolutions_[(match - kinResolutionLabels_.begin())] = resol;
870  }
871  } else {
872  kinResolutionLabels_.push_back(label);
873  kinResolutions_.push_back(resol);
874  }
875  }
876  }
877 
878 
879 
880 
881 }
882 
883 #endif
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:415
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:523
bool hasUserFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:329
bool hasOverlaps(const std::string &label) const
Returns true if there was at least one overlap for this test label.
Definition: PATObject.h:719
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:188
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const char *nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:136
std::vector< std::pair< std::string, pat::LookupTableRecord > > efficiencies() const
Returns the efficiencies as &lt;name,value&gt; pairs (by value)
Definition: PATObject.h:628
const TriggerObjectStandAlone * triggerObjectMatchByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:192
void addUserDataFromPtr(const std::string &label, const edm::Ptr< pat::UserData > &data)
Definition: PATObject.h:309
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:144
double resolPhi(const LorentzVector &p4) const
Resolution on phi, given the 4-momentum of the associated Candidate.
static const HistoName names[]
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:418
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:842
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:217
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:236
PATObject()
default constructor
Definition: PATObject.h:451
double resolP(const std::string &label="") const
Resolution on p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:382
const TriggerObjectStandAlone * triggerObjectMatchByFilterID(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:88
virtual int status() const
status word
size_t genParticlesSize() const
Number of generator level particles stored as ref or embedded.
Definition: PATObject.h:241
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:438
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:174
edm::Ref< GenParticleCollection > GenParticleRef
persistent reference to a GenParticle
bool empty() const
Is the RefVector empty.
Definition: PtrVectorBase.h:70
Class to store the result of a lookup table fetch, e.g. for efficiencies.
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const std::string &labelFilter) const
get all matched HLT objects used in a certain HLT filter
Definition: PATObject.h:576
double resolPInv(const std::string &label="") const
Resolution on 1/p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:388
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:325
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:441
double resolPz(const std::string &label="") const
Resolution on pz, possibly with a label to specify which resolution to use.
Definition: PATObject.h:397
const TriggerObjectStandAlone * triggerObjectMatchByCondition(const char *nameCondition, const size_t idx=0) const
Definition: PATObject.h:112
bool hasUserCand(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:351
std::vector< std::string > userCandLabels_
Definition: PATObject.h:437
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
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:670
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:686
void setEfficiency(const std::string &name, const pat::LookupTableRecord &value)
Definition: PATObject.h:639
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
TriggerObjectStandAloneCollection triggerObjectMatchesEmbedded_
vector of trigger matches
Definition: PATObject.h:410
double charge(const std::vector< uint8_t > &Ampls)
void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false)
Set the generator level particle reference.
Definition: PATObject.h:654
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:428
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:420
const std::vector< std::string > & userCandNames() const
Get list of user-defined cand names.
Definition: PATObject.h:349
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
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:209
std::vector< float > userFloats_
Definition: PATObject.h:432
float userFloat(const std::string &key) const
Definition: PATObject.h:755
virtual ~PATObject()
destructor
Definition: PATObject.h:55
#define embed
Definition: AMPTWrapper.h:178
void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="")
Add a kinematic resolution to this object (possibly with a label)
Definition: PATObject.h:852
void unpackTriggerObjectPathNames(const edm::TriggerNames &names)
unpack path names of matched trigger objects (if they were packed before embedding, which is not normally the case)
Definition: PATObject.h:198
bool hasUserInt(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:339
double resolPt(const std::string &label="") const
Resolution on pt, possibly with a label to specify which resolution to use.
Definition: PATObject.h:385
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:724
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:565
double resolPz(const LorentzVector &p4) const
Resolution on pz, given the 4-momentum of the associated Candidate.
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
void push_back(D *&d)
Definition: OwnVector.h:274
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:585
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:413
double resolPy(const std::string &label="") const
Resolution on py, possibly with a label to specify which resolution to use.
Definition: PATObject.h:394
double resolEt(const std::string &label="") const
Resolution on et, possibly with a label to specify which resolution to use.
Definition: PATObject.h:379
double resolPx(const std::string &label="") const
Resolution on px, possibly with a label to specify which resolution to use.
Definition: PATObject.h:391
double resolP(const LorentzVector &p4) const
Resolution on p, given the 4-momentum of the associated Candidate.
void addUserFloat(const std::string &label, float data)
Set user-defined float.
Definition: PATObject.h:765
void embedGenParticle()
Definition: PATObject.h:677
double resolPy(const LorentzVector &p4) const
Resolution on py, given the 4-momentum of the associated Candidate.
const TriggerObjectStandAlone * triggerObjectMatchByPath(const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:184
double p4[4]
Definition: TauolaWrapper.h:92
virtual int charge() const
electric charge
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double resolEta(const LorentzVector &p4) const
Resolution on eta, given the 4-momentum of the associated Candidate.
std::vector< std::string > userFloatLabels_
Definition: PATObject.h:431
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:487
void addUserInt(const std::string &label, int32_t data)
Set user-defined int.
Definition: PATObject.h:784
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:272
const TriggerObjectStandAlone * triggerObjectMatchByFilter(const char *labelFilter, const size_t idx=0) const
Definition: PATObject.h:156
#define end
Definition: vmac.h:37
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:596
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
double resolPhi(const std::string &label="") const
Resolution on phi, possibly with a label to specify which resolution to use.
Definition: PATObject.h:373
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
Definition: PATObject.h:484
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:605
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition(const char *nameCondition) const
Definition: PATObject.h:106
bool hasUserData(const std::string &key) const
Check if user data with a specific type is present.
Definition: PATObject.h:278
double resolE(const std::string &label="") const
Resolution on energy, possibly with a label to specify which resolution to use.
Definition: PATObject.h:376
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:166
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:556
ObjectType base_type
Definition: PATObject.h:44
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:120
double resolM(const LorentzVector &p4) const
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:425
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:444
void setOverlaps(const std::string &label, const reco::CandidatePtrVector &overlaps)
Definition: PATObject.h:732
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID(const unsigned triggerObjectType) const
Definition: PATObject.h:79
void addUserData(const std::string &label, const T &data, bool transientOnly=false)
Definition: PATObject.h:302
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:661
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
double resolPInv(const LorentzVector &p4) const
Resolution on 1/p, given the 4-momentum of the associated Candidate.
pat::UserDataCollection userDataObjects_
Definition: PATObject.h:429
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:514
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
JetCorrectorParametersCollection coll
Definition: classes.h:10
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:124
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:745
int32_t userInt(const std::string &key) const
Definition: PATObject.h:774
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const TriggerObjectStandAlone * triggerObjectMatchByType(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:84
void addTriggerObjectMatch(const TriggerObjectStandAlone &trigObj)
add a trigger match
Definition: PATObject.h:196
const std::vector< std::string > & userDataNames() const
Get list of user data object names.
Definition: PATObject.h:288
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:140
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:69
const void * userDataBare(const std::string &key) const
Definition: PATObject.h:292
reco::CandidatePtr userCand(const std::string &key) const
Definition: PATObject.h:792
const TriggerObjectStandAlone * triggerObjectMatchByCollection(const char *coll, const size_t idx=0) const
Definition: PATObject.h:100
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const unsigned triggerObjectType) const
Definition: PATObject.h:75
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
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:545
list key
Definition: combine.py:13
virtual const std::string & typeName() const =0
Human readable name of the concrete type of stored data.
double resolE(const LorentzVector &p4) const
Resolution on energy, given the 4-momentum of the associated Candidate.
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const trigger::TriggerObjectType triggerObjectType) const
Definition: PATObject.h:494
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const char *coll) const
Definition: PATObject.h:94
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:536
float userFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:318
void addUserCand(const std::string &label, const reco::CandidatePtr &data)
Set user-defined int.
Definition: PATObject.h:802
const pat::LookupTableRecord & efficiency(const std::string &name) const
Returns an efficiency given its name.
Definition: PATObject.h:617
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:170
const reco::Candidate * originalObject() const
access to the original object; returns zero for null Ref and throws for unavailable collection ...
Definition: PATObject.h:471
Templated PAT object container.
Definition: PATObject.h:41
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:811
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:503
double resolTheta(const std::string &label="") const
Resolution on theta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:370
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
Base class for data that users can add to pat objects.
Definition: UserData.h:25
std::vector< std::string > overlapLabels_
Overlapping test labels (only if there are any overlaps)
Definition: PATObject.h:423
double resolEt(const LorentzVector &p4) const
Resolution on et, given the 4-momentum of the associated Candidate.
const std::vector< std::string > & userFloatNames() const
Get list of user-defined float names.
Definition: PATObject.h:323
double resolPt(const LorentzVector &p4) const
Resolution on pt, given the 4-momentum of the associated Candidate.
tuple status
Definition: ntuplemaker.py:245
std::vector< int32_t > userInts_
Definition: PATObject.h:435
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const char *labelFilter) const
Definition: PATObject.h:150
long double T
const std::vector< std::string > & userIntNames() const
Get list of user-defined int names.
Definition: PATObject.h:337
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:128
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:407
tuple size
Write out results.
double resolM(const std::string &label="") const
Definition: PATObject.h:401
reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const
Definition: PATObject.h:696
const void * bareData() const
Definition: UserData.h:50
T get(const Candidate &c)
Definition: component.h:55
double resolEta(const std::string &label="") const
Resolution on eta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:367
const std::string & userDataObjectType(const std::string &key) const
Get human-readable type of user data object, for debugging.
Definition: PATObject.h:282
const std::vector< std::string > & efficiencyNames() const
Returns the list of the names of the stored efficiencies.
Definition: PATObject.h:207
Analysis-level trigger object class (stand-alone)
double resolTheta(const LorentzVector &p4) const
Resolution on theta, given the 4-momentum of the associated Candidate.
std::vector< std::string > userIntLabels_
Definition: PATObject.h:434
const std::vector< std::string > & overlapLabels() const
Returns the labels of the overlap tests that found at least one overlap.
Definition: PATObject.h:265