CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/PatCandidates/interface/Tau.h

Go to the documentation of this file.
00001 //
00002 // $Id: Tau.h,v 1.34 2012/04/25 07:32:20 cbern Exp $
00003 //
00004 
00005 #ifndef DataFormats_PatCandidates_Tau_h
00006 #define DataFormats_PatCandidates_Tau_h
00007 
00024 #include "DataFormats/TauReco/interface/BaseTau.h"
00025 #include "DataFormats/TrackReco/interface/Track.h"
00026 #include "DataFormats/PatCandidates/interface/Lepton.h"
00027 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00028 #include "DataFormats/Candidate/interface/Candidate.h"
00029 
00030 #include "DataFormats/PatCandidates/interface/TauPFSpecific.h"
00031 #include "DataFormats/PatCandidates/interface/TauCaloSpecific.h"
00032 #include "DataFormats/PatCandidates/interface/TauJetCorrFactors.h"
00033 
00034 // Define typedefs for convenience
00035 namespace pat {
00036   class Tau;
00037   typedef std::vector<Tau>              TauCollection; 
00038   typedef edm::Ref<TauCollection>       TauRef; 
00039   typedef edm::RefVector<TauCollection> TauRefVector; 
00040 }
00041 
00042 namespace reco {
00044   std::ostream& operator<<(std::ostream& out, const pat::Tau& obj);
00045 }
00046 
00047 // Class definition
00048 namespace pat {
00049 
00050   class Tau : public Lepton<reco::BaseTau> {
00054     friend class PATTauProducer;
00055 
00056     public:
00057 
00058       typedef std::pair<std::string,float> IdPair;
00059 
00061       Tau();
00063       Tau(const reco::BaseTau & aTau);
00065       Tau(const edm::RefToBase<reco::BaseTau> & aTauRef);
00067       Tau(const edm::Ptr<reco::BaseTau> & aTauRef);
00069       virtual ~Tau();
00070 
00072       virtual Tau * clone() const { return new Tau(*this); }
00073 
00074       // ---- methods for content embedding ----
00076       const reco::TrackRefVector & isolationTracks() const;
00078       reco::TrackRef leadTrack() const;
00080       const reco::TrackRefVector & signalTracks() const;        
00082       void embedIsolationTracks();
00084       void embedLeadTrack();
00086       void embedSignalTracks();
00089       void embedLeadPFCand();
00091       void embedLeadPFChargedHadrCand();
00093       void embedLeadPFNeutralCand();
00095       void embedSignalPFCands();
00097       void embedSignalPFChargedHadrCands();
00099       void embedSignalPFNeutralHadrCands();
00101       void embedSignalPFGammaCands();
00103       void embedIsolationPFCands();
00105       void embedIsolationPFChargedHadrCands();
00107       void embedIsolationPFNeutralHadrCands();
00109       void embedIsolationPFGammaCands();
00110       
00111       // ---- matched GenJet methods ----
00113       const reco::GenJet * genJet() const;
00115       void setGenJet(const reco::GenJetRef & ref);
00116 
00117       // ---- CaloTau accessors (getters only) ----
00119       bool isCaloTau() const { return !caloSpecific_.empty(); }
00121       const pat::tau::TauCaloSpecific & caloSpecific() const ;
00124       reco::CaloTauTagInfoRef caloTauTagInfoRef() const { return caloSpecific().CaloTauTagInfoRef_; }
00127       float leadTracksignedSipt() const { return caloSpecific().leadTracksignedSipt_; }
00130       float leadTrackHCAL3x3hitsEtSum() const { return caloSpecific().leadTrackHCAL3x3hitsEtSum_; }
00133       float leadTrackHCAL3x3hottesthitDEta() const { return caloSpecific().leadTrackHCAL3x3hottesthitDEta_; }
00136       float signalTracksInvariantMass() const { return caloSpecific().signalTracksInvariantMass_; }
00139       float TracksInvariantMass() const { return caloSpecific().TracksInvariantMass_; } 
00142       float isolationTracksPtSum() const { return caloSpecific().isolationTracksPtSum_; }
00145       float isolationECALhitsEtSum() const { return caloSpecific().isolationECALhitsEtSum_; }
00148       float maximumHCALhitEt() const { return caloSpecific().maximumHCALhitEt_; }
00149 
00150       // ---- PFTau accessors (getters only) ----
00152       bool isPFTau() const { return !pfSpecific_.empty(); }
00154       const pat::tau::TauPFSpecific & pfSpecific() const ;
00157       const reco::PFJetRef & pfJetRef() const { return pfSpecific().pfJetRef_; }
00160       const reco::PFCandidateRef leadPFChargedHadrCand() const;
00163       float leadPFChargedHadrCandsignedSipt() const { return pfSpecific().leadPFChargedHadrCandsignedSipt_; }
00166       const reco::PFCandidateRef leadPFNeutralCand() const;
00169       const reco::PFCandidateRef leadPFCand() const;
00172       const reco::PFCandidateRefVector & signalPFCands() const;
00175       const reco::PFCandidateRefVector & signalPFChargedHadrCands() const;
00178       const reco::PFCandidateRefVector & signalPFNeutrHadrCands() const;
00181       const reco::PFCandidateRefVector & signalPFGammaCands() const;
00184       const std::vector<reco::RecoTauPiZero> & signalPiZeroCandidates() const;
00187       const reco::PFCandidateRefVector & isolationPFCands() const;
00190       const reco::PFCandidateRefVector & isolationPFChargedHadrCands() const;
00193       const reco::PFCandidateRefVector & isolationPFNeutrHadrCands() const;
00196       const reco::PFCandidateRefVector & isolationPFGammaCands() const;
00199       const std::vector<reco::RecoTauPiZero> & isolationPiZeroCandidates() const;
00202       float isolationPFChargedHadrCandsPtSum() const { return pfSpecific().isolationPFChargedHadrCandsPtSum_; }
00205       float isolationPFGammaCandsEtSum() const { return pfSpecific().isolationPFGammaCandsEtSum_; }
00208       float maximumHCALPFClusterEt() const { return pfSpecific().maximumHCALPFClusterEt_; }
00211       float emFraction() const { return pfSpecific().emFraction_; }
00214       float hcalTotOverPLead() const { return pfSpecific().hcalTotOverPLead_; }
00217       float hcalMaxOverPLead() const { return pfSpecific().hcalMaxOverPLead_; }
00220       float hcal3x3OverPLead() const { return pfSpecific().hcal3x3OverPLead_; }
00223       float ecalStripSumEOverPLead() const { return pfSpecific().ecalStripSumEOverPLead_; }
00226       float bremsRecoveryEOverPLead() const { return pfSpecific().bremsRecoveryEOverPLead_; }
00229       const reco::TrackRef & electronPreIDTrack() const { return pfSpecific().electronPreIDTrack_; }
00232       float electronPreIDOutput() const { return pfSpecific().electronPreIDOutput_; }
00235       bool electronPreIDDecision() const { return pfSpecific().electronPreIDDecision_; }
00238       float caloComp() const { return pfSpecific().caloComp_; }
00241       float segComp() const { return pfSpecific().segComp_; }
00244       bool muonDecision() const { return pfSpecific().muonDecision_; }
00245 
00248       const reco::Candidate::LorentzVector& p4Jet() const;
00249       float etaetaMoment() const;
00250       float phiphiMoment() const;
00251       float etaphiMoment() const;
00252 
00254       int decayMode() const { return pfSpecific().decayMode_; }
00256       void setDecayMode(int);
00257 
00258       // ---- methods for tau ID ----
00264       float tauID(const std::string & name) const;
00265       float tauID(const char* name ) const {return tauID( std::string(name) );}
00267       bool isTauIDAvailable(const std::string & name) const;
00270       const std::vector<IdPair> &  tauIDs() const { return tauIDs_; }
00273       void setTauIDs(const std::vector<IdPair> & ids) { tauIDs_ = ids; }
00274 
00276       friend std::ostream& reco::operator<<(std::ostream& out, const Tau& obj);
00277 
00280       const std::vector<std::string> availableJECSets() const;
00281       // returns the available JEC Levels for a given jecSet
00282       const std::vector<std::string> availableJECLevels(const int& set = 0) const;
00283       // returns the available JEC Levels for a given jecSet
00284       const std::vector<std::string> availableJECLevels(const std::string& set) const { return availableJECLevels(jecSet(set)); };
00287       bool jecSetsAvailable() const { return !jec_.empty(); }
00290       bool jecSetAvailable(const std::string& set) const {return (jecSet(set) >= 0); };
00293       bool jecSetAvailable(const unsigned int& set) const {return (set < jec_.size()); };
00295       std::string currentJECSet() const { 
00296         return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecSet() : std::string("ERROR"); 
00297       }
00299       std::string currentJECLevel() const { 
00300         return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecLevel(currentJECLevel_) : std::string("ERROR"); 
00301       }
00304       float jecFactor(const std::string& level, const std::string& set = "") const;
00307       float jecFactor(const unsigned int& level, const unsigned int& set = 0) const;
00310       Tau correctedTauJet(const std::string& level, const std::string& set = "") const;
00313       Tau correctedTauJet(const unsigned int& level, const unsigned int& set = 0) const;
00316       const LorentzVector& correctedP4(const std::string& level, const std::string& set = "") const { 
00317         return correctedTauJet(level, set).p4(); 
00318       }
00321       const LorentzVector& correctedP4(const unsigned int& level, const unsigned int& set = 0) const { 
00322         return correctedTauJet(level, set).p4(); 
00323       }
00324 
00325     protected:
00326    
00329       int jecSet(const std::string& label) const;
00331       void currentJECSet(const unsigned int& set) { currentJECSet_=set; };
00333       void currentJECLevel(const unsigned int& level) { currentJECLevel_=level; };
00335       void addJECFactors(const TauJetCorrFactors& jec) {jec_.push_back(jec); };
00337       void initializeJEC(unsigned int level, const unsigned int set = 0);
00338 
00339       // ---- for content embedding ----
00340       bool embeddedIsolationTracks_;
00341       std::vector<reco::Track> isolationTracks_;
00342       mutable reco::TrackRefVector isolationTracksTransientRefVector_;
00343       mutable bool       isolationTracksTransientRefVectorFixed_;
00344       bool embeddedLeadTrack_;
00345       std::vector<reco::Track> leadTrack_;
00346       bool embeddedSignalTracks_;
00347       std::vector<reco::Track> signalTracks_;
00348       mutable reco::TrackRefVector signalTracksTransientRefVector_;
00349       mutable bool       signalTracksTransientRefVectorFixed_;
00350       // specific for PFTau
00351       std::vector<reco::PFCandidate> leadPFCand_;
00352       bool embeddedLeadPFCand_;
00353       std::vector<reco::PFCandidate> leadPFChargedHadrCand_;
00354       bool embeddedLeadPFChargedHadrCand_;
00355       std::vector<reco::PFCandidate> leadPFNeutralCand_;
00356       bool embeddedLeadPFNeutralCand_;
00357 
00358       std::vector<reco::PFCandidate> signalPFCands_;
00359       bool embeddedSignalPFCands_;
00360       mutable reco::PFCandidateRefVector signalPFCandsTransientRefVector_;
00361       mutable bool signalPFCandsRefVectorFixed_;
00362       std::vector<reco::PFCandidate> signalPFChargedHadrCands_;
00363       bool embeddedSignalPFChargedHadrCands_;
00364       mutable reco::PFCandidateRefVector signalPFChargedHadrCandsTransientRefVector_;
00365       mutable bool signalPFChargedHadrCandsRefVectorFixed_;
00366       std::vector<reco::PFCandidate> signalPFNeutralHadrCands_;
00367       bool embeddedSignalPFNeutralHadrCands_;
00368       mutable reco::PFCandidateRefVector signalPFNeutralHadrCandsTransientRefVector_;
00369       mutable bool signalPFNeutralHadrCandsRefVectorFixed_;
00370       std::vector<reco::PFCandidate> signalPFGammaCands_;
00371       bool embeddedSignalPFGammaCands_;
00372       mutable reco::PFCandidateRefVector signalPFGammaCandsTransientRefVector_;
00373       mutable bool signalPFGammaCandsRefVectorFixed_;
00374       std::vector<reco::PFCandidate> isolationPFCands_;
00375       bool embeddedIsolationPFCands_;
00376       mutable reco::PFCandidateRefVector isolationPFCandsTransientRefVector_;
00377       mutable bool isolationPFCandsRefVectorFixed_;
00378       std::vector<reco::PFCandidate> isolationPFChargedHadrCands_;
00379       bool embeddedIsolationPFChargedHadrCands_;
00380       mutable reco::PFCandidateRefVector isolationPFChargedHadrCandsTransientRefVector_;
00381       mutable bool isolationPFChargedHadrCandsRefVectorFixed_;
00382       std::vector<reco::PFCandidate> isolationPFNeutralHadrCands_;
00383       bool embeddedIsolationPFNeutralHadrCands_;
00384       mutable reco::PFCandidateRefVector isolationPFNeutralHadrCandsTransientRefVector_;
00385       mutable bool isolationPFNeutralHadrCandsRefVectorFixed_;
00386       std::vector<reco::PFCandidate> isolationPFGammaCands_;
00387       bool embeddedIsolationPFGammaCands_;
00388       mutable reco::PFCandidateRefVector isolationPFGammaCandsTransientRefVector_;
00389       mutable bool isolationPFGammaCandsRefVectorFixed_;
00390 
00391       // ---- matched GenJet holder ----
00392       std::vector<reco::GenJet> genJet_;
00393 
00394       // ---- tau ID's holder ----
00395       std::vector<IdPair> tauIDs_;
00396 
00397       // ---- CaloTau specific variables  ----
00399       std::vector<pat::tau::TauCaloSpecific> caloSpecific_;
00400 
00401       // ---- PFTau specific variables  ----
00403       std::vector<pat::tau::TauPFSpecific> pfSpecific_;
00404 
00405       // ---- energy scale correction factors ----
00406       // energy scale correction factors; the string carries a potential label if
00407       // more then one set of correction factors is embedded. The label corresponds
00408       // to the label of the jetCorrFactors module that has been embedded.
00409       std::vector<pat::TauJetCorrFactors> jec_;
00410       // currently applied set of jet energy correction factors (i.e. the index in
00411       // jetEnergyCorrections_)
00412       unsigned int currentJECSet_;
00413       // currently applied jet energy correction level
00414       unsigned int currentJECLevel_;
00415   };
00416 }
00417 
00418 #endif