CMS 3D CMS Logo

Jet.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef DataFormats_PatCandidates_Jet_h
5 #define DataFormats_PatCandidates_Jet_h
6 
36 
42 
45 
49 
50 #include <numeric>
51 
52 
53 // Define typedefs for convenience
54 namespace pat {
55  class Jet;
56  typedef std::vector<Jet> JetCollection;
59 }
60 
61 namespace reco {
63  std::ostream& operator<<(std::ostream& out, const pat::Jet& obj);
64 }
65 
66 // Class definition
67 namespace pat {
68 
70 
74  typedef std::vector<edm::FwdPtr<reco::BaseTagInfo> > TagInfoFwdPtrCollection;
75  typedef std::vector<edm::FwdPtr<reco::PFCandidate> > PFCandidateFwdPtrCollection;
76  typedef std::vector<edm::FwdPtr<CaloTower> > CaloTowerFwdPtrCollection;
77  typedef std::vector<edm::Ptr<pat::Jet> > JetPtrCollection;
78 
79 
80  class Jet : public PATObject<reco::Jet> {
84  friend class PATJetProducer;
85  friend class PATJetSlimmer;
86  friend class PATJetUpdater;
87 
88  public:
89 
91  Jet();
93  Jet(const reco::Jet & aJet);
95  Jet(const edm::RefToBase<reco::Jet> & aJetRef);
97  Jet(const edm::Ptr<reco::Jet> & aJetRef);
99  Jet(const edm::RefToBase<pat::Jet> & aJetRef);
101  Jet(const edm::Ptr<pat::Jet> & aJetRef);
103  ~Jet() override;
105  Jet * clone() const override { return new Jet(*this); }
106 
108 
110  const reco::GenParticle * genParton() const { return genParticle(); }
112  const reco::GenJet * genJet() const;
114  int partonFlavour() const;
116  int hadronFlavour() const;
118  const reco::JetFlavourInfo & jetFlavourInfo() const;
119 
120  public:
122 
124  const std::vector<std::string> availableJECSets() const;
125  // returns the available JEC Levels for a given jecSet
126  const std::vector<std::string> availableJECLevels(const int& set=0) const;
127  // returns the available JEC Levels for a given jecSet
128  const std::vector<std::string> availableJECLevels(const std::string& set) const { return availableJECLevels(jecSet(set)); };
131  bool jecSetsAvailable() const { return !jec_.empty(); }
134  bool jecSetAvailable(const std::string& set) const {return (jecSet(set)>=0); };
137  bool jecSetAvailable(const unsigned int& set) const {return (set<jec_.size()); };
139  std::string currentJECSet() const { return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecSet() : std::string("ERROR"); }
141  std::string currentJECLevel() const { return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecLevel(currentJECLevel_) : std::string("ERROR"); };
143  JetCorrFactors::Flavor currentJECFlavor() const { return currentJECFlavor_; };
146  float jecFactor(const std::string& level, const std::string& flavor="none", const std::string& set="") const;
149  float jecFactor(const unsigned int& level, const JetCorrFactors::Flavor& flavor=JetCorrFactors::NONE, const unsigned int& set=0) const;
152  Jet correctedJet(const std::string& level, const std::string& flavor="none", const std::string& set="") const;
155  Jet correctedJet(const unsigned int& level, const JetCorrFactors::Flavor& flavor=JetCorrFactors::NONE, const unsigned int& set=0) const;
158  const LorentzVector correctedP4(const std::string& level, const std::string& flavor="none", const std::string& set="") const { return correctedJet(level, flavor, set).p4(); };
161  const LorentzVector correctedP4(const unsigned int& level, const JetCorrFactors::Flavor& flavor=JetCorrFactors::NONE, const unsigned int& set=0) const { return correctedJet(level, flavor, set).p4(); };
163  void scaleEnergy(double fScale) override { scaleEnergy(fScale, "Unscaled"); }
164  void scaleEnergy(double fScale, const std::string& level);
165 
166  private:
169  int jecSet(const std::string& label) const;
171  void currentJECSet(const unsigned int& set) { currentJECSet_=set; };
173  void currentJECLevel(const unsigned int& level) { currentJECLevel_=level; };
175  void currentJECFlavor(const JetCorrFactors::Flavor& flavor) { currentJECFlavor_=flavor; };
177  void addJECFactors(const JetCorrFactors& jec) {jec_.push_back(jec); };
179  void initializeJEC(unsigned int level, const JetCorrFactors::Flavor& flavor=JetCorrFactors::NONE, unsigned int set=0);
180 
181  public:
183 
185  float bDiscriminator(const std::string &theLabel) const;
187  const std::vector<std::pair<std::string, float> > & getPairDiscri() const;
189  std::vector<std::string> const & tagInfoLabels() const { return tagInfoLabels_; }
191  bool hasTagInfo( const std::string label) const { return tagInfo(label) != nullptr; }
194  const reco::BaseTagInfo * tagInfo(const std::string &label) const;
198  const reco::CandIPTagInfo * tagInfoCandIP(const std::string &label="") const;
199  const reco::TrackIPTagInfo * tagInfoTrackIP(const std::string &label="") const;
203  const reco::CandSoftLeptonTagInfo * tagInfoCandSoftLepton(const std::string &label="") const;
204  const reco::SoftLeptonTagInfo * tagInfoSoftLepton(const std::string &label="") const;
208  const reco::CandSecondaryVertexTagInfo * tagInfoCandSecondaryVertex(const std::string &label="") const;
209  const reco::SecondaryVertexTagInfo * tagInfoSecondaryVertex(const std::string &label="") const;
210  const reco::BoostedDoubleSVTagInfo * tagInfoBoostedDoubleSV(const std::string &label="") const;
212  void addBDiscriminatorPair(const std::pair<std::string, float> & thePair);
215  void addTagInfo(const std::string &label,
217 
218 
219  // ---- track related methods ----
220 
222  float jetCharge() const;
224  const reco::TrackRefVector & associatedTracks() const;
226  void setJetCharge(float jetCharge);
228  void setAssociatedTracks(const reco::TrackRefVector &tracks);
229 
230  // ---- methods for content embedding ----
231 
233  void setCaloTowers(const CaloTowerFwdPtrCollection & caloTowers);
235  void setPFCandidates(const PFCandidateFwdPtrCollection & pfCandidates);
237  void setGenParton(const reco::GenParticleRef & gp, bool embed=false) { setGenParticleRef(gp, embed); }
239  void setGenJetRef(const edm::FwdRef<reco::GenJetCollection> & gj);
241  void setPartonFlavour(int partonFl);
243  void setHadronFlavour(int hadronFl);
245  void setJetFlavourInfo(const reco::JetFlavourInfo & jetFlavourInfo);
246 
247 
249  void setJetID( reco::JetID const & id ) { jetID_ = id; }
250 
251  // ---- jet specific methods ----
252 
254  bool isCaloJet() const { return !specificCalo_.empty() && !isJPTJet(); }
256  bool isJPTJet() const { return !specificJPT_.empty(); }
258  bool isPFJet() const { return !specificPF_.empty(); }
260  bool isBasicJet() const { return !(isCaloJet() || isPFJet() || isJPTJet()); }
262  const CaloSpecific& caloSpecific() const {
263  if (specificCalo_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a CaloJet.\n";
264  return specificCalo_[0];
265  }
267  const JPTSpecific& jptSpecific() const {
268  if (specificJPT_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet.\n";
269  return specificJPT_[0];
270  }
272  bool hasPFSpecific() const { return !specificPF_.empty(); }
274  const PFSpecific& pfSpecific() const {
275  if (specificPF_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a PFJet.\n";
276  return specificPF_[0];
277  }
279  void setCaloSpecific(const CaloSpecific& newCaloSpecific) {
280  if (specificCalo_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a CaloJet.\n";
281  specificCalo_[0] = newCaloSpecific;
282  }
284  void setJPTSpecific(const JPTSpecific& newJPTSpecific) {
285  if (specificJPT_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet.\n";
286  specificJPT_[0] = newJPTSpecific;
287  }
289  void setPFSpecific(const PFSpecific& newPFSpecific) {
290  if (specificPF_.empty()) throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a PFJet.\n";
291  specificPF_[0] = newPFSpecific;
292  }
293 
294  // ---- Calo Jet specific information ----
295 
297  float maxEInEmTowers() const {return caloSpecific().mMaxEInEmTowers;}
299  float maxEInHadTowers() const {return caloSpecific().mMaxEInHadTowers;}
301  float energyFractionHadronic () const {return caloSpecific().mEnergyFractionHadronic;}
303  float emEnergyFraction() const {return caloSpecific().mEnergyFractionEm;}
305  float hadEnergyInHB() const {return caloSpecific().mHadEnergyInHB;}
307  float hadEnergyInHO() const {return caloSpecific().mHadEnergyInHO;}
309  float hadEnergyInHE() const {return caloSpecific().mHadEnergyInHE;}
311  float hadEnergyInHF() const {return caloSpecific().mHadEnergyInHF;}
313  float emEnergyInEB() const {return caloSpecific().mEmEnergyInEB;}
315  float emEnergyInEE() const {return caloSpecific().mEmEnergyInEE;}
317  float emEnergyInHF() const {return caloSpecific().mEmEnergyInHF;}
319  float towersArea() const {return caloSpecific().mTowersArea;}
321  int n90() const {return nCarrying (0.9);}
323  int n60() const {return nCarrying (0.6);}
324 
326  // static CaloTowerPtr caloTower (const reco::Candidate* fConstituent);
329  CaloTowerPtr getCaloConstituent (unsigned fIndex) const;
332  std::vector<CaloTowerPtr> const & getCaloConstituents () const;
333 
334  // ---- JPT Jet specific information ----
335 
337  const reco::TrackRefVector& pionsInVertexInCalo () const{return jptSpecific().pionsInVertexInCalo; }
339  const reco::TrackRefVector& pionsInVertexOutCalo() const{return jptSpecific().pionsInVertexOutCalo;}
341  const reco::TrackRefVector& pionsOutVertexInCalo() const{return jptSpecific().pionsOutVertexInCalo;}
343  const reco::TrackRefVector& muonsInVertexInCalo () const{return jptSpecific().muonsInVertexInCalo; }
345  const reco::TrackRefVector& muonsInVertexOutCalo() const{return jptSpecific().muonsInVertexOutCalo;}
347  const reco::TrackRefVector& muonsOutVertexInCalo() const{return jptSpecific().muonsOutVertexInCalo;}
349  const reco::TrackRefVector& elecsInVertexInCalo () const{return jptSpecific().elecsInVertexInCalo; }
351  const reco::TrackRefVector& elecsInVertexOutCalo() const{return jptSpecific().elecsInVertexOutCalo;}
353  const reco::TrackRefVector& elecsOutVertexInCalo() const{return jptSpecific().elecsOutVertexInCalo;}
355  const float& zspCorrection() const {return jptSpecific().mZSPCor;}
357  float elecMultiplicity () const {return jptSpecific().elecsInVertexInCalo.size()+jptSpecific().elecsInVertexOutCalo.size();}
358 
359  // ---- JPT or PF Jet specific information ----
360 
362  int muonMultiplicity() const;
364  int chargedMultiplicity() const;
366  float chargedEmEnergy() const;
368  float neutralEmEnergy() const;
370  float chargedHadronEnergy() const;
372  float neutralHadronEnergy() const;
373 
375  float chargedHadronEnergyFraction() const {return chargedHadronEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
377  float neutralHadronEnergyFraction() const {return neutralHadronEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
379  float chargedEmEnergyFraction() const {return chargedEmEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
381  float neutralEmEnergyFraction() const {return neutralEmEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
382 
383  // ---- PF Jet specific information ----
385  float photonEnergy () const {return pfSpecific().mPhotonEnergy;}
387  float photonEnergyFraction () const {return photonEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
389  float electronEnergy () const {return pfSpecific().mElectronEnergy;}
391  float electronEnergyFraction () const {return electronEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
393  float muonEnergy () const {return pfSpecific().mMuonEnergy;}
395  float muonEnergyFraction () const {return muonEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
397  float HFHadronEnergy () const {return pfSpecific().mHFHadronEnergy;}
399  float HFHadronEnergyFraction () const {return HFHadronEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
401  float HFEMEnergy () const {return pfSpecific().mHFEMEnergy;}
403  float HFEMEnergyFraction () const {return HFEMEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
404 
406  int chargedHadronMultiplicity () const {return pfSpecific().mChargedHadronMultiplicity;}
408  int neutralHadronMultiplicity () const {return pfSpecific().mNeutralHadronMultiplicity;}
410  int photonMultiplicity () const {return pfSpecific().mPhotonMultiplicity;}
412  int electronMultiplicity () const {return pfSpecific().mElectronMultiplicity;}
413 
415  int HFHadronMultiplicity () const {return pfSpecific().mHFHadronMultiplicity;}
417  int HFEMMultiplicity () const {return pfSpecific().mHFEMMultiplicity;}
418 
420  float chargedMuEnergy () const {return pfSpecific().mChargedMuEnergy;}
422  float chargedMuEnergyFraction () const {return chargedMuEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
423 
425  int neutralMultiplicity () const {return pfSpecific().mNeutralMultiplicity;}
426 
428  float hoEnergy () const {return pfSpecific().mHOEnergy;}
430  float hoEnergyFraction () const {return hoEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
432 
433  // static CaloTowerPtr caloTower (const reco::Candidate* fConstituent);
436  reco::PFCandidatePtr getPFConstituent (unsigned fIndex) const;
439  std::vector<reco::PFCandidatePtr> const & getPFConstituents () const;
440 
445  const reco::Candidate * daughter(size_t i) const override;
446 
447  reco::CandidatePtr daughterPtr( size_t i ) const override;
448  const reco::CompositePtrCandidate::daughters & daughterPtrVector() const override;
449 
450  using reco::LeafCandidate::daughter; // avoid hiding the base implementation
451 
456  size_t numberOfDaughters() const override;
457 
459  void clearDaughters() override {
461  daughtersTemp_.reset(); // need to reset daughtersTemp_ as well
462  }
463 
465  reco::JetID const & jetID () const { return jetID_;}
466 
467 
469  CaloTowerFwdPtrVector const & caloTowersFwdPtr() const { return caloTowersFwdPtr_;}
470  reco::PFCandidateFwdPtrVector const & pfCandidatesFwdPtr() const { return pfCandidatesFwdPtr_; }
471  edm::FwdRef<reco::GenJetCollection> const & genJetFwdRef() const { return genJetFwdRef_; }
472  TagInfoFwdPtrCollection const & tagInfosFwdPtr() const { return tagInfosFwdPtr_; }
473 
476  void updateFwdCaloTowerFwdPtr( unsigned int index, const edm::Ptr<CaloTower>& updateFwd ) {
477  if ( index < caloTowersFwdPtr_.size() ) {
478  caloTowersFwdPtr_[index] = CaloTowerFwdPtrVector::value_type( updateFwd, caloTowersFwdPtr_[index].backPtr() );
479  } else {
480  throw cms::Exception("OutOfRange") << "Index " << index << " is out of range" << std::endl;
481  }
482  }
483 
484  void updateFwdPFCandidateFwdPtr( unsigned int index, const edm::Ptr<reco::PFCandidate>& updateFwd ) {
485  if ( index < pfCandidatesFwdPtr_.size() ) {
486  pfCandidatesFwdPtr_[index] = reco::PFCandidateFwdPtrVector::value_type( updateFwd, pfCandidatesFwdPtr_[index].backPtr() );
487  } else {
488  throw cms::Exception("OutOfRange") << "Index " << index << " is out of range" << std::endl;
489  }
490  }
491 
492 
493  void updateFwdTagInfoFwdPtr( unsigned int index, const edm::Ptr<reco::BaseTagInfo>& updateFwd ) {
494  if ( index < tagInfosFwdPtr_.size() ) {
495  tagInfosFwdPtr_[index] = TagInfoFwdPtrCollection::value_type( updateFwd, tagInfosFwdPtr_[index].backPtr() );
496  } else {
497  throw cms::Exception("OutOfRange") << "Index " << index << " is out of range" << std::endl;
498  }
499  }
500 
502  genJetFwdRef_ = edm::FwdRef<reco::GenJetCollection>( updateRef, genJetFwdRef_.backRef() );
503  }
504 
506  friend std::ostream& reco::operator<<(std::ostream& out, const pat::Jet& obj);
507 
508 
509 
511  pat::JetPtrCollection const & subjets( unsigned int index = 0 ) const;
512 
513 
515  pat::JetPtrCollection const & subjets( std::string const & label ) const ;
516 
518  void addSubjets( pat::JetPtrCollection const & pieces, std::string const & label = "" );
519 
521  bool hasSubjets( std::string const & label ) const { return find( subjetLabels_.begin(), subjetLabels_.end(), label) != subjetLabels_.end(); }
522 
524  unsigned int nSubjetCollections( ) const { return subjetCollections_.size(); }
525 
527  std::vector<std::string> const & subjetCollectionNames() const { return subjetLabels_; }
528 
530  double groomedMass(unsigned int index = 0) const{
531  auto const& sub = subjets(index);
532  return nSubjetCollections() > index && !sub.empty() ?
533  std::accumulate( sub.begin(), sub.end(),
535  [] (reco::Candidate::LorentzVector const & a, reco::CandidatePtr const & b){return a + b->p4();}).mass() :
536  -1.0;
537  }
538  double groomedMass(std::string const & label) const{
539  auto const& sub = subjets(label);
540  return hasSubjets(label) && !sub.empty() ?
541  std::accumulate( sub.begin(), sub.end(),
543  [] (reco::Candidate::LorentzVector const & a, reco::CandidatePtr const & b){return a + b->p4();}).mass() :
544  -1.0;
545  }
546 
547  protected:
548 
549  // ---- for content embedding ----
550 
553  CaloTowerCollection caloTowers_; // Compatibility embedding
554  CaloTowerFwdPtrVector caloTowersFwdPtr_; // Refactorized content embedding
555 
556 
559  reco::PFCandidateCollection pfCandidates_; // Compatibility embedding
560  reco::PFCandidateFwdPtrVector pfCandidatesFwdPtr_; // Refactorized content embedding
561 
562 
563  // ---- Jet Substructure ----
564  std::vector< pat::JetPtrCollection> subjetCollections_;
565  std::vector< std::string> subjetLabels_;
567 
568  // ---- MC info ----
569 
570  std::vector<reco::GenJet> genJet_;
574 
575  // ---- energy scale correction factors ----
576 
577  // energy scale correction factors; the string carries a potential label if
578  // more then one set of correction factors is embedded. The label corresponds
579  // to the label of the jetCorrFactors module that has been embedded.
580  std::vector<pat::JetCorrFactors> jec_;
581  // currently applied set of jet energy correction factors (i.e. the index in
582  // jetEnergyCorrections_)
583  unsigned int currentJECSet_;
584  // currently applied jet energy correction level
585  unsigned int currentJECLevel_;
586  // currently applied jet energy correction flavor (can be NONE, GLUON, UDS,
587  // CHARM or BOTTOM)
589 
590  // ---- b-tag related members ----
591 
592  std::vector<std::pair<std::string, float> > pairDiscriVector_;
593  std::vector<std::string> tagInfoLabels_;
594  edm::OwnVector<reco::BaseTagInfo> tagInfos_; // Compatibility embedding
595  TagInfoFwdPtrCollection tagInfosFwdPtr_; // Refactorized embedding
596 
597 
598  // ---- track related members ----
599 
600  float jetCharge_;
602 
603  // ---- specific members ----
604 
605  std::vector<CaloSpecific> specificCalo_;
606  std::vector<JPTSpecific> specificJPT_;
607  std::vector<PFSpecific> specificPF_;
608 
609  // ---- id functions ----
611 
612 
613  private:
614 
615  // ---- helper functions ----
616 
617  void tryImportSpecific(const reco::Jet &source);
618 
619  template<typename T> const T * tagInfoByType() const
620  {
621  // First check the factorized PAT version
622  for (size_t i = 0, n = tagInfosFwdPtr_.size(); i < n; ++i) {
623  TagInfoFwdPtrCollection::value_type const & val = tagInfosFwdPtr_[i];
624  reco::BaseTagInfo const * baseTagInfo = val.get();
625  if ( typeid(*baseTagInfo) == typeid(T) ) {
626  return static_cast<const T *>( baseTagInfo );
627  }
628  }
629  // Then check compatibility version
630  for (size_t i = 0, n = tagInfos_.size(); i < n; ++i) {
632  reco::BaseTagInfo const * baseTagInfo = &val;
633  if ( typeid(*baseTagInfo) == typeid(T) ) {
634  return static_cast<const T *>( baseTagInfo );
635  }
636  }
637  return nullptr;
638  }
639 
640  template<typename T> const T * tagInfoByTypeOrLabel(const std::string &label="") const
641  {
642  return ( label.empty() ? tagInfoByType<T>() : dynamic_cast<const T *>(tagInfo(label)) );
643  }
644 
646  const JetCorrFactors * corrFactors_(const std::string& set) const ;
648  const JetCorrFactors * corrFactors_() const;
649 
651  void cacheCaloTowers() const;
652  void cachePFCandidates() const;
653  void cacheDaughters() const;
654 
655  };
656 }
657 
658 inline float pat::Jet::chargedHadronEnergy() const
659 {
660  if(isPFJet()){ return pfSpecific().mChargedHadronEnergy; }
661  else if( isJPTJet() ){ return jptSpecific().mChargedHadronEnergy; }
662  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
663 }
664 
665 inline float pat::Jet::neutralHadronEnergy() const
666 {
667  if(isPFJet()){ return pfSpecific().mNeutralHadronEnergy; }
668  else if( isJPTJet() ){ return jptSpecific().mNeutralHadronEnergy; }
669  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
670 }
671 
672 inline float pat::Jet::chargedEmEnergy() const
673 {
674  if(isPFJet()){ return pfSpecific().mChargedEmEnergy; }
675  else if( isJPTJet() ){ return jptSpecific().mChargedEmEnergy;}
676  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
677 }
678 
679 inline float pat::Jet::neutralEmEnergy() const
680 {
681  if(isPFJet()){ return pfSpecific().mNeutralEmEnergy; }
682  else if( isJPTJet() ){ return jptSpecific().mNeutralEmEnergy;}
683  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
684 }
685 
686 inline int pat::Jet::muonMultiplicity() const
687 {
688  if(isPFJet()){ return pfSpecific().mMuonMultiplicity; }
689  else if( isJPTJet() ){ return jptSpecific().muonsInVertexInCalo.size()+jptSpecific().muonsInVertexOutCalo.size();}
690  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
691 }
692 
694 {
695  if(isPFJet()){ return pfSpecific().mChargedMultiplicity; }
696  else if( isJPTJet() ){ return jptSpecific().muonsInVertexInCalo.size()+jptSpecific().muonsInVertexOutCalo.size()+
697  jptSpecific().pionsInVertexInCalo.size()+jptSpecific().pionsInVertexOutCalo.size()+
698  jptSpecific().elecsInVertexInCalo.size()+jptSpecific().elecsInVertexOutCalo.size();}
699  else{ throw cms::Exception("Type Mismatch") << "This PAT jet was not made from a JPTJet nor from PFJet.\n"; }
700 }
701 
702 #endif
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Definition: Jet.h:158
void setJetID(reco::JetID const &id)
methods for jet ID
Definition: Jet.h:249
float photonEnergy() const
photonEnergy
Definition: Jet.h:385
float towersArea() const
returns area of contributing towers
Definition: Jet.h:319
float elecMultiplicity() const
chargedMultiplicity
Definition: Jet.h:357
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
Definition: Jet.h:237
reco::GenJetRefVector genJetRef_
Definition: Jet.h:571
const reco::TrackRefVector & elecsOutVertexInCalo() const
electrons that curled in
Definition: Jet.h:353
float emEnergyInEE() const
returns the jet electromagnetic energy in EE
Definition: Jet.h:315
CaloTowerFwdPtrVector caloTowersFwdPtr_
Definition: Jet.h:554
int HFEMMultiplicity() const
HFEMMultiplicity.
Definition: Jet.h:417
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:377
static const TGPicture * info(bool iBackgroundIsBlack)
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
Definition: Jet.h:177
float muonEnergy() const
muonEnergy
Definition: Jet.h:393
bool jecSetsAvailable() const
Definition: Jet.h:131
void currentJECFlavor(const JetCorrFactors::Flavor &flavor)
update the current JEC flavor; used by correctedJet
Definition: Jet.h:175
const JPTSpecific & jptSpecific() const
retrieve the jpt specific part of the jet
Definition: Jet.h:267
const reco::TrackRefVector & pionsInVertexOutCalo() const
pions that curled out
Definition: Jet.h:339
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:658
float photonEnergyFraction() const
photonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:387
int electronMultiplicity() const
electronMultiplicity
Definition: Jet.h:412
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:679
const reco::TrackRefVector & elecsInVertexInCalo() const
electrons fully contained in cone
Definition: Jet.h:349
reco::TrackRefVector associatedTracks_
Definition: Jet.h:601
std::vector< Jet > JetCollection
Definition: Jet.h:55
reco::PFCandidateCollection pfCandidates_
Definition: Jet.h:559
int n90() const
returns the number of constituents carrying a 90% of the total Jet energy*/
Definition: Jet.h:321
std::vector< std::pair< std::string, float > > pairDiscriVector_
Definition: Jet.h:592
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:375
int photonMultiplicity() const
photonMultiplicity
Definition: Jet.h:410
const reco::TrackRefVector & muonsInVertexOutCalo() const
muons that curled out
Definition: Jet.h:345
const PFSpecific & pfSpecific() const
retrieve the pf specific part of the jet
Definition: Jet.h:274
const reco::TrackRefVector & muonsOutVertexInCalo() const
muons that curled in
Definition: Jet.h:347
double groomedMass(std::string const &label) const
Definition: Jet.h:538
Base class for all types of Jets.
Definition: Jet.h:20
float HFEMEnergyFraction() const
HFEMEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:403
const float & zspCorrection() const
zero suppression correction
Definition: Jet.h:355
TagInfoFwdPtrCollection tagInfosFwdPtr_
Definition: Jet.h:595
edm::FwdRef< reco::GenJetCollection > genJetFwdRef_
Definition: Jet.h:572
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:665
size_type size() const
Definition: OwnVector.h:264
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:379
int muonMultiplicity() const
muonMultiplicity
Definition: Jet.h:686
edm::Ref< JetCollection > JetRef
Definition: Jet.h:57
const std::vector< std::string > availableJECLevels(const std::string &set) const
Definition: Jet.h:128
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:425
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: Jet.h:406
void setJPTSpecific(const JPTSpecific &newJPTSpecific)
set the jpt specific part of the jet
Definition: Jet.h:284
void scaleEnergy(double fScale) override
Scale energy and correspondingly adjust raw jec factors.
Definition: Jet.h:163
Jet ID object.
Definition: JetID.h:16
edm::AtomicPtrCache< std::vector< CaloTowerPtr > > caloTowersTemp_
Definition: Jet.h:552
float maxEInHadTowers() const
returns the maximum energy deposited in HCAL towers
Definition: Jet.h:299
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const reco::GenParticle * genParton() const
-— methods for MC matching -—
Definition: Jet.h:110
const reco::TrackRefVector & muonsInVertexInCalo() const
muons fully contained in cone
Definition: Jet.h:343
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:672
#define embed
Definition: AMPTWrapper.h:178
edm::RefVector< JetCollection > JetRefVector
Definition: Jet.h:58
Definition: HeavyIon.h:7
std::vector< PFSpecific > specificPF_
Definition: Jet.h:607
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
Definition: Jet.h:254
bool hasTagInfo(const std::string label) const
check to see if the given tag info is nonzero
Definition: Jet.h:191
edm::OwnVector< reco::BaseTagInfo > tagInfos_
Definition: Jet.h:594
char const * label
float hadEnergyInHE() const
returns the jet hadronic energy in HE
Definition: Jet.h:309
void updateFwdCaloTowerFwdPtr(unsigned int index, const edm::Ptr< CaloTower > &updateFwd)
Definition: Jet.h:476
reco::PFCandidateFwdPtrVector const & pfCandidatesFwdPtr() const
Definition: Jet.h:470
reco::JetFlavourInfo jetFlavourInfo_
Definition: Jet.h:573
unsigned int nSubjetCollections() const
Number of subjet collections.
Definition: Jet.h:524
std::ostream & operator<<(std::ostream &, BeamSpot beam)
Definition: BeamSpot.cc:71
std::vector< CaloSpecific > specificCalo_
Definition: Jet.h:605
float HFHadronEnergyFraction() const
HFHadronEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:399
CaloTowerFwdPtrVector const & caloTowersFwdPtr() const
Access to bare FwdPtr collections.
Definition: Jet.h:469
const reco::TrackRefVector & pionsInVertexInCalo() const
pions fully contained in cone
Definition: Jet.h:337
float HFHadronEnergy() const
HFHadronEnergy.
Definition: Jet.h:397
Definition: Jet.py:1
Produces pat::Jet&#39;s.
Definition: PATJetUpdater.h:34
void clearDaughters() override
clear daughter references
Definition: Jet.h:459
float hoEnergyFraction() const
hoEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:430
bool hasSubjets(std::string const &label) const
Check to see if the subjet collection exists.
Definition: Jet.h:521
std::vector< CaloTowerFwdPtr > CaloTowerFwdPtrVector
Definition: CaloTowerDefs.h:23
Class for the storage of jet correction factors.
unsigned int currentJECLevel_
Definition: Jet.h:585
std::vector< edm::Ptr< pat::Jet > > JetPtrCollection
Definition: Jet.h:77
float chargedMuEnergy() const
chargedMuEnergy
Definition: Jet.h:420
std::ostream & operator<<(std::ostream &out, const strbitset::index_type &r)
Definition: strbitset.cc:27
Class storing the jet flavour information.
float electronEnergy() const
electronEnergy
Definition: Jet.h:389
float energyFractionHadronic() const
returns the jet hadronic energy fraction
Definition: Jet.h:301
float HFEMEnergy() const
HFEMEnergy.
Definition: Jet.h:401
bool jecSetAvailable(const unsigned int &set) const
Definition: Jet.h:137
Jet * clone() const override
required reimplementation of the Candidate&#39;s clone method
Definition: Jet.h:105
bool embeddedCaloTowers_
Definition: Jet.h:551
float emEnergyInEB() const
returns the jet electromagnetic energy in EB
Definition: Jet.h:313
Jets made from MC generator particles.
Definition: GenJet.h:25
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
Produces pat::Jet&#39;s.
std::vector< std::string > const & subjetCollectionNames() const
Subjet collection names.
Definition: Jet.h:527
float hadEnergyInHO() const
returns the jet hadronic energy in HO
Definition: Jet.h:307
std::vector< pat::JetPtrCollection > subjetCollections_
Definition: Jet.h:564
std::vector< std::string > const & tagInfoLabels() const
get list of tag info labels
Definition: Jet.h:189
std::vector< edm::FwdPtr< reco::BaseTagInfo > > TagInfoFwdPtrCollection
Definition: Jet.h:74
bool hasPFSpecific() const
check to see if the PFSpecific object is stored
Definition: Jet.h:272
void updateFwdPFCandidateFwdPtr(unsigned int index, const edm::Ptr< reco::PFCandidate > &updateFwd)
Definition: Jet.h:484
bool isPFJet() const
check to see if the jet is a reco::PFJet
Definition: Jet.h:258
JetCorrFactors::Flavor currentJECFlavor() const
return flavour of the current step of jet energy corrections
Definition: Jet.h:143
const T * tagInfoByTypeOrLabel(const std::string &label="") const
Definition: Jet.h:640
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
Definition: Jet.h:303
std::vector< pat::JetCorrFactors > jec_
Definition: Jet.h:580
std::vector< std::string > tagInfoLabels_
Definition: Jet.h:593
float jetCharge_
Definition: Jet.h:600
void setPFSpecific(const PFSpecific &newPFSpecific)
set the pf specific part of the jet
Definition: Jet.h:289
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
Definition: Jet.h:256
const reco::TrackRefVector & elecsInVertexOutCalo() const
electrons that curled out
Definition: Jet.h:351
std::vector< CandidatePtr > daughters
collection of references to daughters
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
unsigned int index
index type
Definition: Candidate.h:51
const Candidate * daughter(size_type) const override
return daughter at a given position (throws an exception)
reco::JetID const & jetID() const
accessing Jet ID information
Definition: Jet.h:465
const LorentzVector correctedP4(const unsigned int &level, const JetCorrFactors::Flavor &flavor=JetCorrFactors::NONE, const unsigned int &set=0) const
Definition: Jet.h:161
int n60() const
returns the number of constituents carrying a 60% of the total Jet energy*/
Definition: Jet.h:323
float electronEnergyFraction() const
electronEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:391
std::vector< PFCandidateFwdPtr > PFCandidateFwdPtrVector
vector of "forward" reference
float chargedMuEnergyFraction() const
chargedMuEnergyFraction
Definition: Jet.h:422
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
Definition: Jet.h:76
std::vector< JPTSpecific > specificJPT_
Definition: Jet.h:606
hadronFlavour
Definition: jets_cff.py:601
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
Definition: Jet.h:75
float maxEInEmTowers() const
returns the maximum energy deposited in ECAL towers
Definition: Jet.h:297
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
Definition: Jet.h:141
std::vector< std::string > subjetLabels_
Definition: Jet.h:565
reco::PFJet::Specific PFSpecific
Definition: Jet.h:73
float emEnergyInHF() const
returns the jet electromagnetic energy extracted from HF
Definition: Jet.h:317
double b
Definition: hdecay.h:120
Analysis-level calorimeter jet class.
Definition: Jet.h:80
float hadEnergyInHF() const
returns the jet hadronic energy in HF
Definition: Jet.h:311
reco::JPTJet::Specific JPTSpecific
Definition: Jet.h:72
edm::AtomicPtrCache< std::vector< reco::CandidatePtr > > daughtersTemp_
Definition: Jet.h:566
CaloTowerCollection caloTowers_
Definition: Jet.h:553
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
float hoEnergy() const
hoEnergy
Definition: Jet.h:428
reco::CaloJet::Specific CaloSpecific
Definition: Jet.h:69
void updateFwdGenJetFwdRef(edm::Ref< reco::GenJetCollection > updateRef)
Definition: Jet.h:501
edm::FwdRef< reco::GenJetCollection > const & genJetFwdRef() const
Definition: Jet.h:471
fixed size matrix
reco::PFCandidateFwdPtrVector pfCandidatesFwdPtr_
Definition: Jet.h:560
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: Jet.h:408
partonFlavour
Definition: jets_cff.py:600
double a
Definition: hdecay.h:121
void updateFwdTagInfoFwdPtr(unsigned int index, const edm::Ptr< reco::BaseTagInfo > &updateFwd)
Definition: Jet.h:493
double groomedMass(unsigned int index=0) const
Access to mass of subjets.
Definition: Jet.h:530
int HFHadronMultiplicity() const
HFHadronMultiplicity.
Definition: Jet.h:415
bool isBasicJet() const
check to see if the jet is no more than a reco::BasicJet
Definition: Jet.h:260
void currentJECLevel(const unsigned int &level)
update the current JEC level; used by correctedJet
Definition: Jet.h:173
Templated PAT object container.
Definition: PATObject.h:49
const reco::TrackRefVector & pionsOutVertexInCalo() const
pions that curled in
Definition: Jet.h:341
const CaloSpecific & caloSpecific() const
retrieve the calo specific part of the jet
Definition: Jet.h:262
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
Definition: Jet.h:395
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
Definition: Jet.h:381
TagInfoFwdPtrCollection const & tagInfosFwdPtr() const
Definition: Jet.h:472
unsigned int currentJECSet_
Definition: Jet.h:583
const T * tagInfoByType() const
Definition: Jet.h:619
std::vector< reco::GenJet > genJet_
Definition: Jet.h:570
float hadEnergyInHB() const
returns the jet hadronic energy in HB
Definition: Jet.h:305
edm::AtomicPtrCache< std::vector< reco::PFCandidatePtr > > pfCandidatesTemp_
Definition: Jet.h:558
reco::JetID jetID_
Definition: Jet.h:610
long double T
JetCorrFactors::Flavor currentJECFlavor_
Definition: Jet.h:588
bool embeddedPFCandidates_
Definition: Jet.h:557
static std::string const source
Definition: EdmProvDump.cc:47
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:693
std::string currentJECSet() const
returns the label of the current set of jet energy corrections
Definition: Jet.h:139
Matcher of reconstructed objects to L1 Muons.
void currentJECSet(const unsigned int &set)
update the current JEC set; used by correctedJet
Definition: Jet.h:171
void setCaloSpecific(const CaloSpecific &newCaloSpecific)
set the calo specific part of the jet
Definition: Jet.h:279
bool jecSetAvailable(const std::string &set) const
Definition: Jet.h:134