Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:46

0001 #ifndef DataFormats_TauReco_PFTau_h
0002 #define DataFormats_TauReco_PFTau_h
0003 
0004 /* class PFTau
0005  * the object of this class is created by RecoTauTag/RecoTau PFRecoTauProducer EDProducer starting from the PFTauTagInfo object,
0006  *                          is a hadronic tau-jet candidate -built from a jet made employing a particle flow technique- that analysts manipulate;
0007  * authors: Simone Gennai (simone.gennai@cern.ch), Ludovic Houchu (Ludovic.Houchu@cern.ch), Evan Friis (evan.klose.friis@ucdavis.edu)
0008  * created: Jun 21 2007,
0009  * revised: Tue Aug 31 13:34:40 CEST 2010
0010  */
0011 #include "DataFormats/Math/interface/LorentzVector.h"
0012 #include "DataFormats/Common/interface/AtomicPtrCache.h"
0013 #include "DataFormats/TauReco/interface/BaseTau.h"
0014 #include "DataFormats/TauReco/interface/PFTauFwd.h"
0015 #include "DataFormats/TauReco/interface/PFTauTagInfo.h"
0016 #include "DataFormats/JetReco/interface/JetCollection.h"
0017 #include "DataFormats/Candidate/interface/Candidate.h"
0018 #include "DataFormats/Candidate/interface/CandidateFwd.h"
0019 #include "DataFormats/TauReco/interface/RecoTauPiZero.h"
0020 #include "DataFormats/TauReco/interface/RecoTauPiZeroFwd.h"
0021 #include "DataFormats/TauReco/interface/PFRecoTauChargedHadron.h"
0022 #include "DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h"
0023 
0024 #include <iostream>
0025 #include <limits>
0026 
0027 namespace reco {
0028   namespace tau {
0029     class RecoTauConstructor;
0030     class PFRecoTauEnergyAlgorithmPlugin;
0031   }  // namespace tau
0032 }  // namespace reco
0033 
0034 namespace reco {
0035 
0036   class PFTau : public BaseTau {
0037   public:
0038     enum hadronicDecayMode {
0039       kNull = -1,
0040       kOneProng0PiZero,
0041       kOneProng1PiZero,
0042       kOneProng2PiZero,
0043       kOneProng3PiZero,
0044       kOneProngNPiZero,
0045       kTwoProng0PiZero,
0046       kTwoProng1PiZero,
0047       kTwoProng2PiZero,
0048       kTwoProng3PiZero,
0049       kTwoProngNPiZero,
0050       kThreeProng0PiZero,
0051       kThreeProng1PiZero,
0052       kThreeProng2PiZero,
0053       kThreeProng3PiZero,
0054       kThreeProngNPiZero,
0055       kRareDecayMode
0056     };
0057 
0058     PFTau();
0059     PFTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0));
0060     ~PFTau() override{};
0061     PFTau* clone() const override;
0062 
0063     const JetBaseRef& jetRef() const;
0064     void setjetRef(const JetBaseRef&);
0065 
0066     // functions to access the PFTauTagInfoRef used by HLT
0067     const PFTauTagInfoRef& pfTauTagInfoRef() const;
0068     void setpfTauTagInfoRef(const PFTauTagInfoRef);
0069 
0070     PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const;
0071     const CandidatePtr& leadChargedHadrCand() const;
0072     const CandidatePtr& leadNeutralCand() const;
0073     //Can be either the charged or the neutral one
0074     const CandidatePtr& leadCand() const;
0075 
0076     void setleadChargedHadrCand(const CandidatePtr&);
0077     void setleadNeutralCand(const CandidatePtr&);
0078     void setleadCand(const CandidatePtr&);
0079 
0080     /// Signed transverse impact parameter significance of the Track
0081     /// associated to the leading charged PFCandidate
0082     float leadPFChargedHadrCandsignedSipt() const;
0083     void setleadPFChargedHadrCandsignedSipt(const float&);
0084 
0085     /// Candidates in signal region
0086     const std::vector<reco::CandidatePtr>& signalCands() const;
0087     void setsignalCands(const std::vector<reco::CandidatePtr>&);
0088 
0089     /// Charged hadrons in signal region
0090     const std::vector<reco::CandidatePtr>& signalChargedHadrCands() const;
0091     void setsignalChargedHadrCands(const std::vector<reco::CandidatePtr>&);
0092 
0093     /// Neutral hadrons in signal region
0094     const std::vector<reco::CandidatePtr>& signalNeutrHadrCands() const;
0095     void setsignalNeutrHadrCands(const std::vector<reco::CandidatePtr>&);
0096 
0097     /// Gamma candidates in signal region
0098     const std::vector<reco::CandidatePtr>& signalGammaCands() const;
0099     void setsignalGammaCands(const std::vector<reco::CandidatePtr>&);
0100 
0101     /// Candidates in isolation region
0102     const std::vector<reco::CandidatePtr>& isolationCands() const;
0103     void setisolationCands(const std::vector<reco::CandidatePtr>&);
0104 
0105     /// Charged candidates in isolation region
0106     const std::vector<reco::CandidatePtr>& isolationChargedHadrCands() const;
0107     void setisolationChargedHadrCands(const std::vector<reco::CandidatePtr>&);
0108 
0109     //// Neutral hadrons in isolation region
0110     const std::vector<reco::CandidatePtr>& isolationNeutrHadrCands() const;
0111     void setisolationNeutrHadrCands(const std::vector<reco::CandidatePtr>&);
0112 
0113     /// Gamma candidates in isolation region
0114     const std::vector<reco::CandidatePtr>& isolationGammaCands() const;
0115     void setisolationGammaCands(const std::vector<reco::CandidatePtr>&);
0116 
0117     /// Getters for different PFCandidates for PFTaus made from PFCandidates
0118     const PFCandidatePtr leadPFChargedHadrCand() const;
0119     const PFCandidatePtr leadPFNeutralCand() const;
0120     const PFCandidatePtr leadPFCand() const;
0121     const std::vector<reco::PFCandidatePtr>& signalPFCands() const;
0122     const std::vector<reco::PFCandidatePtr>& signalPFChargedHadrCands() const;
0123     const std::vector<reco::PFCandidatePtr>& signalPFNeutrHadrCands() const;
0124     const std::vector<reco::PFCandidatePtr>& signalPFGammaCands() const;
0125     const std::vector<reco::PFCandidatePtr>& isolationPFCands() const;
0126     const std::vector<reco::PFCandidatePtr>& isolationPFChargedHadrCands() const;
0127     const std::vector<reco::PFCandidatePtr>& isolationPFNeutrHadrCands() const;
0128     const std::vector<reco::PFCandidatePtr>& isolationPFGammaCands() const;
0129 
0130     /// Sum of charged hadron candidate PT in isolation cone; returns NaN
0131     /// if isolation region is undefined.
0132     float isolationPFChargedHadrCandsPtSum() const;
0133     void setisolationPFChargedHadrCandsPtSum(const float&);
0134 
0135     /// Sum of gamma candidate PT in isolation cone; returns NaN
0136     /// if isolation region is undefined.
0137     float isolationPFGammaCandsEtSum() const;
0138     void setisolationPFGammaCandsEtSum(const float&);
0139 
0140     /// Et of the highest Et HCAL PFCluster
0141     float maximumHCALPFClusterEt() const;
0142     void setmaximumHCALPFClusterEt(const float&);
0143 
0144     /// Retrieve the association of signal region gamma candidates into candidate PiZeros
0145     const std::vector<RecoTauPiZero>& signalPiZeroCandidates() const;
0146     void setsignalPiZeroCandidates(std::vector<RecoTauPiZero>);
0147     void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector);
0148 
0149     /// Retrieve the association of isolation region gamma candidates into candidate PiZeros
0150     const std::vector<RecoTauPiZero>& isolationPiZeroCandidates() const;
0151     void setisolationPiZeroCandidates(std::vector<RecoTauPiZero>);
0152     void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector);
0153 
0154     /// Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons
0155     const std::vector<PFRecoTauChargedHadron>& signalTauChargedHadronCandidates() const;
0156     void setSignalTauChargedHadronCandidates(std::vector<PFRecoTauChargedHadron>);
0157     void setSignalTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector);
0158 
0159     /// Retrieve the association of isolation region PF candidates into candidate PFRecoTauChargedHadron
0160     const std::vector<PFRecoTauChargedHadron>& isolationTauChargedHadronCandidates() const;
0161     void setIsolationTauChargedHadronCandidates(std::vector<PFRecoTauChargedHadron>);
0162     void setIsolationTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector);
0163 
0164     /// Retrieve the identified hadronic decay mode according to the number of
0165     /// charged and piZero candidates in the signal cone
0166     hadronicDecayMode decayMode() const;
0167     void setDecayMode(const hadronicDecayMode&);
0168 
0169     /// Effect of eta and phi correction of strip on mass of tau candidate
0170     float bendCorrMass() const { return bendCorrMass_; }
0171     void setBendCorrMass(float bendCorrMass) { bendCorrMass_ = bendCorrMass; }
0172 
0173     /// Size of signal cone
0174     double signalConeSize() const { return signalConeSize_; }
0175     void setSignalConeSize(double signalConeSize) { signalConeSize_ = signalConeSize; }
0176 
0177     //Electron rejection
0178     float emFraction() const;        // Ecal/Hcal Cluster Energy
0179     float hcalTotOverPLead() const;  // total Hcal Cluster E / leadPFChargedHadron P
0180     float hcalMaxOverPLead() const;  // max. Hcal Cluster E / leadPFChargedHadron P
0181     // Hcal Cluster E in R<0.184 around Ecal impact point of leading track / leadPFChargedHadron P
0182     float hcal3x3OverPLead() const;
0183     float ecalStripSumEOverPLead() const;       // Simple BremsRecovery Sum E / leadPFChargedHadron P
0184     float bremsRecoveryEOverPLead() const;      // BremsRecovery Sum E / leadPFChargedHadron P
0185     reco::TrackRef electronPreIDTrack() const;  // Ref to KF track from Electron PreID
0186     float electronPreIDOutput() const;          // BDT output from Electron PreID
0187     bool electronPreIDDecision() const;         // Decision from Electron PreID
0188 
0189     void setemFraction(const float&);
0190     void sethcalTotOverPLead(const float&);
0191     void sethcalMaxOverPLead(const float&);
0192     void sethcal3x3OverPLead(const float&);
0193     void setecalStripSumEOverPLead(const float&);
0194     void setbremsRecoveryEOverPLead(const float&);
0195     void setelectronPreIDTrack(const reco::TrackRef&);
0196     void setelectronPreIDOutput(const float&);
0197     void setelectronPreIDDecision(const bool&);
0198 
0199     // For Muon Rejection
0200     bool hasMuonReference() const;  // check if muon ref exists
0201     float caloComp() const;
0202     float segComp() const;
0203     bool muonDecision() const;
0204     void setCaloComp(const float&);
0205     void setSegComp(const float&);
0206     void setMuonDecision(const bool&);
0207 
0208     /// return the number of source Candidates
0209     /// ( the candidates used to construct this Candidate)
0210     /// in the case of taus, there is only one source candidate,
0211     /// which is the corresponding PFJet
0212     size_type numberOfSourceCandidatePtrs() const override { return 1; }
0213 
0214     /// return a RefToBase to the source Candidates
0215     /// ( the candidates used to construct this Candidate)
0216     CandidatePtr sourceCandidatePtr(size_type i) const override;
0217 
0218     /// prints information on this PFTau
0219     void dump(std::ostream& out = std::cout) const;
0220 
0221   private:
0222     friend class tau::RecoTauConstructor;
0223     friend class tau::PFRecoTauEnergyAlgorithmPlugin;
0224 
0225     //These are used by the friends
0226     std::vector<RecoTauPiZero>& signalPiZeroCandidatesRestricted();
0227     std::vector<RecoTauPiZero>& isolationPiZeroCandidatesRestricted();
0228     std::vector<PFRecoTauChargedHadron>& signalTauChargedHadronCandidatesRestricted();
0229     std::vector<PFRecoTauChargedHadron>& isolationTauChargedHadronCandidatesRestricted();
0230 
0231     // check overlap with another candidate
0232     bool overlap(const Candidate&) const override;
0233 
0234     bool muonDecision_;
0235     bool electronPreIDDecision_;
0236 
0237     // SIP
0238     float leadPFChargedHadrCandsignedSipt_;
0239     // Isolation variables
0240     float isolationPFChargedHadrCandsPtSum_;
0241     float isolationPFGammaCandsEtSum_;
0242     float maximumHCALPFClusterEt_;
0243 
0244     // Electron rejection variables
0245     float emFraction_;
0246     float hcalTotOverPLead_;
0247     float hcalMaxOverPLead_;
0248     float hcal3x3OverPLead_;
0249     float ecalStripSumEOverPLead_;
0250     float bremsRecoveryEOverPLead_;
0251     float electronPreIDOutput_;
0252 
0253     // Muon rejection variables
0254     float caloComp_;
0255     float segComp_;
0256 
0257     hadronicDecayMode decayMode_;
0258 
0259     float bendCorrMass_;
0260 
0261     float signalConeSize_;
0262 
0263     reco::JetBaseRef jetRef_;
0264     PFTauTagInfoRef PFTauTagInfoRef_;
0265     reco::CandidatePtr leadChargedHadrCand_;
0266     reco::CandidatePtr leadNeutralCand_;
0267     reco::CandidatePtr leadCand_;
0268     reco::TrackRef electronPreIDTrack_;
0269 
0270     // Signal candidates
0271     std::vector<reco::CandidatePtr> selectedSignalCands_;
0272     std::vector<reco::CandidatePtr> selectedSignalChargedHadrCands_;
0273     std::vector<reco::CandidatePtr> selectedSignalNeutrHadrCands_;
0274     std::vector<reco::CandidatePtr> selectedSignalGammaCands_;
0275 
0276     // Isolation candidates
0277     std::vector<reco::CandidatePtr> selectedIsolationCands_;
0278     std::vector<reco::CandidatePtr> selectedIsolationChargedHadrCands_;
0279     std::vector<reco::CandidatePtr> selectedIsolationNeutrHadrCands_;
0280     std::vector<reco::CandidatePtr> selectedIsolationGammaCands_;
0281 
0282     // Transient caches for PFCandidate-based accessors
0283     edm::AtomicPtrCache<reco::PFCandidatePtr> leadPFChargedHadrCand_;
0284     edm::AtomicPtrCache<reco::PFCandidatePtr> leadPFNeutralCand_;
0285     edm::AtomicPtrCache<reco::PFCandidatePtr> leadPFCand_;
0286 
0287     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientSignalPFCands_;
0288     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientSignalPFChargedHadrCands_;
0289     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientSignalPFNeutrHadrCands_;
0290     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientSignalPFGammaCands_;
0291 
0292     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientIsolationPFCands_;
0293     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientIsolationPFChargedHadrCands_;
0294     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientIsolationPFNeutrHadrCands_;
0295     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr>> selectedTransientIsolationPFGammaCands_;
0296 
0297     RecoTauPiZeroRefVector signalPiZeroCandidatesRefs_;
0298     RecoTauPiZeroRefVector isolationPiZeroCandidatesRefs_;
0299 
0300     PFRecoTauChargedHadronRefVector signalTauChargedHadronCandidatesRefs_;
0301     PFRecoTauChargedHadronRefVector isolationTauChargedHadronCandidatesRefs_;
0302 
0303     // Association of gamma candidates into PiZeros (transient)
0304     edm::AtomicPtrCache<std::vector<reco::RecoTauPiZero>> signalPiZeroCandidates_;
0305     edm::AtomicPtrCache<std::vector<reco::RecoTauPiZero>> isolationPiZeroCandidates_;
0306 
0307     // Association of PF candidates into PFRecoTauChargedHadrons (transient)
0308     edm::AtomicPtrCache<std::vector<reco::PFRecoTauChargedHadron>> signalTauChargedHadronCandidates_;
0309     edm::AtomicPtrCache<std::vector<reco::PFRecoTauChargedHadron>> isolationTauChargedHadronCandidates_;
0310   };
0311 
0312   std::ostream& operator<<(std::ostream& out, const PFTau& c);
0313 
0314 }  // end namespace reco
0315 
0316 #endif