4 #ifndef DataFormats_PatCandidates_Jet_h 5 #define DataFormats_PatCandidates_Jet_h 124 const std::vector<std::string> availableJECSets()
const;
126 const std::vector<std::string> availableJECLevels(
const int&
set=0)
const;
164 void scaleEnergy(
double fScale,
const std::string& level);
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_; }
212 void addBDiscriminatorPair(
const std::pair<std::string, float> & thePair);
222 float jetCharge()
const;
226 void setJetCharge(
float jetCharge);
233 void setCaloTowers(
const CaloTowerFwdPtrCollection &
caloTowers);
235 void setPFCandidates(
const PFCandidateFwdPtrCollection &
pfCandidates);
241 void setPartonFlavour(
int partonFl);
243 void setHadronFlavour(
int hadronFl);
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()); }
263 if (specificCalo_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a CaloJet.\n";
264 return specificCalo_[0];
268 if (specificJPT_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a JPTJet.\n";
269 return specificJPT_[0];
275 if (specificPF_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a PFJet.\n";
276 return specificPF_[0];
280 if (specificCalo_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a CaloJet.\n";
281 specificCalo_[0] = newCaloSpecific;
285 if (specificJPT_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a JPTJet.\n";
286 specificJPT_[0] = newJPTSpecific;
290 if (specificPF_.empty())
throw cms::Exception(
"Type Mismatch") <<
"This PAT jet was not made from a PFJet.\n";
291 specificPF_[0] = newPFSpecific;
319 float towersArea()
const {
return caloSpecific().mTowersArea;}
321 int n90()
const {
return nCarrying (0.9);}
323 int n60()
const {
return nCarrying (0.6);}
329 CaloTowerPtr getCaloConstituent (
unsigned fIndex)
const;
332 std::vector<CaloTowerPtr>
const & getCaloConstituents ()
const;
357 float elecMultiplicity ()
const {
return jptSpecific().elecsInVertexInCalo.size()+jptSpecific().elecsInVertexOutCalo.size();}
364 int chargedMultiplicity()
const;
366 float chargedEmEnergy()
const;
368 float neutralEmEnergy()
const;
370 float chargedHadronEnergy()
const;
372 float neutralHadronEnergy()
const;
387 float photonEnergyFraction ()
const {
return photonEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
395 float muonEnergyFraction ()
const {
return muonEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
403 float HFEMEnergyFraction ()
const {
return HFEMEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
428 float hoEnergy ()
const {
return pfSpecific().mHOEnergy;}
430 float hoEnergyFraction ()
const {
return hoEnergy()/((jecSetsAvailable() ? jecFactor(0) : 1.)*energy());}
439 std::vector<reco::PFCandidatePtr>
const & getPFConstituents ()
const;
456 size_t numberOfDaughters()
const override;
461 daughtersTemp_.reset();
472 TagInfoFwdPtrCollection
const &
tagInfosFwdPtr()
const {
return tagInfosFwdPtr_; }
477 if ( index < caloTowersFwdPtr_.size() ) {
480 throw cms::Exception(
"OutOfRange") <<
"Index " << index <<
" is out of range" << std::endl;
485 if ( index < pfCandidatesFwdPtr_.size() ) {
488 throw cms::Exception(
"OutOfRange") <<
"Index " << index <<
" is out of range" << std::endl;
494 if ( index < tagInfosFwdPtr_.size() ) {
497 throw cms::Exception(
"OutOfRange") <<
"Index " << index <<
" is out of range" << std::endl;
531 auto const& sub = subjets(
index);
532 return nSubjetCollections() >
index && !sub.empty() ?
533 std::accumulate( sub.begin(), sub.end(),
539 auto const& sub = subjets(label);
540 return hasSubjets(label) && !sub.empty() ?
541 std::accumulate( sub.begin(), sub.end(),
580 std::vector<pat::JetCorrFactors>
jec_;
622 for (
size_t i = 0,
n = tagInfosFwdPtr_.size(); i <
n; ++
i) {
625 if (
typeid(*baseTagInfo) ==
typeid(
T) ) {
626 return static_cast<const T *
>( baseTagInfo );
630 for (
size_t i = 0, n = tagInfos_.
size(); i <
n; ++
i) {
633 if (
typeid(*baseTagInfo) ==
typeid(
T) ) {
634 return static_cast<const T *
>( baseTagInfo );
642 return ( label.empty() ? tagInfoByType<T>() : dynamic_cast<const T *>(tagInfo(label)) );
651 void cacheCaloTowers()
const;
652 void cachePFCandidates()
const;
653 void cacheDaughters()
const;
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"; }
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"; }
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"; }
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"; }
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"; }
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"; }
const LorentzVector correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
void setJetID(reco::JetID const &id)
methods for jet ID
float photonEnergy() const
photonEnergy
float towersArea() const
returns area of contributing towers
float elecMultiplicity() const
chargedMultiplicity
void setGenParton(const reco::GenParticleRef &gp, bool embed=false)
method to set the matched parton
reco::GenJetRefVector genJetRef_
const reco::TrackRefVector & elecsOutVertexInCalo() const
electrons that curled in
float emEnergyInEE() const
returns the jet electromagnetic energy in EE
CaloTowerFwdPtrVector caloTowersFwdPtr_
int HFEMMultiplicity() const
HFEMMultiplicity.
float neutralHadronEnergyFraction() const
neutralHadronEnergyFraction (relative to uncorrected jet energy)
void addJECFactors(const JetCorrFactors &jec)
add more sets of energy correction factors
float muonEnergy() const
muonEnergy
bool jecSetsAvailable() const
void currentJECFlavor(const JetCorrFactors::Flavor &flavor)
update the current JEC flavor; used by correctedJet
const JPTSpecific & jptSpecific() const
retrieve the jpt specific part of the jet
const reco::TrackRefVector & pionsInVertexOutCalo() const
pions that curled out
float chargedHadronEnergy() const
chargedHadronEnergy
float photonEnergyFraction() const
photonEnergyFraction (relative to corrected jet energy)
int electronMultiplicity() const
electronMultiplicity
float neutralEmEnergy() const
neutralEmEnergy
const reco::TrackRefVector & elecsInVertexInCalo() const
electrons fully contained in cone
reco::TrackRefVector associatedTracks_
std::vector< Jet > JetCollection
reco::PFCandidateCollection pfCandidates_
int n90() const
returns the number of constituents carrying a 90% of the total Jet energy*/
std::vector< std::pair< std::string, float > > pairDiscriVector_
float chargedHadronEnergyFraction() const
chargedHadronEnergyFraction (relative to uncorrected jet energy)
int photonMultiplicity() const
photonMultiplicity
const reco::TrackRefVector & muonsInVertexOutCalo() const
muons that curled out
const PFSpecific & pfSpecific() const
retrieve the pf specific part of the jet
const reco::TrackRefVector & muonsOutVertexInCalo() const
muons that curled in
double groomedMass(std::string const &label) const
Base class for all types of Jets.
float HFEMEnergyFraction() const
HFEMEnergyFraction (relative to corrected jet energy)
const float & zspCorrection() const
zero suppression correction
TagInfoFwdPtrCollection tagInfosFwdPtr_
edm::FwdRef< reco::GenJetCollection > genJetFwdRef_
float neutralHadronEnergy() const
neutralHadronEnergy
float chargedEmEnergyFraction() const
chargedEmEnergyFraction (relative to uncorrected jet energy)
int muonMultiplicity() const
muonMultiplicity
edm::Ref< JetCollection > JetRef
const std::vector< std::string > availableJECLevels(const std::string &set) const
int neutralMultiplicity() const
neutralMultiplicity
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
void setJPTSpecific(const JPTSpecific &newJPTSpecific)
set the jpt specific part of the jet
void scaleEnergy(double fScale) override
Scale energy and correspondingly adjust raw jec factors.
edm::AtomicPtrCache< std::vector< CaloTowerPtr > > caloTowersTemp_
float maxEInHadTowers() const
returns the maximum energy deposited in HCAL towers
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const reco::GenParticle * genParton() const
-— methods for MC matching -—
const reco::TrackRefVector & muonsInVertexInCalo() const
muons fully contained in cone
float chargedEmEnergy() const
chargedEmEnergy
edm::RefVector< JetCollection > JetRefVector
std::vector< PFSpecific > specificPF_
bool isCaloJet() const
check to see if the jet is a reco::CaloJet
bool hasTagInfo(const std::string label) const
check to see if the given tag info is nonzero
edm::OwnVector< reco::BaseTagInfo > tagInfos_
float hadEnergyInHE() const
returns the jet hadronic energy in HE
void updateFwdCaloTowerFwdPtr(unsigned int index, const edm::Ptr< CaloTower > &updateFwd)
reco::PFCandidateFwdPtrVector const & pfCandidatesFwdPtr() const
reco::JetFlavourInfo jetFlavourInfo_
unsigned int nSubjetCollections() const
Number of subjet collections.
Container::value_type value_type
std::ostream & operator<<(std::ostream &, BeamSpot beam)
std::vector< CaloSpecific > specificCalo_
float HFHadronEnergyFraction() const
HFHadronEnergyFraction (relative to corrected jet energy)
CaloTowerFwdPtrVector const & caloTowersFwdPtr() const
Access to bare FwdPtr collections.
const reco::TrackRefVector & pionsInVertexInCalo() const
pions fully contained in cone
float HFHadronEnergy() const
HFHadronEnergy.
void clearDaughters() override
clear daughter references
float hoEnergyFraction() const
hoEnergyFraction (relative to corrected jet energy)
bool hasSubjets(std::string const &label) const
Check to see if the subjet collection exists.
std::vector< CaloTowerFwdPtr > CaloTowerFwdPtrVector
Class for the storage of jet correction factors.
unsigned int currentJECLevel_
std::vector< edm::Ptr< pat::Jet > > JetPtrCollection
float chargedMuEnergy() const
chargedMuEnergy
std::ostream & operator<<(std::ostream &out, const strbitset::index_type &r)
Class storing the jet flavour information.
float electronEnergy() const
electronEnergy
float energyFractionHadronic() const
returns the jet hadronic energy fraction
float HFEMEnergy() const
HFEMEnergy.
bool jecSetAvailable(const unsigned int &set) const
Jet * clone() const override
required reimplementation of the Candidate's clone method
float emEnergyInEB() const
returns the jet electromagnetic energy in EB
Jets made from MC generator particles.
const LorentzVector & p4() const final
four-momentum Lorentz vector
std::vector< std::string > const & subjetCollectionNames() const
Subjet collection names.
float hadEnergyInHO() const
returns the jet hadronic energy in HO
std::vector< pat::JetPtrCollection > subjetCollections_
std::vector< std::string > const & tagInfoLabels() const
get list of tag info labels
std::vector< edm::FwdPtr< reco::BaseTagInfo > > TagInfoFwdPtrCollection
bool hasPFSpecific() const
check to see if the PFSpecific object is stored
void updateFwdPFCandidateFwdPtr(unsigned int index, const edm::Ptr< reco::PFCandidate > &updateFwd)
bool isPFJet() const
check to see if the jet is a reco::PFJet
JetCorrFactors::Flavor currentJECFlavor() const
return flavour of the current step of jet energy corrections
const T * tagInfoByTypeOrLabel(const std::string &label="") const
float emEnergyFraction() const
returns the jet electromagnetic energy fraction
std::vector< pat::JetCorrFactors > jec_
std::vector< std::string > tagInfoLabels_
void setPFSpecific(const PFSpecific &newPFSpecific)
set the pf specific part of the jet
bool isJPTJet() const
check to see if the jet is a reco::JPTJet
const reco::TrackRefVector & elecsInVertexOutCalo() const
electrons that curled out
std::vector< CandidatePtr > daughters
collection of references to daughters
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
unsigned int index
index type
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
const LorentzVector correctedP4(const unsigned int &level, const JetCorrFactors::Flavor &flavor=JetCorrFactors::NONE, const unsigned int &set=0) const
int n60() const
returns the number of constituents carrying a 60% of the total Jet energy*/
float electronEnergyFraction() const
electronEnergyFraction (relative to corrected jet energy)
std::vector< PFCandidateFwdPtr > PFCandidateFwdPtrVector
vector of "forward" reference
float chargedMuEnergyFraction() const
chargedMuEnergyFraction
std::vector< edm::FwdPtr< CaloTower > > CaloTowerFwdPtrCollection
std::vector< JPTSpecific > specificJPT_
std::vector< edm::FwdPtr< reco::PFCandidate > > PFCandidateFwdPtrCollection
float maxEInEmTowers() const
returns the maximum energy deposited in ECAL towers
std::string currentJECLevel() const
return the name of the current step of jet energy corrections
std::vector< std::string > subjetLabels_
reco::PFJet::Specific PFSpecific
float emEnergyInHF() const
returns the jet electromagnetic energy extracted from HF
Analysis-level calorimeter jet class.
float hadEnergyInHF() const
returns the jet hadronic energy in HF
reco::JPTJet::Specific JPTSpecific
edm::AtomicPtrCache< std::vector< reco::CandidatePtr > > daughtersTemp_
CaloTowerCollection caloTowers_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
float hoEnergy() const
hoEnergy
reco::CaloJet::Specific CaloSpecific
void updateFwdGenJetFwdRef(edm::Ref< reco::GenJetCollection > updateRef)
edm::FwdRef< reco::GenJetCollection > const & genJetFwdRef() const
reco::PFCandidateFwdPtrVector pfCandidatesFwdPtr_
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
void updateFwdTagInfoFwdPtr(unsigned int index, const edm::Ptr< reco::BaseTagInfo > &updateFwd)
double groomedMass(unsigned int index=0) const
Access to mass of subjets.
int HFHadronMultiplicity() const
HFHadronMultiplicity.
bool isBasicJet() const
check to see if the jet is no more than a reco::BasicJet
void currentJECLevel(const unsigned int &level)
update the current JEC level; used by correctedJet
Templated PAT object container.
const reco::TrackRefVector & pionsOutVertexInCalo() const
pions that curled in
const CaloSpecific & caloSpecific() const
retrieve the calo specific part of the jet
float muonEnergyFraction() const
muonEnergyFraction (relative to corrected jet energy)
float neutralEmEnergyFraction() const
neutralEmEnergyFraction (relative to uncorrected jet energy)
TagInfoFwdPtrCollection const & tagInfosFwdPtr() const
unsigned int currentJECSet_
const T * tagInfoByType() const
std::vector< reco::GenJet > genJet_
float hadEnergyInHB() const
returns the jet hadronic energy in HB
edm::AtomicPtrCache< std::vector< reco::PFCandidatePtr > > pfCandidatesTemp_
JetCorrFactors::Flavor currentJECFlavor_
bool embeddedPFCandidates_
static std::string const source
int chargedMultiplicity() const
chargedMultiplicity
std::string currentJECSet() const
returns the label of the current set of jet energy corrections
Matcher of reconstructed objects to L1 Muons.
void currentJECSet(const unsigned int &set)
update the current JEC set; used by correctedJet
void setCaloSpecific(const CaloSpecific &newCaloSpecific)
set the calo specific part of the jet
bool jecSetAvailable(const std::string &set) const