00001 // 00002 // $Id: Tau.h,v 1.29 2011/06/08 20:40:18 rwolf 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 00029 #include "DataFormats/Common/interface/BoolCache.h" 00030 00031 #include "DataFormats/PatCandidates/interface/TauPFSpecific.h" 00032 #include "DataFormats/PatCandidates/interface/TauCaloSpecific.h" 00033 00034 00035 // Define typedefs for convenience 00036 namespace pat { 00037 class Tau; 00038 typedef std::vector<Tau> TauCollection; 00039 typedef edm::Ref<TauCollection> TauRef; 00040 typedef edm::RefVector<TauCollection> TauRefVector; 00041 } 00042 00043 namespace reco { 00045 std::ostream& operator<<(std::ostream& out, const pat::Tau& obj); 00046 } 00047 00048 // Class definition 00049 namespace pat { 00050 00051 class Tau : public Lepton<reco::BaseTau> { 00052 00053 public: 00054 00055 typedef std::pair<std::string,float> IdPair; 00056 00058 Tau(); 00060 Tau(const reco::BaseTau & aTau); 00062 Tau(const edm::RefToBase<reco::BaseTau> & aTauRef); 00064 Tau(const edm::Ptr<reco::BaseTau> & aTauRef); 00066 virtual ~Tau(); 00067 00069 virtual Tau * clone() const { return new Tau(*this); } 00070 00071 // ---- methods for content embedding ---- 00073 const reco::TrackRefVector & isolationTracks() const; 00075 reco::TrackRef leadTrack() const; 00077 const reco::TrackRefVector & signalTracks() const; 00079 void embedIsolationTracks(); 00081 void embedLeadTrack(); 00083 void embedSignalTracks(); 00086 void embedLeadPFCand(); 00088 void embedLeadPFChargedHadrCand(); 00090 void embedLeadPFNeutralCand(); 00092 void embedSignalPFCands(); 00094 void embedSignalPFChargedHadrCands(); 00096 void embedSignalPFNeutralHadrCands(); 00098 void embedSignalPFGammaCands(); 00100 void embedIsolationPFCands(); 00102 void embedIsolationPFChargedHadrCands(); 00104 void embedIsolationPFNeutralHadrCands(); 00106 void embedIsolationPFGammaCands(); 00107 00108 // ---- matched GenJet methods ---- 00110 const reco::GenJet * genJet() const; 00112 void setGenJet(const reco::GenJetRef & ref); 00113 00114 // ---- CaloTau accessors (getters only) ---- 00116 bool isCaloTau() const { return !caloSpecific_.empty(); } 00118 const pat::tau::TauCaloSpecific & caloSpecific() const ; 00121 reco::CaloTauTagInfoRef caloTauTagInfoRef() const { return caloSpecific().CaloTauTagInfoRef_; } 00124 float leadTracksignedSipt() const { return caloSpecific().leadTracksignedSipt_; } 00127 float leadTrackHCAL3x3hitsEtSum() const { return caloSpecific().leadTrackHCAL3x3hitsEtSum_; } 00130 float leadTrackHCAL3x3hottesthitDEta() const { return caloSpecific().leadTrackHCAL3x3hottesthitDEta_; } 00133 float signalTracksInvariantMass() const { return caloSpecific().signalTracksInvariantMass_; } 00136 float TracksInvariantMass() const { return caloSpecific().TracksInvariantMass_; } 00139 float isolationTracksPtSum() const { return caloSpecific().isolationTracksPtSum_; } 00142 float isolationECALhitsEtSum() const { return caloSpecific().isolationECALhitsEtSum_; } 00145 float maximumHCALhitEt() const { return caloSpecific().maximumHCALhitEt_; } 00146 00147 // ---- PFTau accessors (getters only) ---- 00149 bool isPFTau() const { return !pfSpecific_.empty(); } 00151 const pat::tau::TauPFSpecific & pfSpecific() const ; 00154 const reco::PFJetRef & pfJetRef() const { return pfSpecific().pfJetRef_; } 00157 const reco::PFCandidateRef leadPFChargedHadrCand() const; 00160 float leadPFChargedHadrCandsignedSipt() const { return pfSpecific().leadPFChargedHadrCandsignedSipt_; } 00163 const reco::PFCandidateRef leadPFNeutralCand() const; 00166 const reco::PFCandidateRef leadPFCand() const; 00169 const reco::PFCandidateRefVector & signalPFCands() const; 00172 const reco::PFCandidateRefVector & signalPFChargedHadrCands() const; 00175 const reco::PFCandidateRefVector & signalPFNeutrHadrCands() const; 00178 const reco::PFCandidateRefVector & signalPFGammaCands() const; 00181 const reco::PFCandidateRefVector & isolationPFCands() const; 00184 const reco::PFCandidateRefVector & isolationPFChargedHadrCands() const; 00187 const reco::PFCandidateRefVector & isolationPFNeutrHadrCands() const; 00190 const reco::PFCandidateRefVector & isolationPFGammaCands() const; 00193 float isolationPFChargedHadrCandsPtSum() const { return pfSpecific().isolationPFChargedHadrCandsPtSum_; } 00196 float isolationPFGammaCandsEtSum() const { return pfSpecific().isolationPFGammaCandsEtSum_; } 00199 float maximumHCALPFClusterEt() const { return pfSpecific().maximumHCALPFClusterEt_; } 00202 float emFraction() const { return pfSpecific().emFraction_; } 00205 float hcalTotOverPLead() const { return pfSpecific().hcalTotOverPLead_; } 00208 float hcalMaxOverPLead() const { return pfSpecific().hcalMaxOverPLead_; } 00211 float hcal3x3OverPLead() const { return pfSpecific().hcal3x3OverPLead_; } 00214 float ecalStripSumEOverPLead() const { return pfSpecific().ecalStripSumEOverPLead_; } 00217 float bremsRecoveryEOverPLead() const { return pfSpecific().bremsRecoveryEOverPLead_; } 00220 const reco::TrackRef & electronPreIDTrack() const { return pfSpecific().electronPreIDTrack_; } 00223 float electronPreIDOutput() const { return pfSpecific().electronPreIDOutput_; } 00226 bool electronPreIDDecision() const { return pfSpecific().electronPreIDDecision_; } 00229 float caloComp() const { return pfSpecific().caloComp_; } 00232 float segComp() const { return pfSpecific().segComp_; } 00235 bool muonDecision() const { return pfSpecific().muonDecision_; } 00236 00239 float etaetaMoment() const; 00240 float phiphiMoment() const; 00241 float etaphiMoment() const; 00242 00244 int decayMode() const { return pfSpecific().decayMode_; } 00246 void setDecayMode(int); 00247 00248 // ---- methods for tau ID ---- 00254 float tauID(const std::string & name) const; 00256 bool isTauIDAvailable(const std::string & name) const; 00259 const std::vector<IdPair> & tauIDs() const { return tauIDs_; } 00262 void setTauIDs(const std::vector<IdPair> & ids) { tauIDs_ = ids; } 00263 00265 friend std::ostream& reco::operator<<(std::ostream& out, const Tau& obj); 00266 00267 protected: 00268 00269 // ---- for content embedding ---- 00270 bool embeddedIsolationTracks_; 00271 std::vector<reco::Track> isolationTracks_; 00272 mutable reco::TrackRefVector isolationTracksTransientRefVector_; 00273 mutable edm::BoolCache isolationTracksTransientRefVectorFixed_; 00274 bool embeddedLeadTrack_; 00275 std::vector<reco::Track> leadTrack_; 00276 bool embeddedSignalTracks_; 00277 std::vector<reco::Track> signalTracks_; 00278 mutable reco::TrackRefVector signalTracksTransientRefVector_; 00279 mutable edm::BoolCache signalTracksTransientRefVectorFixed_; 00280 // specific for PFTau 00281 std::vector<reco::PFCandidate> leadPFCand_; 00282 bool embeddedLeadPFCand_; 00283 std::vector<reco::PFCandidate> leadPFChargedHadrCand_; 00284 bool embeddedLeadPFChargedHadrCand_; 00285 std::vector<reco::PFCandidate> leadPFNeutralCand_; 00286 bool embeddedLeadPFNeutralCand_; 00287 00288 std::vector<reco::PFCandidate> signalPFCands_; 00289 bool embeddedSignalPFCands_; 00290 mutable reco::PFCandidateRefVector signalPFCandsTransientRefVector_; 00291 mutable edm::BoolCache signalPFCandsRefVectorFixed_; 00292 std::vector<reco::PFCandidate> signalPFChargedHadrCands_; 00293 bool embeddedSignalPFChargedHadrCands_; 00294 mutable reco::PFCandidateRefVector signalPFChargedHadrCandsTransientRefVector_; 00295 mutable edm::BoolCache signalPFChargedHadrCandsRefVectorFixed_; 00296 std::vector<reco::PFCandidate> signalPFNeutralHadrCands_; 00297 bool embeddedSignalPFNeutralHadrCands_; 00298 mutable reco::PFCandidateRefVector signalPFNeutralHadrCandsTransientRefVector_; 00299 mutable edm::BoolCache signalPFNeutralHadrCandsRefVectorFixed_; 00300 std::vector<reco::PFCandidate> signalPFGammaCands_; 00301 bool embeddedSignalPFGammaCands_; 00302 mutable reco::PFCandidateRefVector signalPFGammaCandsTransientRefVector_; 00303 mutable edm::BoolCache signalPFGammaCandsRefVectorFixed_; 00304 std::vector<reco::PFCandidate> isolationPFCands_; 00305 bool embeddedIsolationPFCands_; 00306 mutable reco::PFCandidateRefVector isolationPFCandsTransientRefVector_; 00307 mutable edm::BoolCache isolationPFCandsRefVectorFixed_; 00308 std::vector<reco::PFCandidate> isolationPFChargedHadrCands_; 00309 bool embeddedIsolationPFChargedHadrCands_; 00310 mutable reco::PFCandidateRefVector isolationPFChargedHadrCandsTransientRefVector_; 00311 mutable edm::BoolCache isolationPFChargedHadrCandsRefVectorFixed_; 00312 std::vector<reco::PFCandidate> isolationPFNeutralHadrCands_; 00313 bool embeddedIsolationPFNeutralHadrCands_; 00314 mutable reco::PFCandidateRefVector isolationPFNeutralHadrCandsTransientRefVector_; 00315 mutable edm::BoolCache isolationPFNeutralHadrCandsRefVectorFixed_; 00316 std::vector<reco::PFCandidate> isolationPFGammaCands_; 00317 bool embeddedIsolationPFGammaCands_; 00318 mutable reco::PFCandidateRefVector isolationPFGammaCandsTransientRefVector_; 00319 mutable edm::BoolCache isolationPFGammaCandsRefVectorFixed_; 00320 00321 // ---- matched GenJet holder ---- 00322 std::vector<reco::GenJet> genJet_; 00323 // ---- tau ID's holder ---- 00324 std::vector<IdPair> tauIDs_; 00325 // ---- CaloTau specific variables ---- 00327 std::vector<pat::tau::TauCaloSpecific> caloSpecific_; 00328 // ---- PFTau specific variables ---- 00330 std::vector<pat::tau::TauPFSpecific> pfSpecific_; 00331 }; 00332 } 00333 00334 #endif