Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:55

0001 #ifndef DataFormats_PatCandidates_Tau_h
0002 #define DataFormats_PatCandidates_Tau_h
0003 
0004 /**
0005   \class    pat::Tau Tau.h "DataFormats/PatCandidates/interface/Tau.h"
0006   \brief    Analysis-level tau class
0007 
0008    pat::Tau implements the analysis-level tau class within the 'pat' namespace.
0009    It inherits from reco::BaseTau, copies all the information from the source
0010    reco::PFTau, and adds some PAT-specific variables.
0011 
0012    Please post comments and questions to the Physics Tools hypernews:
0013    https://hypernews.cern.ch/HyperNews/CMS/get/physTools.html
0014 
0015   \author Steven Lowette, Christophe Delaere, Giovanni Petrucciani, Frederic Ronga, Colin Bernet
0016 */
0017 
0018 #include "DataFormats/TauReco/interface/BaseTau.h"
0019 #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h"
0020 #include "DataFormats/TrackReco/interface/Track.h"
0021 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0022 #include "DataFormats/PatCandidates/interface/Lepton.h"
0023 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0024 #include "DataFormats/Candidate/interface/Candidate.h"
0025 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0026 
0027 #include "DataFormats/PatCandidates/interface/TauPFSpecific.h"
0028 #include "DataFormats/PatCandidates/interface/TauJetCorrFactors.h"
0029 #include "DataFormats/PatCandidates/interface/TauPFEssential.h"
0030 
0031 #include "DataFormats/Common/interface/AtomicPtrCache.h"
0032 
0033 // Define typedefs for convenience
0034 namespace pat {
0035   class Tau;
0036   typedef std::vector<Tau> TauCollection;
0037   typedef edm::Ref<TauCollection> TauRef;
0038   typedef edm::RefProd<TauCollection> TauRefProd;
0039   typedef edm::RefVector<TauCollection> TauRefVector;
0040 }  // namespace pat
0041 
0042 namespace reco {
0043   /// pipe operator (introduced to use pat::Tau with PFTopProjectors)
0044   std::ostream& operator<<(std::ostream& out, const pat::Tau& obj);
0045   //  bool sortByPt(const CandidatePtrVector::const_iterator &lhs, const CandidatePtrVector::const_iterator &rhs) { return (*lhs)->pt() < (*rhs)->pt(); }
0046 }  // namespace reco
0047 
0048 // Class definition
0049 namespace pat {
0050 
0051   class PATTauSlimmer;
0052 
0053   class Tau : public Lepton<reco::BaseTau> {
0054     /// make friends with PATTauProducer so that it can set the initial
0055     /// jet energy scale unequal to raw calling the private initializeJEC
0056     /// function, which should be non accessible to any other user
0057     friend class PATTauProducer;
0058 
0059   public:
0060     typedef std::pair<std::string, float> IdPair;
0061 
0062     /// default constructor
0063     Tau();
0064     /// constructor from a reco tau
0065     Tau(const reco::BaseTau& aTau);
0066     /// constructor from a RefToBase to a reco tau (to be superseded by Ptr counterpart)
0067     Tau(const edm::RefToBase<reco::BaseTau>& aTauRef);
0068     /// constructor from a Ptr to a reco tau
0069     Tau(const edm::Ptr<reco::BaseTau>& aTauRef);
0070     /// destructor
0071     ~Tau() override;
0072 
0073     /// required reimplementation of the Candidate's clone method
0074     Tau* clone() const override { return new Tau(*this); }
0075 
0076     // ---- methods for content embedding ----
0077     /// override the reco::BaseTau::isolationTracks method, to access the internal storage of the isolation tracks
0078     const reco::TrackRefVector& isolationTracks() const override;
0079     /// override the reco::BaseTau::leadTrack method, to access the internal storage of the leading track
0080     reco::TrackRef leadTrack() const override;
0081     /// override the reco::BaseTau::signalTracks method, to access the internal storage of the signal tracks
0082     const reco::TrackRefVector& signalTracks() const override;
0083     /// method to store the isolation tracks internally
0084     void embedIsolationTracks();
0085     /// method to store the leading track internally
0086     void embedLeadTrack();
0087     /// method to store the signal tracks internally
0088     void embedSignalTracks();
0089     ///- PFTau specific content -
0090     /// method to store the leading candidate internally
0091     void embedLeadPFCand();
0092     /// method to store the leading charged hadron candidate internally
0093     void embedLeadPFChargedHadrCand();
0094     /// method to store the leading neutral candidate internally
0095     void embedLeadPFNeutralCand();
0096     /// method to store the signal candidates internally
0097     void embedSignalPFCands();
0098     /// method to store the signal charged hadrons candidates internally
0099     void embedSignalPFChargedHadrCands();
0100     /// method to store the signal neutral hadrons candidates internally
0101     void embedSignalPFNeutralHadrCands();
0102     /// method to store the signal gamma candidates internally
0103     void embedSignalPFGammaCands();
0104     /// method to store the isolation candidates internally
0105     void embedIsolationPFCands();
0106     /// method to store the isolation charged hadrons candidates internally
0107     void embedIsolationPFChargedHadrCands();
0108     /// method to store the isolation neutral hadrons candidates internally
0109     void embedIsolationPFNeutralHadrCands();
0110     /// method to store the isolation gamma candidates internally
0111     void embedIsolationPFGammaCands();
0112 
0113     // ---- matched GenJet methods ----
0114     /// return matched GenJet, built from the visible particles of a generated tau
0115     const reco::GenJet* genJet() const;
0116     /// set the matched GenJet
0117     void setGenJet(const reco::GenJetRef& ref);
0118 
0119     // ---- PFTau accessors (getters only) ----
0120     /// Returns true if this pat::Tau was made from a reco::PFTau
0121     bool isPFTau() const { return !pfSpecific_.empty(); }
0122     /// return PFTau info or throw exception 'not PFTau'
0123     const pat::tau::TauPFSpecific& pfSpecific() const;
0124     const pat::tau::TauPFEssential& pfEssential() const;
0125     /// Method copied from reco::PFTau.
0126     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0127     const reco::JetBaseRef& pfJetRef() const { return pfSpecific().pfJetRef_; }
0128     /// Method copied from reco::PFTau.
0129     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0130     reco::PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const;
0131     /// Method copied from reco::PFTau.
0132     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0133     const reco::PFCandidatePtr leadPFChargedHadrCand() const;
0134     /// Method copied from reco::PFTau.
0135     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0136     float leadPFChargedHadrCandsignedSipt() const { return pfSpecific().leadPFChargedHadrCandsignedSipt_; }
0137     /// Method copied from reco::PFTau.
0138     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0139     const reco::PFCandidatePtr leadPFNeutralCand() const;
0140     /// Method copied from reco::PFTau.
0141     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0142     const reco::PFCandidatePtr leadPFCand() const;
0143     /// Method copied from reco::PFTau.
0144     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0145     const std::vector<reco::PFCandidatePtr>& signalPFCands() const;
0146     /// Method copied from reco::PFTau.
0147     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0148     const std::vector<reco::PFCandidatePtr>& signalPFChargedHadrCands() const;
0149     /// Method copied from reco::PFTau.
0150     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0151     const std::vector<reco::PFCandidatePtr>& signalPFNeutrHadrCands() const;
0152     /// Method copied from reco::PFTau.
0153     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0154     const std::vector<reco::PFCandidatePtr>& signalPFGammaCands() const;
0155     /// Method copied from reco::PFTau.
0156     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0157     const std::vector<reco::PFRecoTauChargedHadron>& signalTauChargedHadronCandidates() const;
0158     /// Method copied from reco::PFTau.
0159     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0160     const std::vector<reco::RecoTauPiZero>& signalPiZeroCandidates() const;
0161     /// Method copied from reco::PFTau.
0162     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0163     const std::vector<reco::PFCandidatePtr>& isolationPFCands() const;
0164     /// Method copied from reco::PFTau.
0165     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0166     const std::vector<reco::PFCandidatePtr>& isolationPFChargedHadrCands() const;
0167     /// Method copied from reco::PFTau.
0168     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0169     const std::vector<reco::PFCandidatePtr>& isolationPFNeutrHadrCands() const;
0170     /// Method copied from reco::PFTau.
0171     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0172     const std::vector<reco::PFCandidatePtr>& isolationPFGammaCands() const;
0173     /// Method copied from reco::PFTau.
0174     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0175     const std::vector<reco::PFRecoTauChargedHadron>& isolationTauChargedHadronCandidates() const;
0176     /// Method copied from reco::PFTau.
0177     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0178     const std::vector<reco::RecoTauPiZero>& isolationPiZeroCandidates() const;
0179     /// Method copied from reco::PFTau.
0180     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0181     float isolationPFChargedHadrCandsPtSum() const { return pfSpecific().isolationPFChargedHadrCandsPtSum_; }
0182     /// Method copied from reco::PFTau.
0183     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0184     float isolationPFGammaCandsEtSum() const { return pfSpecific().isolationPFGammaCandsEtSum_; }
0185     /// Method copied from reco::PFTau.
0186     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0187     float maximumHCALPFClusterEt() const { return pfSpecific().maximumHCALPFClusterEt_; }
0188     /// Method copied from reco::PFTau.
0189     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0190     float emFraction() const { return pfSpecific().emFraction_; }
0191     /// Method copied from reco::PFTau.
0192     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0193     float hcalTotOverPLead() const { return pfSpecific().hcalTotOverPLead_; }
0194     /// Method copied from reco::PFTau.
0195     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0196     float hcalMaxOverPLead() const { return pfSpecific().hcalMaxOverPLead_; }
0197     /// Method copied from reco::PFTau.
0198     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0199     float hcal3x3OverPLead() const { return pfSpecific().hcal3x3OverPLead_; }
0200     /// Method copied from reco::PFTau.
0201     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0202     float ecalStripSumEOverPLead() const { return pfSpecific().ecalStripSumEOverPLead_; }
0203     /// Method copied from reco::PFTau.
0204     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0205     float bremsRecoveryEOverPLead() const { return pfSpecific().bremsRecoveryEOverPLead_; }
0206     /// Method copied from reco::PFTau.
0207     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0208     const reco::TrackRef& electronPreIDTrack() const { return pfSpecific().electronPreIDTrack_; }
0209     /// Method copied from reco::PFTau.
0210     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0211     float electronPreIDOutput() const { return pfSpecific().electronPreIDOutput_; }
0212     /// Method copied from reco::PFTau.
0213     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0214     bool electronPreIDDecision() const { return pfSpecific().electronPreIDDecision_; }
0215     /// Method copied from reco::PFTau.
0216     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0217     float caloComp() const { return pfSpecific().caloComp_; }
0218     /// Method copied from reco::PFTau.
0219     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0220     float segComp() const { return pfSpecific().segComp_; }
0221     /// Method copied from reco::PFTau.
0222     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0223     bool muonDecision() const { return pfSpecific().muonDecision_; }
0224 
0225     /// ----- Methods returning associated PFCandidates that work on PAT+AOD, PAT+embedding and miniAOD -----
0226     /// return the PFCandidate if available (reference or embedded), or the PackedPFCandidate on miniAOD
0227     const reco::CandidatePtr leadChargedHadrCand() const;
0228     /// return the PFCandidate if available (reference or embedded), or the PackedPFCandidate on miniAOD
0229     const reco::CandidatePtr leadNeutralCand() const;
0230     /// return the PFCandidate if available (reference or embedded), or the PackedPFCandidate on miniAOD
0231     const reco::CandidatePtr leadCand() const;
0232     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0233     /// note that the vector is returned by value.
0234     bool ExistSignalCands() const;
0235     bool ExistIsolationCands() const;
0236     reco::CandidatePtrVector signalCands() const;
0237     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0238     /// note that the vector is returned by value.
0239     reco::CandidatePtrVector signalChargedHadrCands() const;
0240     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0241     /// note that the vector is returned by value.
0242     reco::CandidatePtrVector signalNeutrHadrCands() const;
0243     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0244     /// note that the vector is returned by value.
0245     reco::CandidatePtrVector signalGammaCands() const;
0246     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0247     /// note that the vector is returned by value.
0248     reco::CandidatePtrVector isolationCands() const;
0249     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0250     /// note that the vector is returned by value.
0251     reco::CandidatePtrVector isolationChargedHadrCands() const;
0252     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0253     /// note that the vector is returned by value.
0254     reco::CandidatePtrVector isolationNeutrHadrCands() const;
0255     /// return the PFCandidates if available (reference or embedded), or the PackedPFCandidate on miniAOD
0256     /// note that the vector is returned by value.
0257     reco::CandidatePtrVector isolationGammaCands() const;
0258 
0259     /// return the PackedCandidates on miniAOD corresponding with tau "lost" tracks
0260     /// note that the vector is returned by value.
0261     std::vector<reco::CandidatePtr> signalLostTracks() const;
0262 
0263     /// setters for the PtrVectors (for miniAOD)
0264     void setSignalChargedHadrCands(const reco::CandidatePtrVector& ptrs) { signalChargedHadrCandPtrs_ = ptrs; }
0265     void setSignalNeutralHadrCands(const reco::CandidatePtrVector& ptrs) { signalNeutralHadrCandPtrs_ = ptrs; }
0266     void setSignalGammaCands(const reco::CandidatePtrVector& ptrs) { signalGammaCandPtrs_ = ptrs; }
0267     void setIsolationChargedHadrCands(const reco::CandidatePtrVector& ptrs) { isolationChargedHadrCandPtrs_ = ptrs; }
0268     void setIsolationNeutralHadrCands(const reco::CandidatePtrVector& ptrs) { isolationNeutralHadrCandPtrs_ = ptrs; }
0269     void setIsolationGammaCands(const reco::CandidatePtrVector& ptrs) { isolationGammaCandPtrs_ = ptrs; }
0270     void setSignalLostTracks(const std::vector<reco::CandidatePtr>& ptrs);
0271 
0272     /// ----- Top Projection business -------
0273     /// get the number of non-null PFCandidates
0274     size_t numberOfSourceCandidatePtrs() const override;
0275     /// get the source candidate pointer with index i
0276     reco::CandidatePtr sourceCandidatePtr(size_type i) const override;
0277 
0278     /// ---- Tau lifetime information ----
0279     /// Filled from PFTauTIPAssociation.
0280     /// Throws an exception if this pat::Tau was not made from a reco::PFTau
0281     const pat::tau::TauPFEssential::Point& dxy_PCA() const { return pfEssential().dxy_PCA_; }
0282     float dxy() const { return pfEssential().dxy_; }
0283     float dxy_error() const { return pfEssential().dxy_error_; }
0284     float dxy_Sig() const;
0285     const reco::VertexRef& primaryVertex() const { return pfEssential().pv_; }
0286     const pat::tau::TauPFEssential::Point& primaryVertexPos() const { return pfEssential().pvPos_; }
0287     const pat::tau::TauPFEssential::CovMatrix& primaryVertexCov() const { return pfEssential().pvCov_; }
0288     bool hasSecondaryVertex() const { return pfEssential().hasSV_; }
0289     const pat::tau::TauPFEssential::Vector& flightLength() const { return pfEssential().flightLength_; }
0290     float flightLengthSig() const { return pfEssential().flightLengthSig_; }
0291     pat::tau::TauPFEssential::CovMatrix flightLengthCov() const;
0292     const reco::VertexRef& secondaryVertex() const { return pfEssential().sv_; }
0293     const pat::tau::TauPFEssential::Point& secondaryVertexPos() const { return pfEssential().svPos_; }
0294     const pat::tau::TauPFEssential::CovMatrix& secondaryVertexCov() const { return pfEssential().svCov_; }
0295     float ip3d() const { return pfEssential().ip3d_; }
0296     float ip3d_error() const { return pfEssential().ip3d_error_; }
0297     float ip3d_Sig() const;
0298 
0299     /// ---- Information for MVA isolation ----
0300     /// Needed to recompute MVA isolation on MiniAOD
0301     /// return sum of ecal energies from signal candidates
0302     float ecalEnergy() const { return pfEssential().ecalEnergy_; }
0303     /// return sum of hcal energies from signal candidates
0304     float hcalEnergy() const { return pfEssential().hcalEnergy_; }
0305     /// return normalized chi2 of leading track
0306     float leadingTrackNormChi2() const { return pfEssential().leadingTrackNormChi2_; }
0307 
0308     /// ---- Information for anti-electron training ----
0309     /// Needed to recompute on MiniAOD
0310     /// return ecal energy from LeadChargedHadrCand
0311     float ecalEnergyLeadChargedHadrCand() const { return pfEssential().ecalEnergyLeadChargedHadrCand_; }
0312     /// return hcal energy from LeadChargedHadrCand
0313     float hcalEnergyLeadChargedHadrCand() const { return pfEssential().hcalEnergyLeadChargedHadrCand_; }
0314     /// return phiAtEcalEntrance
0315     float phiAtEcalEntrance() const { return pfEssential().phiAtEcalEntrance_; }
0316     /// return etaAtEcalEntrance
0317     float etaAtEcalEntrance() const { return pfEssential().etaAtEcalEntrance_; }
0318     /// return etaAtEcalEntrance from LeadChargedCand
0319     float etaAtEcalEntranceLeadChargedCand() const { return pfEssential().etaAtEcalEntranceLeadChargedCand_; }
0320     /// return pt from  LeadChargedCand
0321     float ptLeadChargedCand() const { return pfEssential().ptLeadChargedCand_; }
0322     /// return emFraction_MVA
0323     float emFraction_MVA() const { return pfEssential().emFraction_; }
0324 
0325     /// Methods copied from reco::Jet.
0326     /// (accessible from reco::PFTau via reco::PFTauTagInfo)
0327     reco::Candidate::LorentzVector p4Jet() const;
0328     float etaetaMoment() const;
0329     float phiphiMoment() const;
0330     float etaphiMoment() const;
0331 
0332     /// reconstructed tau decay mode (specific to PFTau)
0333     int decayMode() const { return pfEssential().decayMode_; }
0334     /// set decay mode
0335     void setDecayMode(int);
0336 
0337     // ---- methods for tau ID ----
0338     /// Returns a specific tau ID associated to the pat::Tau given its name
0339     /// For cut-based IDs, the value is 1.0 for good, 0.0 for bad.
0340     /// The names are defined within the configuration parameterset "tauIDSources"
0341     /// in PhysicsTools/PatAlgos/python/producersLayer1/tauProducer_cfi.py .
0342     /// Note: an exception is thrown if the specified ID is not available
0343     float tauID(const std::string& name) const;
0344     float tauID(const char* name) const { return tauID(std::string(name)); }
0345     /// Returns true if a specific ID is available in this pat::Tau
0346     bool isTauIDAvailable(const std::string& name) const;
0347     /// Returns all the tau IDs in the form of <name,value> pairs
0348     /// The 'default' ID is the first in the list
0349     const std::vector<IdPair>& tauIDs() const { return tauIDs_; }
0350     /// Store multiple tau ID values, discarding existing ones
0351     /// The first one in the list becomes the 'default' tau id
0352     void setTauIDs(const std::vector<IdPair>& ids) { tauIDs_ = ids; }
0353 
0354     /// pipe operator (introduced to use pat::Tau with PFTopProjectors)
0355     friend std::ostream& reco::operator<<(std::ostream& out, const Tau& obj);
0356 
0357     /// ---- methods for jet corrections ----
0358     /// returns the labels of all available sets of jet energy corrections
0359     const std::vector<std::string> availableJECSets() const;
0360     // returns the available JEC Levels for a given jecSet
0361     const std::vector<std::string> availableJECLevels(const int& set = 0) const;
0362     // returns the available JEC Levels for a given jecSet
0363     const std::vector<std::string> availableJECLevels(const std::string& set) const {
0364       return availableJECLevels(jecSet(set));
0365     };
0366     /// returns true if the jet carries jet energy correction information
0367     /// at all
0368     bool jecSetsAvailable() const { return !jec_.empty(); }
0369     /// returns true if the jet carries a set of jet energy correction
0370     /// factors with the given label
0371     bool jecSetAvailable(const std::string& set) const { return (jecSet(set) >= 0); };
0372     /// returns true if the jet carries a set of jet energy correction
0373     /// factors with the given label
0374     bool jecSetAvailable(const unsigned int& set) const { return (set < jec_.size()); };
0375     /// returns the label of the current set of jet energy corrections
0376     std::string currentJECSet() const {
0377       return currentJECSet_ < jec_.size() ? jec_.at(currentJECSet_).jecSet() : std::string("ERROR");
0378     }
0379     /// return the name of the current step of jet energy corrections
0380     std::string currentJECLevel() const {
0381       return currentJECSet_ < jec_.size() ? jec_.at(currentJECSet_).jecLevel(currentJECLevel_) : std::string("ERROR");
0382     }
0383     /// correction factor to the given level for a specific set
0384     /// of correction factors, starting from the current level
0385     float jecFactor(const std::string& level, const std::string& set = "") const;
0386     /// correction factor to the given level for a specific set
0387     /// of correction factors, starting from the current level
0388     float jecFactor(const unsigned int& level, const unsigned int& set = 0) const;
0389     /// copy of the jet corrected up to the given level for the set
0390     /// of jet energy correction factors, which is currently in use
0391     Tau correctedTauJet(const std::string& level, const std::string& set = "") const;
0392     /// copy of the jet corrected up to the given level for the set
0393     /// of jet energy correction factors, which is currently in use
0394     Tau correctedTauJet(const unsigned int& level, const unsigned int& set = 0) const;
0395     /// p4 of the jet corrected up to the given level for the set
0396     /// of jet energy correction factors, which is currently in use
0397     const LorentzVector& correctedP4(const std::string& level, const std::string& set = "") const {
0398       return correctedTauJet(level, set).p4();
0399     }
0400     /// p4 of the jet corrected up to the given level for the set
0401     /// of jet energy correction factors, which is currently in use
0402     const LorentzVector& correctedP4(const unsigned int& level, const unsigned int& set = 0) const {
0403       return correctedTauJet(level, set).p4();
0404     }
0405 
0406     friend class PATTauSlimmer;
0407 
0408   protected:
0409     /// index of the set of jec factors with given label; returns -1 if no set
0410     /// of jec factors exists with the given label
0411     int jecSet(const std::string& label) const;
0412     /// update the current JEC set; used by correctedJet
0413     void currentJECSet(const unsigned int& set) { currentJECSet_ = set; };
0414     /// update the current JEC level; used by correctedJet
0415     void currentJECLevel(const unsigned int& level) { currentJECLevel_ = level; };
0416     /// add more sets of energy correction factors
0417     void addJECFactors(const TauJetCorrFactors& jec) { jec_.push_back(jec); };
0418     /// initialize the jet to a given JEC level during creation starting from Uncorrected
0419     void initializeJEC(unsigned int level, const unsigned int set = 0);
0420 
0421   private:
0422     /// helper to avoid code duplication in constructors
0423     void initFromBaseTau(const reco::BaseTau& aTau);
0424     // ---- for content embedding ----
0425     bool embeddedIsolationTracks_;
0426     std::vector<reco::Track> isolationTracks_;
0427     edm::AtomicPtrCache<reco::TrackRefVector> isolationTracksTransientRefVector_;
0428     bool embeddedLeadTrack_;
0429     std::vector<reco::Track> leadTrack_;
0430     bool embeddedSignalTracks_;
0431     std::vector<reco::Track> signalTracks_;
0432     edm::AtomicPtrCache<reco::TrackRefVector> signalTracksTransientRefVector_;
0433     // specific for PFTau
0434     std::vector<reco::PFCandidate> leadPFCand_;
0435     bool embeddedLeadPFCand_;
0436     std::vector<reco::PFCandidate> leadPFChargedHadrCand_;
0437     bool embeddedLeadPFChargedHadrCand_;
0438     std::vector<reco::PFCandidate> leadPFNeutralCand_;
0439     bool embeddedLeadPFNeutralCand_;
0440 
0441     std::vector<reco::PFCandidate> signalPFCands_;
0442     bool embeddedSignalPFCands_;
0443     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > signalPFCandsTransientPtrs_;
0444     std::vector<reco::PFCandidate> signalPFChargedHadrCands_;
0445     bool embeddedSignalPFChargedHadrCands_;
0446     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > signalPFChargedHadrCandsTransientPtrs_;
0447     std::vector<reco::PFCandidate> signalPFNeutralHadrCands_;
0448     bool embeddedSignalPFNeutralHadrCands_;
0449     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > signalPFNeutralHadrCandsTransientPtrs_;
0450     std::vector<reco::PFCandidate> signalPFGammaCands_;
0451     bool embeddedSignalPFGammaCands_;
0452     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > signalPFGammaCandsTransientPtrs_;
0453     std::vector<reco::PFCandidate> isolationPFCands_;
0454     bool embeddedIsolationPFCands_;
0455     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > isolationPFCandsTransientPtrs_;
0456     std::vector<reco::PFCandidate> isolationPFChargedHadrCands_;
0457     bool embeddedIsolationPFChargedHadrCands_;
0458     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > isolationPFChargedHadrCandsTransientPtrs_;
0459     std::vector<reco::PFCandidate> isolationPFNeutralHadrCands_;
0460     bool embeddedIsolationPFNeutralHadrCands_;
0461     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > isolationPFNeutralHadrCandsTransientPtrs_;
0462     std::vector<reco::PFCandidate> isolationPFGammaCands_;
0463     bool embeddedIsolationPFGammaCands_;
0464     edm::AtomicPtrCache<std::vector<reco::PFCandidatePtr> > isolationPFGammaCandsTransientPtrs_;
0465 
0466     // ---- matched GenJet holder ----
0467     std::vector<reco::GenJet> genJet_;
0468 
0469     // ---- tau ID's holder ----
0470     std::vector<IdPair> tauIDs_;
0471 
0472     // ---- PFTau specific variables  ----
0473     /// holder for PFTau info, or empty vector if CaloTau
0474     std::vector<pat::tau::TauPFSpecific> pfSpecific_;
0475 
0476     // ---- energy scale correction factors ----
0477     // energy scale correction factors; the string carries a potential label if
0478     // more then one set of correction factors is embedded. The label corresponds
0479     // to the label of the jetCorrFactors module that has been embedded.
0480     std::vector<pat::TauJetCorrFactors> jec_;
0481     // currently applied set of jet energy correction factors (i.e. the index in
0482     // jetEnergyCorrections_)
0483     unsigned int currentJECSet_;
0484     // currently applied jet energy correction level
0485     unsigned int currentJECLevel_;
0486 
0487     // ---- references to packed pf candidates -----
0488     reco::CandidatePtrVector signalChargedHadrCandPtrs_;
0489     reco::CandidatePtrVector signalNeutralHadrCandPtrs_;
0490     reco::CandidatePtrVector signalGammaCandPtrs_;
0491 
0492     reco::CandidatePtrVector isolationChargedHadrCandPtrs_;
0493     reco::CandidatePtrVector isolationNeutralHadrCandPtrs_;
0494     reco::CandidatePtrVector isolationGammaCandPtrs_;
0495 
0496     // -- essential info to keep
0497 
0498     std::vector<pat::tau::TauPFEssential> pfEssential_;
0499   };
0500 }  // namespace pat
0501 
0502 #endif