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 // $Id: PATObject.h,v 1.38 2012/01/20 08:51:05 cbern Exp $
3 //
4 
5 #ifndef DataFormats_PatCandidates_PATObject_h
6 #define DataFormats_PatCandidates_PATObject_h
7 
25 #include <vector>
26 #include <string>
27 #include <iosfwd>
28 
31 
33 
36 
38 
39 namespace pat {
40 
41 
42  template <class ObjectType>
43  class PATObject : public ObjectType {
44  public:
45 
47 
49  PATObject();
51  PATObject(const ObjectType & obj);
55  PATObject(const edm::Ptr<ObjectType> & ref);
57  virtual ~PATObject() {}
58  // returns a clone // NO: ObjectType can be an abstract type like reco::Candidate
59  // virtual PATObject<ObjectType> * clone() const ; // for which the clone() can't be defined
60 
62  const reco::Candidate * originalObject() const;
65 
69 
73  const TriggerObjectStandAlone * triggerObjectMatch( const size_t idx = 0 ) const;
77  const TriggerObjectStandAloneCollection triggerObjectMatchesByType( const unsigned triggerObjectType ) const {
78  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
79  };
80  // for backward compatibility
81  const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID( const unsigned triggerObjectType ) const {
82  return triggerObjectMatchesByType( trigger::TriggerObjectType( triggerObjectType ) );
83  };
85  const TriggerObjectStandAlone * triggerObjectMatchByType( const trigger::TriggerObjectType triggerObjectType, const size_t idx = 0 ) const;
86  const TriggerObjectStandAlone * triggerObjectMatchByType( const unsigned triggerObjectType, const size_t idx = 0 ) const {
87  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
88  };
89  // for backward compatibility
90  const TriggerObjectStandAlone * triggerObjectMatchByFilterID( const unsigned triggerObjectType, const size_t idx = 0 ) const {
91  return triggerObjectMatchByType( trigger::TriggerObjectType( triggerObjectType ), idx );
92  };
95  // for RooT command line
98  };
100  const TriggerObjectStandAlone * triggerObjectMatchByCollection( const std::string & coll, const size_t idx = 0 ) const;
101  // for RooT command line
102  const TriggerObjectStandAlone * triggerObjectMatchByCollection( const char * coll, const size_t idx = 0 ) const {
104  };
107  // for RooT command line
108  const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition( const char * nameCondition ) const {
109  return triggerObjectMatchesByCondition( std::string( nameCondition ) );
110  };
112  const TriggerObjectStandAlone * triggerObjectMatchByCondition( const std::string & nameCondition, const size_t idx = 0 ) const;
113  // for RooT command line
114  const TriggerObjectStandAlone * triggerObjectMatchByCondition( const char * nameCondition, const size_t idx = 0 ) const {
115  return triggerObjectMatchByCondition( std::string( nameCondition ), idx );
116  };
120  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted = true ) const;
121  // for RooT command line
122  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const char * nameAlgorithm, const bool algoCondAccepted = true ) const {
123  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted );
124  };
125  // for the cut string parser
126  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const unsigned algoCondAccepted ) const {
127  return triggerObjectMatchesByAlgorithm( nameAlgorithm, bool( algoCondAccepted ) );
128  };
129  // for RooT command line and the cut string parser
130  const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm( const char * nameAlgorithm, const unsigned algoCondAccepted ) const {
131  return triggerObjectMatchesByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ) );
132  };
136  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted = true, const size_t idx = 0 ) const;
137  // for RooT command line
138  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const char * nameAlgorithm, const bool algoCondAccepted = true, const size_t idx = 0 ) const {
139  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), algoCondAccepted, idx );
140  };
141  // for the cut string parser
142  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const unsigned algoCondAccepted, const size_t idx = 0 ) const {
143  return triggerObjectMatchByAlgorithm( nameAlgorithm, bool( algoCondAccepted ), idx );
144  };
145  // for RooT command line and the cut string parser
146  const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm( const char * nameAlgorithm, const unsigned algoCondAccepted, const size_t idx = 0 ) const {
147  return triggerObjectMatchByAlgorithm( std::string( nameAlgorithm ), bool( algoCondAccepted ), idx );
148  };
151  // for RooT command line
152  const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter( const char * labelFilter ) const {
153  return triggerObjectMatchesByFilter( std::string( labelFilter ) );
154  };
156  const TriggerObjectStandAlone * triggerObjectMatchByFilter( const std::string & labelFilter, const size_t idx = 0 ) const;
157  // for RooT command line
158  const TriggerObjectStandAlone * triggerObjectMatchByFilter( const char * labelFilter, const size_t idx = 0 ) const {
159  return triggerObjectMatchByFilter( std::string( labelFilter ), idx );
160  };
166  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const std::string & namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true ) const;
167  // for RooT command line
168  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const char * namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true ) const {
169  return triggerObjectMatchesByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted );
170  };
171  // for the cut string parser
172  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const std::string & namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1 ) const {
173  return triggerObjectMatchesByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
174  };
175  // for RooT command line and the cut string parser
176  const TriggerObjectStandAloneCollection triggerObjectMatchesByPath( const char * namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1 ) const {
177  return triggerObjectMatchesByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ) );
178  };
184  const TriggerObjectStandAlone * triggerObjectMatchByPath( const std::string & namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true, const size_t idx = 0 ) const;
185  // for RooT command line
186  const TriggerObjectStandAlone * triggerObjectMatchByPath( const char * namePath, const bool pathLastFilterAccepted = false, const bool pathL3FilterAccepted = true, const size_t idx = 0 ) const {
187  return triggerObjectMatchByPath( std::string( namePath ), pathLastFilterAccepted, pathL3FilterAccepted, idx );
188  };
189  // for the cut string parser
190  const TriggerObjectStandAlone * triggerObjectMatchByPath( const std::string & namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1, const size_t idx = 0 ) const {
191  return triggerObjectMatchByPath( namePath, bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
192  };
193  // for RooT command line and the cut string parser
194  const TriggerObjectStandAlone * triggerObjectMatchByPath( const char * namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted = 1, const size_t idx = 0 ) const {
195  return triggerObjectMatchByPath( std::string( namePath ), bool( pathLastFilterAccepted ), bool( pathL3FilterAccepted ), idx );
196  };
198  void addTriggerObjectMatch( const TriggerObjectStandAlone & trigObj ) { triggerObjectMatchesEmbedded_.push_back( trigObj ); };
199 
201  const pat::LookupTableRecord & efficiency(const std::string &name) const ;
203  std::vector<std::pair<std::string,pat::LookupTableRecord> > efficiencies() const ;
205  const std::vector<std::string> & efficiencyNames() const { return efficiencyNames_; }
207  const std::vector<pat::LookupTableRecord> & efficiencyValues() const { return efficiencyValues_; }
212 
216  if (idx >= genParticlesSize()) return reco::GenParticleRef();
218  }
229  // implementation note: uint8_t instead of bool, because the string parser doesn't allow bool currently
230  reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const ;
231 
234  const reco::GenParticle * genParticle(size_t idx=0) const {
236  return ref.isNonnull() ? ref.get() : 0;
237  }
239  size_t genParticlesSize() const {
240  return genParticleEmbedded_.empty() ? genParticleRef_.size() : genParticleEmbedded_.size();
241  }
244  std::vector<reco::GenParticleRef> genParticleRefs() const ;
245 
247  void setGenParticleRef(const reco::GenParticleRef &ref, bool embed=false) ;
250  void addGenParticleRef(const reco::GenParticleRef &ref) ;
252  void setGenParticle( const reco::GenParticle &particle ) ;
255  void embedGenParticle() ;
256 
258  bool hasOverlaps(const std::string &label) const ;
261  const reco::CandidatePtrVector & overlaps(const std::string &label) const ;
263  const std::vector<std::string> & overlapLabels() const { return overlapLabels_; }
268 
270  template<typename T> const T * userData(const std::string &key) const {
271  const pat::UserData * data = userDataObject_(key);
272  return (data != 0 ? data->template get<T>() : 0);
273 
274  }
276  bool hasUserData(const std::string &key) const {
277  return (userDataObject_(key) != 0);
278  }
281  static const std::string EMPTY("");
282  const pat::UserData * data = userDataObject_(key);
283  return (data != 0 ? data->typeName() : EMPTY);
284  };
286  const std::vector<std::string> & userDataNames() const { return userDataLabels_; }
287 
290  const void * userDataBare(const std::string &key) const {
291  const pat::UserData * data = userDataObject_(key);
292  return (data != 0 ? data->bareData() : 0);
293  }
294 
299  template<typename T>
300  void addUserData( const std::string & label, const T & data, bool transientOnly=false ) {
301  userDataLabels_.push_back(label);
302  userDataObjects_.push_back(pat::UserData::make<T>(data, transientOnly));
303  }
304 
308  userDataLabels_.push_back(label);
309  userDataObjects_.push_back(data->clone());
310  }
311 
314  float userFloat( const std::string & key ) const;
316  float userFloat( const char* key ) const { return userFloat( std::string(key) ); }
317 
319  void addUserFloat( const std::string & label, float data );
321  const std::vector<std::string> & userFloatNames() const { return userFloatLabels_; }
323  bool hasUserFloat( const std::string & key ) const {
324  return std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key) != userFloatLabels_.end();
325  }
327  bool hasUserFloat( const char* key ) const {return hasUserFloat( std::string(key) );}
328 
331  int32_t userInt( const std::string & key ) const;
333  void addUserInt( const std::string & label, int32_t data );
335  const std::vector<std::string> & userIntNames() const { return userIntLabels_; }
337  bool hasUserInt( const std::string & key ) const {
338  return std::find(userIntLabels_.begin(), userIntLabels_.end(), key) != userIntLabels_.end();
339  }
340 
343  reco::CandidatePtr userCand( const std::string & key ) const;
345  void addUserCand( const std::string & label, const reco::CandidatePtr & data );
347  const std::vector<std::string> & userCandNames() const { return userCandLabels_; }
349  bool hasUserCand( const std::string & key ) const {
350  return std::find(userCandLabels_.begin(), userCandLabels_.end(), key) != userCandLabels_.end();
351  }
352 
353  // === New Kinematic Resolutions
356  const pat::CandKinResolution & getKinResolution(const std::string &label="") const ;
357 
359  bool hasKinResolution(const std::string &label="") const ;
360 
362  void setKinResolution(const pat::CandKinResolution &resol, const std::string &label="") ;
363 
365  double resolEta(const std::string &label="") const { return getKinResolution(label).resolEta(this->p4()); }
366 
368  double resolTheta(const std::string &label="") const { return getKinResolution(label).resolTheta(this->p4()); }
369 
371  double resolPhi(const std::string &label="") const { return getKinResolution(label).resolPhi(this->p4()); }
372 
374  double resolE(const std::string &label="") const { return getKinResolution(label).resolE(this->p4()); }
375 
377  double resolEt(const std::string &label="") const { return getKinResolution(label).resolEt(this->p4()); }
378 
380  double resolP(const std::string &label="") const { return getKinResolution(label).resolP(this->p4()); }
381 
383  double resolPt(const std::string &label="") const { return getKinResolution(label).resolPt(this->p4()); }
384 
386  double resolPInv(const std::string &label="") const { return getKinResolution(label).resolPInv(this->p4()); }
387 
389  double resolPx(const std::string &label="") const { return getKinResolution(label).resolPx(this->p4()); }
390 
392  double resolPy(const std::string &label="") const { return getKinResolution(label).resolPy(this->p4()); }
393 
395  double resolPz(const std::string &label="") const { return getKinResolution(label).resolPz(this->p4()); }
396 
399  double resolM(const std::string &label="") const { return getKinResolution(label).resolM(this->p4()); }
400 
401 
402 
403  protected:
404  // reference back to the original object
406 
409 
411  std::vector<pat::LookupTableRecord> efficiencyValues_;
413  std::vector<std::string> efficiencyNames_;
414 
416  std::vector<reco::GenParticleRef> genParticleRef_;
418  std::vector<reco::GenParticle> genParticleEmbedded_;
419 
421  std::vector<std::string> overlapLabels_;
423  std::vector<reco::CandidatePtrVector> overlapItems_;
424 
426  std::vector<std::string> userDataLabels_;
428  // User float values
429  std::vector<std::string> userFloatLabels_;
430  std::vector<float> userFloats_;
431  // User int values
432  std::vector<std::string> userIntLabels_;
433  std::vector<int32_t> userInts_;
434  // User candidate matches
435  std::vector<std::string> userCandLabels_;
436  std::vector<reco::CandidatePtr> userCands_;
437 
439  std::vector<pat::CandKinResolution> kinResolutions_;
442  std::vector<std::string> kinResolutionLabels_;
443 
444  private:
445  const pat::UserData * userDataObject_(const std::string &key) const ;
446  };
447 
448 
449  template <class ObjectType> PATObject<ObjectType>::PATObject() {
450  }
451 
452  template <class ObjectType> PATObject<ObjectType>::PATObject(const ObjectType & obj) :
453  ObjectType(obj),
454  refToOrig_() {
455  }
456 
457  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::RefToBase<ObjectType> & ref) :
458  ObjectType(*ref),
459  refToOrig_(ref.id(), ref.get(), ref.key()) // correct way to convert RefToBase=>Ptr, if ref is guaranteed to be available
460  // which happens to be true, otherwise the line before this throws ex. already
461  {
462  }
463 
464  template <class ObjectType> PATObject<ObjectType>::PATObject(const edm::Ptr<ObjectType> & ref) :
465  ObjectType(*ref),
466  refToOrig_(ref) {
467  }
468 
469  template <class ObjectType> const reco::Candidate * PATObject<ObjectType>::originalObject() const {
470  if (refToOrig_.isNull()) {
471  // this object was not produced from a reference, so no link to the
472  // original object exists -> return a 0-pointer
473  return 0;
474  } else if (!refToOrig_.isAvailable()) {
475  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.";
476  } else {
477  return refToOrig_.get();
478  }
479  }
480 
481  template <class ObjectType>
483 
484  template <class ObjectType>
486  if ( idx >= triggerObjectMatches().size() ) return 0;
487  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, idx );
488  return ref.isNonnull() ? ref.get() : 0;
489  }
490 
491  template <class ObjectType>
494  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
495  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
496  }
497  return matches;
498  }
499 
500  template <class ObjectType>
502  std::vector< size_t > refs;
503  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
504  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasTriggerObjectType( triggerObjectType ) ) refs.push_back( i );
505  }
506  if ( idx >= refs.size() ) return 0;
507  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
508  return ref.isNonnull() ? ref.get() : 0;
509  }
510 
511  template <class ObjectType>
514  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
515  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
516  }
517  return matches;
518  }
519 
520  template <class ObjectType>
522  std::vector< size_t > refs;
523  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
524  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasCollection( coll ) ) {
525  refs.push_back( i );
526  }
527  }
528  if ( idx >= refs.size() ) return 0;
529  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
530  return ref.isNonnull() ? ref.get() : 0;
531  }
532 
533  template <class ObjectType>
536  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
537  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
538  }
539  return matches;
540  }
541 
542  template <class ObjectType>
544  std::vector< size_t > refs;
545  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
546  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasConditionName( nameCondition ) ) refs.push_back( i );
547  }
548  if ( idx >= refs.size() ) return 0;
549  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
550  return ref.isNonnull() ? ref.get() : 0;
551  }
552 
553  template <class ObjectType>
554  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted ) const {
556  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
557  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
558  }
559  return matches;
560  }
561 
562  template <class ObjectType>
563  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByAlgorithm( const std::string & nameAlgorithm, const bool algoCondAccepted, const size_t idx ) const {
564  std::vector< size_t > refs;
565  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
566  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasAlgorithmName( nameAlgorithm, algoCondAccepted ) ) refs.push_back( i );
567  }
568  if ( idx >= refs.size() ) return 0;
569  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
570  return ref.isNonnull() ? ref.get() : 0;
571  }
572 
573  template <class ObjectType>
576  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
577  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
578  }
579  return matches;
580  }
581 
582  template <class ObjectType>
584  std::vector< size_t > refs;
585  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
586  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasFilterLabel( labelFilter ) ) refs.push_back( i );
587  }
588  if ( idx >= refs.size() ) return 0;
589  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
590  return ref.isNonnull() ? ref.get() : 0;
591  }
592 
593  template <class ObjectType>
594  const TriggerObjectStandAloneCollection PATObject<ObjectType>::triggerObjectMatchesByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted ) const {
596  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
597  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) matches.push_back( *( triggerObjectMatch( i ) ) );
598  }
599  return matches;
600  }
601 
602  template <class ObjectType>
603  const TriggerObjectStandAlone * PATObject<ObjectType>::triggerObjectMatchByPath( const std::string & namePath, const bool pathLastFilterAccepted, const bool pathL3FilterAccepted, const size_t idx ) const {
604  std::vector< size_t > refs;
605  for ( size_t i = 0; i < triggerObjectMatches().size(); ++i ) {
606  if ( triggerObjectMatch( i ) != 0 && triggerObjectMatch( i )->hasPathName( namePath, pathLastFilterAccepted, pathL3FilterAccepted ) ) refs.push_back( i );
607  }
608  if ( idx >= refs.size() ) return 0;
609  TriggerObjectStandAloneRef ref( &triggerObjectMatchesEmbedded_, refs.at( idx ) );
610  return ref.isNonnull() ? ref.get() : 0;
611  }
612 
613  template <class ObjectType>
614  const pat::LookupTableRecord &
616  // find the name in the (sorted) list of names
617  std::vector<std::string>::const_iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
618  if ((it == efficiencyNames_.end()) || (*it != name)) {
619  throw cms::Exception("Invalid Label") << "There is no efficiency with name '" << name << "' in this PAT Object\n";
620  }
621  return efficiencyValues_[it - efficiencyNames_.begin()];
622  }
623 
624  template <class ObjectType>
625  std::vector<std::pair<std::string,pat::LookupTableRecord> >
627  std::vector<std::pair<std::string,pat::LookupTableRecord> > ret;
628  std::vector<std::string>::const_iterator itn = efficiencyNames_.begin(), edn = efficiencyNames_.end();
629  std::vector<pat::LookupTableRecord>::const_iterator itv = efficiencyValues_.begin();
630  for ( ; itn != edn; ++itn, ++itv) {
631  ret.push_back( std::pair<std::string,pat::LookupTableRecord>(*itn, *itv) );
632  }
633  return ret;
634  }
635 
636  template <class ObjectType>
638  // look for the name, or to the place where we can insert it without violating the alphabetic order
639  std::vector<std::string>::iterator it = std::lower_bound(efficiencyNames_.begin(), efficiencyNames_.end(), name);
640  if (it == efficiencyNames_.end()) { // insert at the end
641  efficiencyNames_.push_back(name);
642  efficiencyValues_.push_back(value);
643  } else if (*it == name) { // replace existing
644  efficiencyValues_[it - efficiencyNames_.begin()] = value;
645  } else { // insert in the middle :-(
646  efficiencyNames_. insert(it, name);
647  efficiencyValues_.insert( efficiencyValues_.begin() + (it - efficiencyNames_.begin()), value );
648  }
649  }
650 
651  template <class ObjectType>
653  genParticleRef_ = std::vector<reco::GenParticleRef>(1,ref);
654  genParticleEmbedded_.clear();
655  if (embed) embedGenParticle();
656  }
657 
658  template <class ObjectType>
660  if (!genParticleEmbedded_.empty()) { // we're embedding
661  if (ref.isNonnull()) genParticleEmbedded_.push_back(*ref);
662  } else {
663  genParticleRef_.push_back(ref);
664  }
665  }
666 
667  template <class ObjectType>
669  genParticleEmbedded_.clear();
670  genParticleEmbedded_.push_back(particle);
671  genParticleRef_.clear();
672  }
673 
674  template <class ObjectType>
676  genParticleEmbedded_.clear();
677  for (std::vector<reco::GenParticleRef>::const_iterator it = genParticleRef_.begin(); it != genParticleRef_.end(); ++it) {
678  if (it->isNonnull()) genParticleEmbedded_.push_back(**it);
679  }
680  genParticleRef_.clear();
681  }
682 
683  template <class ObjectType>
684  std::vector<reco::GenParticleRef> PATObject<ObjectType>::genParticleRefs() const {
685  if (genParticleEmbedded_.empty()) return genParticleRef_;
686  std::vector<reco::GenParticleRef> ret(genParticleEmbedded_.size());
687  for (size_t i = 0, n = ret.size(); i < n; ++i) {
688  ret[i] = reco::GenParticleRef(&genParticleEmbedded_, i);
689  }
690  return ret;
691  }
692 
693  template <class ObjectType>
695  // get a vector, avoiding an unneeded copy if there is no embedding
696  const std::vector<reco::GenParticleRef> & vec = (genParticleEmbedded_.empty() ? genParticleRef_ : genParticleRefs());
697  for (std::vector<reco::GenParticleRef>::const_iterator ref = vec.begin(), end = vec.end(); ref != end; ++ref) {
698  if (ref->isNonnull()) {
699  const reco::GenParticle & g = **ref;
700  if ((status != 0) && (g.status() != status)) continue;
701  if (pdgId == 0) {
702  return *ref;
703  } else if (!autoCharge) {
704  if (pdgId == g.pdgId()) return *ref;
705  } else if (abs(pdgId) == abs(g.pdgId())) {
706  // I want pdgId > 0 to match "correct charge" (for charged particles)
707  if (g.charge() == 0) return *ref;
708  else if ((this->charge() == 0) && (pdgId == g.pdgId())) return *ref;
709  else if (g.charge()*this->charge()*pdgId > 0) return *ref;
710  }
711  }
712  }
713  return reco::GenParticleRef();
714  }
715 
716  template <class ObjectType>
718  return std::find(overlapLabels_.begin(), overlapLabels_.end(), label) != overlapLabels_.end();
719  }
720 
721  template <class ObjectType>
723  static const reco::CandidatePtrVector EMPTY;
724  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
725  if (match == overlapLabels_.end()) return EMPTY;
726  return overlapItems_[match - overlapLabels_.begin()];
727  }
728 
729  template <class ObjectType>
731  if (!overlaps.empty()) {
732  std::vector<std::string>::const_iterator match = std::find(overlapLabels_.begin(), overlapLabels_.end(), label);
733  if (match == overlapLabels_.end()) {
734  overlapLabels_.push_back(label);
735  overlapItems_.push_back(overlaps);
736  } else {
737  overlapItems_[match - overlapLabels_.begin()] = overlaps;
738  }
739  }
740  }
741 
742  template <class ObjectType>
744  {
745  std::vector<std::string>::const_iterator it = std::find(userDataLabels_.begin(), userDataLabels_.end(), key);
746  if (it != userDataLabels_.end()) {
747  return & userDataObjects_[it - userDataLabels_.begin()];
748  }
749  return 0;
750  }
751 
752  template <class ObjectType>
754  {
755  std::vector<std::string>::const_iterator it = std::find(userFloatLabels_.begin(), userFloatLabels_.end(), key);
756  if (it != userFloatLabels_.end()) {
757  return userFloats_[it - userFloatLabels_.begin()];
758  }
759  return 0.0;
760  }
761 
762  template <class ObjectType>
764  float data )
765  {
766  userFloatLabels_.push_back(label);
767  userFloats_.push_back( data );
768  }
769 
770 
771  template <class ObjectType>
773  {
774  std::vector<std::string>::const_iterator it = std::find(userIntLabels_.begin(), userIntLabels_.end(), key);
775  if (it != userIntLabels_.end()) {
776  return userInts_[it - userIntLabels_.begin()];
777  }
778  return 0;
779  }
780 
781  template <class ObjectType>
783  int data )
784  {
785  userIntLabels_.push_back(label);
786  userInts_.push_back( data );
787  }
788 
789  template <class ObjectType>
791  {
792  std::vector<std::string>::const_iterator it = std::find(userCandLabels_.begin(), userCandLabels_.end(), key);
793  if (it != userCandLabels_.end()) {
794  return userCands_[it - userCandLabels_.begin()];
795  }
796  return reco::CandidatePtr();
797  }
798 
799  template <class ObjectType>
801  const reco::CandidatePtr & data )
802  {
803  userCandLabels_.push_back(label);
804  userCands_.push_back( data );
805  }
806 
807 
808  template <class ObjectType>
810  if (label.empty()) {
811  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
812  return kinResolutions_[0];
813  } else {
814  throw cms::Exception("Missing Data", "This object does not contain an un-labelled kinematic resolution");
815  }
816  } else {
817  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
818  if (match == kinResolutionLabels_.end()) {
819  cms::Exception ex("Missing Data");
820  ex << "This object does not contain a kinematic resolution with name '" << label << "'.\n";
821  ex << "The known labels are: " ;
822  for (std::vector<std::string>::const_iterator it = kinResolutionLabels_.begin(); it != kinResolutionLabels_.end(); ++it) {
823  ex << "'" << *it << "' ";
824  }
825  ex << "\n";
826  throw ex;
827  } else {
828  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
829  // skip un-labelled resolution
830  return kinResolutions_[match - kinResolutionLabels_.begin() + 1];
831  } else {
832  // all are labelled, so this is the real index
833  return kinResolutions_[match - kinResolutionLabels_.begin()];
834  }
835  }
836  }
837  }
838 
839  template <class ObjectType>
841  if (label.empty()) {
842  return (kinResolutionLabels_.size()+1 == kinResolutions_.size());
843  } else {
844  std::vector<std::string>::const_iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
845  return match != kinResolutionLabels_.end();
846  }
847  }
848 
849  template <class ObjectType>
851  if (label.empty()) {
852  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
853  // There is already an un-labelled object. Replace it
854  kinResolutions_[0] = resol;
855  } else {
856  // Insert. Note that the un-labelled is always the first, so we need to insert before begin()
857  // (for an empty vector, this should not cost more than push_back)
858  kinResolutions_.insert(kinResolutions_.begin(), resol);
859  }
860  } else {
861  std::vector<std::string>::iterator match = std::find(kinResolutionLabels_.begin(), kinResolutionLabels_.end(), label);
862  if (match != kinResolutionLabels_.end()) {
863  // Existing object: replace
864  if (kinResolutionLabels_.size()+1 == kinResolutions_.size()) {
865  kinResolutions_[(match - kinResolutionLabels_.begin())+1] = resol;
866  } else {
867  kinResolutions_[(match - kinResolutionLabels_.begin())] = resol;
868  }
869  } else {
870  kinResolutionLabels_.push_back(label);
871  kinResolutions_.push_back(resol);
872  }
873  }
874  }
875 
876 
877 
878 
879 }
880 
881 #endif
std::vector< std::string > efficiencyNames_
vector of the efficiencies (names)
Definition: PATObject.h:413
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:521
bool hasUserFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:327
bool hasOverlaps(const std::string &label) const
Returns true if there was at least one overlap for this test label.
Definition: PATObject.h:717
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:190
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:138
std::vector< std::pair< std::string, pat::LookupTableRecord > > efficiencies() const
Returns the efficiencies as &lt;name,value&gt; pairs (by value)
Definition: PATObject.h:626
const TriggerObjectStandAlone * triggerObjectMatchByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1, const size_t idx=0) const
Definition: PATObject.h:194
void addUserDataFromPtr(const std::string &label, const edm::Ptr< pat::UserData > &data)
Definition: PATObject.h:307
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:146
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:416
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:840
reco::GenParticleRef genParticleRef(size_t idx=0) const
Definition: PATObject.h:215
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:234
PATObject()
default constructor
Definition: PATObject.h:449
double resolP(const std::string &label="") const
Resolution on p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:380
const TriggerObjectStandAlone * triggerObjectMatchByFilterID(const unsigned triggerObjectType, const size_t idx=0) const
Definition: PATObject.h:90
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:239
std::vector< reco::CandidatePtr > userCands_
Definition: PATObject.h:436
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:176
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:574
double resolPInv(const std::string &label="") const
Resolution on 1/p, possibly with a label to specify which resolution to use.
Definition: PATObject.h:386
bool hasUserFloat(const std::string &key) const
Return true if there is a user-defined float with a given name.
Definition: PATObject.h:323
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< pat::CandKinResolution > kinResolutions_
Kinematic resolutions.
Definition: PATObject.h:439
double resolPz(const std::string &label="") const
Resolution on pz, possibly with a label to specify which resolution to use.
Definition: PATObject.h:395
const TriggerObjectStandAlone * triggerObjectMatchByCondition(const char *nameCondition, const size_t idx=0) const
Definition: PATObject.h:114
bool hasUserCand(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:349
std::vector< std::string > userCandLabels_
Definition: PATObject.h:435
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:668
std::vector< reco::GenParticleRef > genParticleRefs() const
Definition: PATObject.h:684
void setEfficiency(const std::string &name, const pat::LookupTableRecord &value)
Definition: PATObject.h:637
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:408
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:652
std::vector< std::string > userDataLabels_
User data object.
Definition: PATObject.h:426
std::vector< reco::GenParticle > genParticleEmbedded_
vector to hold an embedded generator level particle
Definition: PATObject.h:418
const std::vector< std::string > & userCandNames() const
Get list of user-defined cand names.
Definition: PATObject.h:347
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:207
std::vector< float > userFloats_
Definition: PATObject.h:430
float userFloat(const std::string &key) const
Definition: PATObject.h:753
virtual ~PATObject()
destructor
Definition: PATObject.h:57
#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:850
bool hasUserInt(const std::string &key) const
Return true if there is a user-defined int with a given name.
Definition: PATObject.h:337
double resolPt(const std::string &label="") const
Resolution on pt, possibly with a label to specify which resolution to use.
Definition: PATObject.h:383
const reco::CandidatePtrVector & overlaps(const std::string &label) const
Definition: PATObject.h:722
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true, const size_t idx=0) const
Definition: PATObject.h:563
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:583
std::vector< pat::LookupTableRecord > efficiencyValues_
vector of the efficiencies (values)
Definition: PATObject.h:411
double resolPy(const std::string &label="") const
Resolution on py, possibly with a label to specify which resolution to use.
Definition: PATObject.h:392
double resolEt(const std::string &label="") const
Resolution on et, possibly with a label to specify which resolution to use.
Definition: PATObject.h:377
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:389
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:763
void embedGenParticle()
Definition: PATObject.h:675
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:186
double p4[4]
Definition: TauolaWrapper.h:92
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:429
const TriggerObjectStandAlone * triggerObjectMatch(const size_t idx=0) const
get one matched trigger object by index
Definition: PATObject.h:485
void addUserInt(const std::string &label, int32_t data)
Set user-defined int.
Definition: PATObject.h:782
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:270
const TriggerObjectStandAlone * triggerObjectMatchByFilter(const char *labelFilter, const size_t idx=0) const
Definition: PATObject.h:158
#define end
Definition: vmac.h:38
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:594
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:371
const edm::Ptr< reco::Candidate > & originalObjectRef() const
reference to original object. Returns a null reference if not available
Definition: PATObject.h:482
const TriggerObjectStandAlone * triggerObjectMatchByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true, const size_t idx=0) const
Definition: PATObject.h:603
const TriggerObjectStandAloneCollection triggerObjectMatchesByCondition(const char *nameCondition) const
Definition: PATObject.h:108
bool hasUserData(const std::string &key) const
Check if user data with a specific type is present.
Definition: PATObject.h:276
double resolE(const std::string &label="") const
Resolution on energy, possibly with a label to specify which resolution to use.
Definition: PATObject.h:374
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const char *namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:168
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:554
ObjectType base_type
Definition: PATObject.h:46
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const bool algoCondAccepted=true) const
Definition: PATObject.h:122
double resolM(const LorentzVector &p4) const
std::vector< reco::CandidatePtrVector > overlapItems_
Overlapping items (sorted by distance)
Definition: PATObject.h:423
std::vector< std::string > kinResolutionLabels_
Definition: PATObject.h:442
void setOverlaps(const std::string &label, const reco::CandidatePtrVector &overlaps)
Definition: PATObject.h:730
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilterID(const unsigned triggerObjectType) const
Definition: PATObject.h:81
void addUserData(const std::string &label, const T &data, bool transientOnly=false)
Definition: PATObject.h:300
void addGenParticleRef(const reco::GenParticleRef &ref)
Definition: PATObject.h:659
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:427
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const std::string &coll) const
get all matched trigger objects from a certain collection
Definition: PATObject.h:512
double resolPx(const LorentzVector &p4) const
Resolution on px, given the 4-momentum of the associated Candidate.
JetCorrectorParametersCollection coll
Definition: classes.h:16
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:126
const pat::UserData * userDataObject_(const std::string &key) const
Definition: PATObject.h:743
virtual int charge() const GCC11_FINAL
electric charge
int32_t userInt(const std::string &key) const
Definition: PATObject.h:772
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:86
void addTriggerObjectMatch(const TriggerObjectStandAlone &trigObj)
add a trigger match
Definition: PATObject.h:198
const std::vector< std::string > & userDataNames() const
Get list of user data object names.
Definition: PATObject.h:286
const TriggerObjectStandAlone * triggerObjectMatchByAlgorithm(const std::string &nameAlgorithm, const unsigned algoCondAccepted, const size_t idx=0) const
Definition: PATObject.h:142
const TriggerObjectStandAloneCollection & triggerObjectMatches() const
get all matched trigger objects
Definition: PATObject.h:71
const void * userDataBare(const std::string &key) const
Definition: PATObject.h:290
reco::CandidatePtr userCand(const std::string &key) const
Definition: PATObject.h:790
const TriggerObjectStandAlone * triggerObjectMatchByCollection(const char *coll, const size_t idx=0) const
Definition: PATObject.h:102
const TriggerObjectStandAloneCollection triggerObjectMatchesByType(const unsigned triggerObjectType) const
Definition: PATObject.h:77
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:543
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:492
const TriggerObjectStandAloneCollection triggerObjectMatchesByCollection(const char *coll) const
Definition: PATObject.h:96
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:534
float userFloat(const char *key) const
a CINT-friendly interface
Definition: PATObject.h:316
void addUserCand(const std::string &label, const reco::CandidatePtr &data)
Set user-defined int.
Definition: PATObject.h:800
const pat::LookupTableRecord & efficiency(const std::string &name) const
Returns an efficiency given its name.
Definition: PATObject.h:615
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const unsigned pathLastFilterAccepted, const unsigned pathL3FilterAccepted=1) const
Definition: PATObject.h:172
const reco::Candidate * originalObject() const
access to the original object; returns zero for null Ref and throws for unavailable collection ...
Definition: PATObject.h:469
Templated PAT object container.
Definition: PATObject.h:43
const pat::CandKinResolution & getKinResolution(const std::string &label="") const
Definition: PATObject.h:809
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:501
double resolTheta(const std::string &label="") const
Resolution on theta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:368
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:421
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:321
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:433
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
const TriggerObjectStandAloneCollection triggerObjectMatchesByFilter(const char *labelFilter) const
Definition: PATObject.h:152
long double T
const std::vector< std::string > & userIntNames() const
Get list of user-defined int names.
Definition: PATObject.h:335
const TriggerObjectStandAloneCollection triggerObjectMatchesByAlgorithm(const char *nameAlgorithm, const unsigned algoCondAccepted) const
Definition: PATObject.h:130
edm::Ptr< reco::Candidate > refToOrig_
Definition: PATObject.h:405
tuple size
Write out results.
double resolM(const std::string &label="") const
Definition: PATObject.h:399
reco::GenParticleRef genParticleById(int pdgId, int status, uint8_t autoCharge=0) const
Definition: PATObject.h:694
const void * bareData() const
Definition: UserData.h:50
T get(const Candidate &c)
Definition: component.h:56
double resolEta(const std::string &label="") const
Resolution on eta, possibly with a label to specify which resolution to use.
Definition: PATObject.h:365
const std::string & userDataObjectType(const std::string &key) const
Get human-readable type of user data object, for debugging.
Definition: PATObject.h:280
const std::vector< std::string > & efficiencyNames() const
Returns the list of the names of the stored efficiencies.
Definition: PATObject.h:205
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:432
const std::vector< std::string > & overlapLabels() const
Returns the labels of the overlap tests that found at least one overlap.
Definition: PATObject.h:263