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 ); };
197 
199  const pat::LookupTableRecord & efficiency(const std::string &name) const ;
201  std::vector<std::pair<std::string,pat::LookupTableRecord> > efficiencies() const ;
203  const std::vector<std::string> & efficiencyNames() const { return efficiencyNames_; }
205  const std::vector<pat::LookupTableRecord> & efficiencyValues() const { return efficiencyValues_; }
210 
214  if (idx >= genParticlesSize()) return reco::GenParticleRef();
216  }
227  // implementation note: uint8_t instead of bool, because the string parser doesn't allow bool currently
228  reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const ;
229 
232  const reco::GenParticle * genParticle(size_t idx=0) const {
234  return ref.isNonnull() ? ref.get() : 0;
235  }
237  size_t genParticlesSize() const {
238  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
239  }
242  std::vector<reco::GenParticleRef> genParticleRefs() const ;
243 
245  void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false) ;
248  void addGenParticleRef(const reco::GenParticleRef &ref) ;
250  void setGenParticle( const reco::GenParticle &particle ) ;
253  void embedGenParticle() ;
254 
256  bool hasOverlaps(const std::string &label) const ;
259  const reco::CandidatePtrVector & overlaps(const std::string &label) const ;
261  const std::vector<std::string> & overlapLabels() const { return overlapLabels_; }
266 
268  template<typename T> const T * userData(const std::string &key) const {
269  const pat::UserData * data = userDataObject_(key);
270  return (data != 0 ? data->template get<T>() : 0);
271 
272  }
274  bool hasUserData(const std::string &key) const {
275  return (userDataObject_(key) != 0);
276  }
279  static const std::string EMPTY("");
280  const pat::UserData * data = userDataObject_(key);
281  return (data != 0 ? data->typeName() : EMPTY);
282  };
284  const std::vector<std::string> & userDataNames() const { return userDataLabels_; }
285 
288  const void * userDataBare(const std::string &key) const {
289  const pat::UserData * data = userDataObject_(key);
290  return (data != 0 ? data->bareData() : 0);
291  }
292 
297  template<typename T>
298  void addUserData( const std::string & label, const T & data, bool transientOnly=false ) {
299  userDataLabels_.push_back(label);
300  userDataObjects_.push_back(pat::UserData::make<T>(data, transientOnly));
301  }
302 
306  userDataLabels_.push_back(label);
307  userDataObjects_.push_back(data->clone());
308  }
309 
312  float userFloat( const std::string & key ) const;
314  float userFloat( const char* key ) const { return userFloat( std::string(key) ); }
315 
317  void addUserFloat( const std::string & label, float data );
319  const std::vector<std::string> & userFloatNames() const { return userFloatLabels_; }
321  bool hasUserFloat( const std::string & key ) const {
322  return std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key) != userFloatLabels_.end();
323  }
325  bool hasUserFloat( const char* key ) const {return hasUserFloat( std::string(key) );}
326 
329  int32_t userInt( const std::string & key ) const;
331  void addUserInt( const std::string & label, int32_t data );
333  const std::vector<std::string> & userIntNames() const { return userIntLabels_; }
335  bool hasUserInt( const std::string & key ) const {
336  return std::find(userIntLabels_.begin(), userIntLabels_.end(), key) != userIntLabels_.end();
337  }
338 
341  reco::CandidatePtr userCand( const std::string & key ) const;
343  void addUserCand( const std::string & label, const reco::CandidatePtr & data );
345  const std::vector<std::string> & userCandNames() const { return userCandLabels_; }
347  bool hasUserCand( const std::string & key ) const {
348  return std::find(userCandLabels_.begin(), userCandLabels_.end(), key) != userCandLabels_.end();
349  }
350 
351  // === New Kinematic Resolutions
354  const pat::CandKinResolution & getKinResolution(const std::string &label="") const ;
355 
357  bool hasKinResolution(const std::string &label="") const ;
358 
360  void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="") ;
361 
363  double resolEta(const std::string &label="") const { return getKinResolution(label).resolEta(this->p4()); }
364 
366  double resolTheta(const std::string &label="") const { return getKinResolution(label).resolTheta(this->p4()); }
367 
369  double resolPhi(const std::string &label="") const { return getKinResolution(label).resolPhi(this->p4()); }
370 
372  double resolE(const std::string &label="") const { return getKinResolution(label).resolE(this->p4()); }
373 
375  double resolEt(const std::string &label="") const { return getKinResolution(label).resolEt(this->p4()); }
376 
378  double resolP(const std::string &label="") const { return getKinResolution(label).resolP(this->p4()); }
379 
381  double resolPt(const std::string &label="") const { return getKinResolution(label).resolPt(this->p4()); }
382 
384  double resolPInv(const std::string &label="") const { return getKinResolution(label).resolPInv(this->p4()); }
385 
387  double resolPx(const std::string &label="") const { return getKinResolution(label).resolPx(this->p4()); }
388 
390  double resolPy(const std::string &label="") const { return getKinResolution(label).resolPy(this->p4()); }
391 
393  double resolPz(const std::string &label="") const { return getKinResolution(label).resolPz(this->p4()); }
394 
397  double resolM(const std::string &label="") const { return getKinResolution(label).resolM(this->p4()); }
398 
399 
400 
401  protected:
402  // reference back to the original object
404 
407 
409  std::vector<pat::LookupTableRecord> efficiencyValues_;
411  std::vector<std::string> efficiencyNames_;
412 
414  std::vector<reco::GenParticleRef> genParticleRef_;
416  std::vector<reco::GenParticle> genParticleEmbedded_;
417 
419  std::vector<std::string> overlapLabels_;
421  std::vector<reco::CandidatePtrVector> overlapItems_;
422 
424  std::vector<std::string> userDataLabels_;
426  // User float values
427  std::vector<std::string> userFloatLabels_;
428  std::vector<float> userFloats_;
429  // User int values
430  std::vector<std::string> userIntLabels_;
431  std::vector<int32_t> userInts_;
432  // User candidate matches
433  std::vector<std::string> userCandLabels_;
434  std::vector<reco::CandidatePtr> userCands_;
435 
437  std::vector<pat::CandKinResolution> kinResolutions_;
440  std::vector<std::string> kinResolutionLabels_;
441 
442  private:
443  const pat::UserData * userDataObject_(const std::string &key) const ;
444  };
445 
446 
447  template <class ObjectType> PATObject<ObjectType>::PATObject() {
448  }
449 
450  template <class ObjectType> PATObject<ObjectType>::PATObject(const ObjectType & obj) :
451  ObjectType(obj),
452  refToOrig_() {
453  }
454 
455  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::RefToBase<ObjectType> & ref) :
456  ObjectType(*ref),
457  refToOrig_(ref.id(), ref.get(), ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
458  // which happens to be true, otherwise the line before this throws ex. already
459  {
460  }
461 
462  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::Ptr<ObjectType> & ref) :
463  ObjectType(*ref),
464  refToOrig_(ref) {
465  }
466 
467  template <class ObjectType> const reco::Candidate * PATObject<ObjectType>::originalObject() const {
468  if (refToOrig_.isNull()) {
469  // this object was not produced from a reference, so no link to the
470  // original object exists -> return a 0-pointer
471  return 0;
472  } else if (!refToOrig_.isAvailable()) {
473  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.";
474  } else {
475  return refToOrig_.get();
476  }
477  }
478 
479  template <class ObjectType>
481 
482  template <class ObjectType>
484  if ( idx >= triggerObjectMatches().size() ) return 0;
485  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, idx );
486  return ref.isNonnull() ? ref.get() : 0;
487  }
488 
489  template <class ObjectType>
492  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
493  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
494  }
495  return matches;
496  }
497 
498  template <class ObjectType>
500  std::vector< size_t > refs;
501  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
502  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) refs.push_back( i );
503  }
504  if ( idx >= refs.size() ) return 0;
505  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
506  return ref.isNonnull() ? ref.get() : 0;
507  }
508 
509  template <class ObjectType>
512  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
513  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
514  }
515  return matches;
516  }
517 
518  template <class ObjectType>
520  std::vector< size_t > refs;
521  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
522  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) {
523  refs.push_back( i );
524  }
525  }
526  if ( idx >= refs.size() ) return 0;
527  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
528  return ref.isNonnull() ? ref.get() : 0;
529  }
530 
531  template <class ObjectType>
534  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
535  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
536  }
537  return matches;
538  }
539 
540  template <class ObjectType>
542  std::vector< size_t > refs;
543  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
544  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) refs.push_back( i );
545  }
546  if ( idx >= refs.size() ) return 0;
547  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
548  return ref.isNonnull() ? ref.get() : 0;
549  }
550 
551  template <class ObjectType>
552  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted ) const {
554  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
555  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
556  }
557  return matches;
558  }
559 
560  template <class ObjectType>
561  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted, const size_t idx ) const {
562  std::vector< size_t > refs;
563  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
564  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) refs.push_back( i );
565  }
566  if ( idx >= refs.size() ) return 0;
567  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
568  return ref.isNonnull() ? ref.get() : 0;
569  }
570 
571  template <class ObjectType>
574  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
575  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
576  }
577  return matches;
578  }
579 
580  template <class ObjectType>
582  std::vector< size_t > refs;
583  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
584  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) refs.push_back( i );
585  }
586  if ( idx >= refs.size() ) return 0;
587  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
588  return ref.isNonnull() ? ref.get() : 0;
589  }
590 
591  template <class ObjectType>
592  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted ) const {
594  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
595  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
596  }
597  return matches;
598  }
599 
600  template <class ObjectType>
601  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted, const size_t idx ) const {
602  std::vector< size_t > refs;
603  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
604  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) refs.push_back( i );
605  }
606  if ( idx >= refs.size() ) return 0;
607  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
608  return ref.isNonnull() ? ref.get() : 0;
609  }
610 
611  template <class ObjectType>
612  const pat::LookupTableRecord &
614  // find the name in the (sorted) list of names
615  std::vector<std::string>::const_iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
616  if ((it == efficiencyNames_.end()) || (*it != name)) {
617  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
618  }
619  return efficiencyValues_[it - efficiencyNames_.begin()];
620  }
621 
622  template <class ObjectType>
623  std::vector<std::pair<std::string,pat::LookupTableRecord> >
625  std::vector<std::pair<std::string,pat::LookupTableRecord> > ret;
626  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
627  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
628  for ( ; itn != edn; ++itn, ++itv) {
629  ret.push_back( std::pair<std::string,pat::LookupTableRecord>(*itn, *itv) );
630  }
631  return ret;
632  }
633 
634  template <class ObjectType>
636  // look for the name, or to the place where we can insert it without violating the alphabetic order
637  std::vector<std::string>::iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
638  if (it == efficiencyNames_.end()) { // insert at the end
639  efficiencyNames_.push_back(name);
640  efficiencyValues_.push_back(value);
641  } else if (*it == name) { // replace existing
642  efficiencyValues_[it - efficiencyNames_.begin()] = value;
643  } else { // insert in the middle :-(
644  efficiencyNames_. insert(it, name);
645  efficiencyValues_.insert( efficiencyValues_.begin() + (it - efficiencyNames_.begin()), value );
646  }
647  }
648 
649  template <class ObjectType>
651  genParticleRef_ = std::vector<reco::GenParticleRef>(1,ref);
652  genParticleEmbedded_.clear();
653  if (embed) embedGenParticle();
654  }
655 
656  template <class ObjectType>
658  if (!genParticleEmbedded_.empty()) { // we're embedding
659  if (ref.isNonnull()) genParticleEmbedded_.push_back(*ref);
660  } else {
661  genParticleRef_.push_back(ref);
662  }
663  }
664 
665  template <class ObjectType>
667  genParticleEmbedded_.clear();
668  genParticleEmbedded_.push_back(particle);
669  genParticleRef_.clear();
670  }
671 
672  template <class ObjectType>
674  genParticleEmbedded_.clear();
675  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end(); ++it) {
676  if (it->isNonnull()) genParticleEmbedded_.push_back(**it);
677  }
678  genParticleRef_.clear();
679  }
680 
681  template <class ObjectType>
682  std::vector<reco::GenParticleRef> PATObject<ObjectType>::genParticleRefs() const {
683  if (genParticleEmbedded_.empty()) return genParticleRef_;
684  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
685  for (size_t i = 0, n = ret.size(); i < n; ++i) {
686  ret[i] = reco::GenParticleRef(&genParticleEmbedded_, i);
687  }
688  return ret;
689  }
690 
691  template <class ObjectType>
693  // get a vector, avoiding an unneeded copy if there is no embedding
694  const std::vector<reco::GenParticleRef> & vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
695  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
696  if (ref->isNonnull()) {
697  const reco::GenParticle & g = **ref;
698  if ((status != 0) && (g.status() != status)) continue;
699  if (pdgId == 0) {
700  return *ref;
701  } else if (!autoCharge) {
702  if (pdgId == g.pdgId()) return *ref;
703  } else if (abs(pdgId) == abs(g.pdgId())) {
704  // I want pdgId > 0 to match "correct charge" (for charged particles)
705  if (g.charge() == 0) return *ref;
706  else if ((this->charge() == 0) && (pdgId == g.pdgId())) return *ref;
707  else if (g.charge()*this->charge()*pdgId > 0) return *ref;
708  }
709  }
710  }
711  return reco::GenParticleRef();
712  }
713 
714  template <class ObjectType>
716  return std::find(overlapLabels_.begin(), overlapLabels_.end(), label) != overlapLabels_.end();
717  }
718 
719  template <class ObjectType>
721  static const reco::CandidatePtrVector EMPTY;
722  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
723  if (match == overlapLabels_.end()) return EMPTY;
724  return overlapItems_[match - overlapLabels_.begin()];
725  }
726 
727  template <class ObjectType>
729  if (!overlaps.empty()) {
730  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
731  if (match == overlapLabels_.end()) {
732  overlapLabels_.push_back(label);
733  overlapItems_.push_back(overlaps);
734  } else {
735  overlapItems_[match - overlapLabels_.begin()] = overlaps;
736  }
737  }
738  }
739 
740  template <class ObjectType>
742  {
743  std::vector<std::string>::const_iterator it = std::find(userDataLabels_.begin(), userDataLabels_.end(), key);
744  if (it != userDataLabels_.end()) {
745  return & userDataObjects_[it - userDataLabels_.begin()];
746  }
747  return 0;
748  }
749 
750  template <class ObjectType>
752  {
753  std::vector<std::string>::const_iterator it = std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key);
754  if (it != userFloatLabels_.end()) {
755  return userFloats_[it - userFloatLabels_.begin()];
756  }
757  return 0.0;
758  }
759 
760  template <class ObjectType>
762  float data )
763  {
764  userFloatLabels_.push_back(label);
765  userFloats_.push_back( data );
766  }
767 
768 
769  template <class ObjectType>
771  {
772  std::vector<std::string>::const_iterator it = std::find(userIntLabels_.begin(), userIntLabels_.end(), key);
773  if (it != userIntLabels_.end()) {
774  return userInts_[it - userIntLabels_.begin()];
775  }
776  return 0;
777  }
778 
779  template <class ObjectType>
781  int data )
782  {
783  userIntLabels_.push_back(label);
784  userInts_.push_back( data );
785  }
786 
787  template <class ObjectType>
789  {
790  std::vector<std::string>::const_iterator it = std::find(userCandLabels_.begin(), userCandLabels_.end(), key);
791  if (it != userCandLabels_.end()) {
792  return userCands_[it - userCandLabels_.begin()];
793  }
794  return reco::CandidatePtr();
795  }
796 
797  template <class ObjectType>
799  const reco::CandidatePtr & data )
800  {
801  userCandLabels_.push_back(label);
802  userCands_.push_back( data );
803  }
804 
805 
806  template <class ObjectType>
808  if (label.empty()) {
809  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
810  return kinResolutions_[0];
811  } else {
812  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
813  }
814  } else {
815  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
816  if (match == kinResolutionLabels_.end()) {
817  cms::Exception ex("Missing Data");
818  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
819  ex << "The known labels are: " ;
820  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.begin(); it != kinResolutionLabels_.end(); ++it) {
821  ex << "'" << *it << "' ";
822  }
823  ex << "\n";
824  throw ex;
825  } else {
826  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
827  // skip un-labelled resolution
828  return kinResolutions_[match - kinResolutionLabels_.begin() + 1];
829  } else {
830  // all are labelled, so this is the real index
831  return kinResolutions_[match - kinResolutionLabels_.begin()];
832  }
833  }
834  }
835  }
836 
837  template <class ObjectType>
839  if (label.empty()) {
840  return (kinResolutionLabels_.size()+1 == kinResolutions_.size());
841  } else {
842  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
843  return match != kinResolutionLabels_.end();
844  }
845  }
846 
847  template <class ObjectType>
849  if (label.empty()) {
850  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
851  // There is already an un-labelled object. Replace it
852  kinResolutions_[0] = resol;
853  } else {
854  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
855  // (for an empty vector, this should not cost more than push_back)
856  kinResolutions_.insert(kinResolutions_.begin(), resol);
857  }
858  } else {
859  std::vector<std::string>::iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
860  if (match != kinResolutionLabels_.end()) {
861  // Existing object: replace
862  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
863  kinResolutions_[(match - kinResolutionLabels_.begin())+1] = resol;
864  } else {
865  kinResolutions_[(match - kinResolutionLabels_.begin())] = resol;
866  }
867  } else {
868  kinResolutionLabels_.push_back(label);
869  kinResolutions_.push_back(resol);
870  }
871  }
872  }
873 
874 
875 
876 
877 }
878 
879 #endif
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:411
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:519
bool hasUserFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:325
bool hasOverlaps(const std::string &label) const
Returns true if there was at least one overlap for this test label.
Definition: PATObject.h:715
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
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:624
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:305
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.
std::vector< reco::GenParticleRef > genParticleRef_
Reference to a generator level particle.
Definition: PATObject.h:414
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:838
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:213
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:232
PATObject()
default constructor
Definition: PATObject.h:447
double resolP(const std::string &label="") const
Resolution on p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:378
const TriggerObjectStandAlone * triggerObjectMatchByFilterID(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:88
virtual int pdgId() const GCC11_FINAL
PDG identifier.
size_t genParticlesSize() const
Number of generator level particles stored as ref or embedded.
Definition: PATObject.h:237
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:434
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:572
double resolPInv(const std::string &label="") const
Resolution on 1/p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:384
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:321
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:437
double resolPz(const std::string &label="") const
Resolution on pz, possibly with a label to specify which resolution to use.
Definition: PATObject.h:393
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:347
std::vector< std::string > userCandLabels_
Definition: PATObject.h:433
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:666
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:682
void setEfficiency(const std::string &name, const pat::LookupTableRecord &value)
Definition: PATObject.h:635
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:406
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:650
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:424
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:416
const std::vector< std::string > & userCandNames() const
Get list of user-defined cand names.
Definition: PATObject.h:345
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:205
std::vector< float > userFloats_
Definition: PATObject.h:428
float userFloat(const std::string &key) const
Definition: PATObject.h:751
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:848
bool hasUserInt(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:335
double resolPt(const std::string &label="") const
Resolution on pt, possibly with a label to specify which resolution to use.
Definition: PATObject.h:381
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:720
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:561
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:273
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:581
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:409
double resolPy(const std::string &label="") const
Resolution on py, possibly with a label to specify which resolution to use.
Definition: PATObject.h:390
double resolEt(const std::string &label="") const
Resolution on et, possibly with a label to specify which resolution to use.
Definition: PATObject.h:375
virtual int status() const GCC11_FINAL
status word
double resolPx(const std::string &label="") const
Resolution on px, possibly with a label to specify which resolution to use.
Definition: PATObject.h:387
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:761
void embedGenParticle()
Definition: PATObject.h:673
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
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:427
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:483
void addUserInt(const std::string &label, int32_t data)
Set user-defined int.
Definition: PATObject.h:780
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:268
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:592
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:369
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
Definition: PATObject.h:480
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:601
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:274
double resolE(const std::string &label="") const
Resolution on energy, possibly with a label to specify which resolution to use.
Definition: PATObject.h:372
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:552
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:421
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:440
void setOverlaps(const std::string &label, const reco::CandidatePtrVector &overlaps)
Definition: PATObject.h:728
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:298
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:657
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:425
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:510
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
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:741
virtual int charge() const GCC11_FINAL
electric charge
int32_t userInt(const std::string &key) const
Definition: PATObject.h:770
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:284
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:288
reco::CandidatePtr userCand(const std::string &key) const
Definition: PATObject.h:788
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:541
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:490
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:532
float userFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:314
void addUserCand(const std::string &label, const reco::CandidatePtr &data)
Set user-defined int.
Definition: PATObject.h:798
const pat::LookupTableRecord & efficiency(const std::string &name) const
Returns an efficiency given its name.
Definition: PATObject.h:613
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:467
Templated PAT object container.
Definition: PATObject.h:41
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:807
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:499
double resolTheta(const std::string &label="") const
Resolution on theta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:366
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:419
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:319
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:431
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:333
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:128
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:403
tuple size
Write out results.
double resolM(const std::string &label="") const
Definition: PATObject.h:397
reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const
Definition: PATObject.h:692
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:363
const std::string & userDataObjectType(const std::string &key) const
Get human-readable type of user data object, for debugging.
Definition: PATObject.h:278
const std::vector< std::string > & efficiencyNames() const
Returns the list of the names of the stored efficiencies.
Definition: PATObject.h:203
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:430
const std::vector< std::string > & overlapLabels() const
Returns the labels of the overlap tests that found at least one overlap.
Definition: PATObject.h:261