Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DataFormats_PatCandidates_TauJetCorrFactors_h
0002 #define DataFormats_PatCandidates_TauJetCorrFactors_h
0003 
0004 /**
0005    \class    pat::TauCorrFactors TauCorrFactors.h "DataFormats/PatCandidates/interface/TauCorrFactors.h"
0006    \brief    Class for the storage of tau-jet energy correction factors
0007    
0008    Class for the storage of tau-jet energy correction factors that have been calculated during pat tuple production. 
0009    The class is created to deal with a flexible number and order of the JES correction factors, which are 
0010    expected to be nested. I.e. each correction level implies that all previous correction have been applied 
0011    in advance. This scheme corresponds to the jet energy correction scheme propagated by the JetMET PAG.
0012    In dividual levels of JEC are safed as CorrectionFactor, which is a 
0013 
0014    std::pair<std::string, float>. 
0015 
0016    The std::string contains a human readable label indicating the corection level, the float
0017    contains the JEC factor.
0018    
0019    To move from one correction 
0020    level to another correction level the initial correction level of the jet need to be uncorrected before
0021    applying the final correction factor. The class is expected to be used from within the pat::Tau only, 
0022    this is taken care of automatically. 
0023 */
0024 
0025 #include <vector>
0026 #include <string>
0027 #include <cmath>
0028 
0029 namespace pat {
0030 
0031   class TauJetCorrFactors {
0032   public:
0033     // tau-jet energy correction factor.
0034     // the std::string indicates the correction level according to jetMET definitions.
0035     typedef std::pair<std::string, float> CorrectionFactor;
0036 
0037   public:
0038     // default Constructor
0039     TauJetCorrFactors(){};
0040     // constructor by value
0041     TauJetCorrFactors(const std::string& label, const std::vector<CorrectionFactor>& jec);
0042 
0043     // instance label of the jet energy corrections set
0044     std::string jecSet() const { return label_; }
0045     // correction level from unsigned int
0046     std::string jecLevel(const unsigned int& level) const { return jec_.at(level).first; };
0047     // correction level from std::string
0048     int jecLevel(const std::string& level) const;
0049 
0050     // correction factor up to a given level
0051     float correction(unsigned int level) const;
0052     // a list of the labels of all correction levels according to jetMET definitions, separated by '\n'
0053     std::string correctionLabelString() const;
0054     // a vector of the labels of all correction levels according to jetMET definitions
0055     std::vector<std::string> correctionLabels() const;
0056     // label of a specific correction factor according to jetMET definitions; for overflow a string ERROR is returned
0057     std::string correctionLabel(unsigned int level) const {
0058       return (level < jec_.size() ? jec_.at(level).first : std::string("ERROR"));
0059     };
0060     // number of available correction factors
0061     unsigned int numberOfCorrectionLevels() const { return jec_.size(); };
0062     // print function for debugging
0063     void print() const;
0064 
0065   private:
0066     // instance label of jet energy correction factors
0067     std::string label_;
0068     // vector of CorrectionFactors. NOTE: the correction factors are expected to appear
0069     // nested; they may appear in arbitary number and order according to the configuration
0070     // of the jetCorrFactors module.
0071     std::vector<CorrectionFactor> jec_;
0072   };
0073 }  // namespace pat
0074 
0075 #endif