CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 //
00002 // $Id: Tau.h,v 1.33 2011/10/27 16:35:27 wmtan 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;
00266       bool isTauIDAvailable(const std::string & name) const;
00269       const std::vector<IdPair> &  tauIDs() const { return tauIDs_; }
00272       void setTauIDs(const std::vector<IdPair> & ids) { tauIDs_ = ids; }
00273 
00275       friend std::ostream& reco::operator<<(std::ostream& out, const Tau& obj);
00276 
00279       const std::vector<std::string> availableJECSets() const;
00280       // returns the available JEC Levels for a given jecSet
00281       const std::vector<std::string> availableJECLevels(const int& set = 0) const;
00282       // returns the available JEC Levels for a given jecSet
00283       const std::vector<std::string> availableJECLevels(const std::string& set) const { return availableJECLevels(jecSet(set)); };
00286       bool jecSetsAvailable() const { return !jec_.empty(); }
00289       bool jecSetAvailable(const std::string& set) const {return (jecSet(set) >= 0); };
00292       bool jecSetAvailable(const unsigned int& set) const {return (set < jec_.size()); };
00294       std::string currentJECSet() const { 
00295         return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecSet() : std::string("ERROR"); 
00296       }
00298       std::string currentJECLevel() const { 
00299         return currentJECSet_<jec_.size() ? jec_.at(currentJECSet_).jecLevel(currentJECLevel_) : std::string("ERROR"); 
00300       }
00303       float jecFactor(const std::string& level, const std::string& set = "") const;
00306       float jecFactor(const unsigned int& level, const unsigned int& set = 0) const;
00309       Tau correctedTauJet(const std::string& level, const std::string& set = "") const;
00312       Tau correctedTauJet(const unsigned int& level, const unsigned int& set = 0) const;
00315       const LorentzVector& correctedP4(const std::string& level, const std::string& set = "") const { 
00316         return correctedTauJet(level, set).p4(); 
00317       }
00320       const LorentzVector& correctedP4(const unsigned int& level, const unsigned int& set = 0) const { 
00321         return correctedTauJet(level, set).p4(); 
00322       }
00323 
00324     protected:
00325    
00328       int jecSet(const std::string& label) const;
00330       void currentJECSet(const unsigned int& set) { currentJECSet_=set; };
00332       void currentJECLevel(const unsigned int& level) { currentJECLevel_=level; };
00334       void addJECFactors(const TauJetCorrFactors& jec) {jec_.push_back(jec); };
00336       void initializeJEC(unsigned int level, const unsigned int set = 0);
00337 
00338       // ---- for content embedding ----
00339       bool embeddedIsolationTracks_;
00340       std::vector<reco::Track> isolationTracks_;
00341       mutable reco::TrackRefVector isolationTracksTransientRefVector_;
00342       mutable bool       isolationTracksTransientRefVectorFixed_;
00343       bool embeddedLeadTrack_;
00344       std::vector<reco::Track> leadTrack_;
00345       bool embeddedSignalTracks_;
00346       std::vector<reco::Track> signalTracks_;
00347       mutable reco::TrackRefVector signalTracksTransientRefVector_;
00348       mutable bool       signalTracksTransientRefVectorFixed_;
00349       // specific for PFTau
00350       std::vector<reco::PFCandidate> leadPFCand_;
00351       bool embeddedLeadPFCand_;
00352       std::vector<reco::PFCandidate> leadPFChargedHadrCand_;
00353       bool embeddedLeadPFChargedHadrCand_;
00354       std::vector<reco::PFCandidate> leadPFNeutralCand_;
00355       bool embeddedLeadPFNeutralCand_;
00356 
00357       std::vector<reco::PFCandidate> signalPFCands_;
00358       bool embeddedSignalPFCands_;
00359       mutable reco::PFCandidateRefVector signalPFCandsTransientRefVector_;
00360       mutable bool signalPFCandsRefVectorFixed_;
00361       std::vector<reco::PFCandidate> signalPFChargedHadrCands_;
00362       bool embeddedSignalPFChargedHadrCands_;
00363       mutable reco::PFCandidateRefVector signalPFChargedHadrCandsTransientRefVector_;
00364       mutable bool signalPFChargedHadrCandsRefVectorFixed_;
00365       std::vector<reco::PFCandidate> signalPFNeutralHadrCands_;
00366       bool embeddedSignalPFNeutralHadrCands_;
00367       mutable reco::PFCandidateRefVector signalPFNeutralHadrCandsTransientRefVector_;
00368       mutable bool signalPFNeutralHadrCandsRefVectorFixed_;
00369       std::vector<reco::PFCandidate> signalPFGammaCands_;
00370       bool embeddedSignalPFGammaCands_;
00371       mutable reco::PFCandidateRefVector signalPFGammaCandsTransientRefVector_;
00372       mutable bool signalPFGammaCandsRefVectorFixed_;
00373       std::vector<reco::PFCandidate> isolationPFCands_;
00374       bool embeddedIsolationPFCands_;
00375       mutable reco::PFCandidateRefVector isolationPFCandsTransientRefVector_;
00376       mutable bool isolationPFCandsRefVectorFixed_;
00377       std::vector<reco::PFCandidate> isolationPFChargedHadrCands_;
00378       bool embeddedIsolationPFChargedHadrCands_;
00379       mutable reco::PFCandidateRefVector isolationPFChargedHadrCandsTransientRefVector_;
00380       mutable bool isolationPFChargedHadrCandsRefVectorFixed_;
00381       std::vector<reco::PFCandidate> isolationPFNeutralHadrCands_;
00382       bool embeddedIsolationPFNeutralHadrCands_;
00383       mutable reco::PFCandidateRefVector isolationPFNeutralHadrCandsTransientRefVector_;
00384       mutable bool isolationPFNeutralHadrCandsRefVectorFixed_;
00385       std::vector<reco::PFCandidate> isolationPFGammaCands_;
00386       bool embeddedIsolationPFGammaCands_;
00387       mutable reco::PFCandidateRefVector isolationPFGammaCandsTransientRefVector_;
00388       mutable bool isolationPFGammaCandsRefVectorFixed_;
00389 
00390       // ---- matched GenJet holder ----
00391       std::vector<reco::GenJet> genJet_;
00392 
00393       // ---- tau ID's holder ----
00394       std::vector<IdPair> tauIDs_;
00395 
00396       // ---- CaloTau specific variables  ----
00398       std::vector<pat::tau::TauCaloSpecific> caloSpecific_;
00399 
00400       // ---- PFTau specific variables  ----
00402       std::vector<pat::tau::TauPFSpecific> pfSpecific_;
00403 
00404       // ---- energy scale correction factors ----
00405       // energy scale correction factors; the string carries a potential label if
00406       // more then one set of correction factors is embedded. The label corresponds
00407       // to the label of the jetCorrFactors module that has been embedded.
00408       std::vector<pat::TauJetCorrFactors> jec_;
00409       // currently applied set of jet energy correction factors (i.e. the index in
00410       // jetEnergyCorrections_)
00411       unsigned int currentJECSet_;
00412       // currently applied jet energy correction level
00413       unsigned int currentJECLevel_;
00414   };
00415 }
00416 
00417 #endif