CMS 3D CMS Logo

Public Member Functions | Private Attributes

hitfit::JetTranslatorBase< AJet > Class Template Reference

Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet object. Users need to write an implementation of a template specialization of this class for their jet physics object class. Then users combine this header file and their implementation for their analysis code. With this approach, it is possible to use HitFit for different jet physics object class in different experiments. More...

#include <JetTranslatorBase.h>

List of all members.

Public Member Functions

const EtaDepResolutionbResolution () const
 Return the $ \eta- $ dependent resolution for $b$ jets.
template<>
const EtaDepResolutionbResolution () const
template<>
const EtaDepResolutionbResolution () const
bool CheckEta (const AJet &jet) const
 Check if a jet has $ \eta $ value which is within the valid $ \eta $ range of the resolution.
template<>
bool CheckEta (const pat::Jet &jet) const
template<>
bool CheckEta (const CLHEP::HepLorentzVector &jet) const
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile, const std::string &jetCorrectionLevel, double jes, double jesB)
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
 Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.
template<>
 JetTranslatorBase ()
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
template<>
 JetTranslatorBase ()
template<>
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile)
 JetTranslatorBase (const std::string &udscFile, const std::string &bFile, const std::string &jetCorrectionLevel, double jes, double jesB)
 Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.
 JetTranslatorBase ()
 Default constructor.
template<>
Lepjets_Event_Jet operator() (const pat::Jet &jet, int type, bool useObjEmbRes)
Lepjets_Event_Jet operator() (const AJet &jet, int type=hitfit::unknown_label, bool useObjEmbRes=false)
 Convert a jet physics object of type AJet into HitFit jet physics object of type Lepjets_Event_Jet. This operator must be able to apply the appropriate jet energy correction in accord with the type of the jet.
template<>
Lepjets_Event_Jet operator() (const CLHEP::HepLorentzVector &jet, int type, bool useObjEmbRes)
const EtaDepResolutionudscResolution () const
 Return the $ \eta- $ dependent resolution for $udsc$ jets.
template<>
const EtaDepResolutionudscResolution () const
template<>
const EtaDepResolutionudscResolution () const
 ~JetTranslatorBase ()
 Destructor.
template<>
 ~JetTranslatorBase ()
template<>
 ~JetTranslatorBase ()

Private Attributes

EtaDepResolution bResolution_
 The $ \eta- $ dependent resolution for $b$ jets.
double jes_
 The jet energy scale.
double jesB_
 The b-jet energy scale.
std::string jetCorrectionLevel_
 The jet correction level.
EtaDepResolution udscResolution_
 The $ \eta- $ dependent resolution for $udsc$ jets.

Detailed Description

template<class AJet>
class hitfit::JetTranslatorBase< AJet >

Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet object. Users need to write an implementation of a template specialization of this class for their jet physics object class. Then users combine this header file and their implementation for their analysis code. With this approach, it is possible to use HitFit for different jet physics object class in different experiments.

Parameters:
AJetThe typename of the jet physics object class to be translated into HitFit's Lepjets_Event_Jet.

Definition at line 46 of file JetTranslatorBase.h.


Constructor & Destructor Documentation

template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( )

Default constructor.

template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.

Parameters:
udscFileThe path of the input file containing resolution for $udsc$ jets.
bFileThe path of the input file containing resolution for $b$ jets.
template<class AJet>
hitfit::JetTranslatorBase< AJet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile,
const std::string &  jetCorrectionLevel,
double  jes,
double  jesB 
)

Constructor, instantiate a JetTranslatorBase object using the names of input files in std::string format.

Parameters:
udscFileThe path of the input file containing resolution for $udsc$ jets.
bFileThe path of the input file containing resolution for $b$ jets.
jetCorrectionLevelThe jet correction level.
jesThe jet energy scale.
jesBThe b-jet energy scale.
template<class AJet>
hitfit::JetTranslatorBase< AJet >::~JetTranslatorBase ( )

Destructor.

template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::JetTranslatorBase ( )

Definition at line 103 of file CLHEPHitFitTranslator.cc.

{

    std::string CMSSW_BASE(getenv("CMSSW_BASE"));
    std::string udsc_resolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
    std::string b_resolution_filename = udsc_resolution_filename;

    udscResolution_ = EtaDepResolution(udsc_resolution_filename);
    bResolution_    = EtaDepResolution(b_resolution_filename);

} // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase()
template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 118 of file CLHEPHitFitTranslator.cc.

{

    std::string CMSSW_BASE(getenv("CMSSW_BASE"));
    std::string udsc_resolution_filename;
    std::string b_resolution_filename;

    if (udscFile.empty()) {
        udsc_resolution_filename = CMSSW_BASE +
            std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
    } else {
        udsc_resolution_filename = udscFile;
    }

    if (bFile.empty()) {
        b_resolution_filename = CMSSW_BASE +
            std::string("/src/TopQuarkAnalysis/TopHitFit/data/exampleJetResolution.txt");
    } else {
        b_resolution_filename = bFile;
    }

    udscResolution_ = EtaDepResolution(udsc_resolution_filename);
    bResolution_    = EtaDepResolution(b_resolution_filename);

} // JetTranslatorBase<CLHEP::HepLorentzVector>::JetTranslatorBase(const std::string& udscFile,const std::string& bFile)
template<>
hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::~JetTranslatorBase ( )

Definition at line 147 of file CLHEPHitFitTranslator.cc.

{
} // JetTranslatorBase<CLHEP::HepLorentzVector>::~JetTranslatorBase()

Definition at line 23 of file PatJetHitFitTranslator.cc.

{

    std::string CMSSW_BASE(getenv("CMSSW_BASE"));
    std::string resolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
    udscResolution_ = EtaDepResolution(resolution_filename);
    bResolution_    = EtaDepResolution(resolution_filename);
    jetCorrectionLevel_ = "L7Parton";
    jes_            = 1.0;
    jesB_           = 1.0;

} // JetTranslatorBase<pat::Jet>::JetTranslatorBase()
template<>
hitfit::JetTranslatorBase< pat::Jet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile 
)

Definition at line 39 of file PatJetHitFitTranslator.cc.

{

    std::string CMSSW_BASE(getenv("CMSSW_BASE"));
    std::string udscResolution_filename;
    std::string bResolution_filename;

    if (udscFile.empty()) {
        udscResolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
    } else {
        udscResolution_filename = udscFile;
    }

    if (bFile.empty()) {
        bResolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
    } else {
        bResolution_filename = bFile;
    }

    udscResolution_ = EtaDepResolution(udscResolution_filename);
    bResolution_    = EtaDepResolution(bResolution_filename);
    jetCorrectionLevel_ = "L7Parton";
    jes_            = 1.0;
    jesB_           = 1.0;

} // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
template<>
hitfit::JetTranslatorBase< pat::Jet >::JetTranslatorBase ( const std::string &  udscFile,
const std::string &  bFile,
const std::string &  jetCorrectionLevel,
double  jes,
double  jesB 
)

Definition at line 71 of file PatJetHitFitTranslator.cc.

{

    std::string CMSSW_BASE(getenv("CMSSW_BASE"));
    std::string udscResolution_filename;
    std::string bResolution_filename;

    if (udscFile.empty()) {
        udscResolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt");
    } else {
        udscResolution_filename = udscFile;
    }

    if (bFile.empty()) {
        bResolution_filename = CMSSW_BASE +
        std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt");
    } else {
        bResolution_filename = bFile;
    }

    udscResolution_ = EtaDepResolution(udscResolution_filename);
    bResolution_    = EtaDepResolution(bResolution_filename);
    jetCorrectionLevel_ = jetCorrectionLevel;
    jes_            = jes;
    jesB_           = jesB;

} // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)

Definition at line 106 of file PatJetHitFitTranslator.cc.

{
} // JetTranslatorBase<pat::Jet>::~JetTranslatorBase()

Member Function Documentation

template<class AJet>
const EtaDepResolution& hitfit::JetTranslatorBase< AJet >::bResolution ( ) const

Return the $ \eta- $ dependent resolution for $b$ jets.

template<>
const EtaDepResolution & hitfit::JetTranslatorBase< pat::Jet >::bResolution ( ) const

Definition at line 164 of file PatJetHitFitTranslator.cc.

{
    return bResolution_;
}
template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::bResolution ( ) const

Definition at line 188 of file CLHEPHitFitTranslator.cc.

{
    return bResolution_;
}
template<>
bool hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::CheckEta ( const CLHEP::HepLorentzVector &  jet) const

Definition at line 196 of file CLHEPHitFitTranslator.cc.

{
    return udscResolution_.CheckEta(jet.eta()) && bResolution_.CheckEta(jet.eta());
}
template<class AJet>
bool hitfit::JetTranslatorBase< AJet >::CheckEta ( const AJet &  jet) const

Check if a jet has $ \eta $ value which is within the valid $ \eta $ range of the resolution.

Parameters:
jetThe jet whose $ \eta $ value is to be checked.
template<>
bool hitfit::JetTranslatorBase< pat::Jet >::CheckEta ( const pat::Jet jet) const

Definition at line 172 of file PatJetHitFitTranslator.cc.

References reco::LeafCandidate::eta(), pat::Jet::isCaloJet(), pat::Jet::isPFJet(), and pat::PATObject< ObjectType >::originalObject().

{
    double            jet_eta        = jet.eta();

    if (jet.isCaloJet()) {
        jet_eta = ((reco::CaloJet*) jet.originalObject())->detectorP4().eta();
    }
    if (jet.isPFJet()) {
        // do nothing at the moment!
    }
    return bResolution_.CheckEta(jet_eta) && udscResolution_.CheckEta(jet_eta);
}
template<class AJet>
Lepjets_Event_Jet hitfit::JetTranslatorBase< AJet >::operator() ( const AJet &  jet,
int  type = hitfit::unknown_label,
bool  useObjEmbRes = false 
)

Convert a jet physics object of type AJet into HitFit jet physics object of type Lepjets_Event_Jet. This operator must be able to apply the appropriate jet energy correction in accord with the type of the jet.

Parameters:
jetThe jet physics object to be translated.
typeThe typecode of the jet to be translated (leptonic b, hadronic b, or hadronic W).
useObjEmbResBoolean parameter to indicate if the user would like to use the resolution embedded in the object, and not the resolution read when instantiating the class.
template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< pat::Jet >::operator() ( const pat::Jet jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 113 of file PatJetHitFitTranslator.cc.

References pat::Jet::correctedJet(), reco::LeafCandidate::eta(), hitfit::hadb_label, hitfit::higgs_label, pat::Jet::isCaloJet(), pat::Jet::isPFJet(), hitfit::lepb_label, pat::PATObject< ObjectType >::originalObject(), AlCaHLTBitMon_ParallelJobs::p, and reco::Jet::scaleEnergy().

{

    Fourvec p;

    double            jet_eta        = jet.eta();

    if (jet.isCaloJet()) {
        jet_eta = ((reco::CaloJet*) jet.originalObject())->detectorP4().eta();
    }
    if (jet.isPFJet()) {
        // do nothing at the moment!
    }

    Vector_Resolution jet_resolution;

    if (type == hitfit::hadb_label || type == hitfit::lepb_label || type == hitfit::higgs_label) {
        jet_resolution = bResolution_.GetResolution(jet_eta);
        pat::Jet bPartonCorrJet(jet.correctedJet(jetCorrectionLevel_,"BOTTOM"));
        bPartonCorrJet.scaleEnergy(jesB_);
        p = Fourvec(bPartonCorrJet.px(),bPartonCorrJet.py(),bPartonCorrJet.pz(),bPartonCorrJet.energy());

    } else {
        jet_resolution = udscResolution_.GetResolution(jet_eta);
        pat::Jet udsPartonCorrJet(jet.correctedJet(jetCorrectionLevel_,"UDS"));
        udsPartonCorrJet.scaleEnergy(jes_);
        p = Fourvec(udsPartonCorrJet.px(),udsPartonCorrJet.py(),udsPartonCorrJet.pz(),udsPartonCorrJet.energy());
    }



    Lepjets_Event_Jet retjet(p,
                             type,
                             jet_resolution);
    return retjet;

} // Lepjets_Event_Jet JetTranslatorBase<pat::Jet>::operator()(const pat::Jet& j,int type)
template<>
Lepjets_Event_Jet hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::operator() ( const CLHEP::HepLorentzVector &  jet,
int  type,
bool  useObjEmbRes 
)

Definition at line 154 of file CLHEPHitFitTranslator.cc.

References hitfit::hadb_label, hitfit::higgs_label, hitfit::lepb_label, and AlCaHLTBitMon_ParallelJobs::p.

{

    Fourvec p(jet.px(),jet.py(),jet.pz(),jet.e());

    double            jet_eta        = jet.eta();
    Vector_Resolution jet_resolution;

    if (type == hitfit::lepb_label||type == hitfit::hadb_label||type== hitfit::higgs_label) {
        jet_resolution = bResolution_.GetResolution(jet_eta);
    } else {
        jet_resolution = udscResolution_.GetResolution(jet_eta);
    }

    Lepjets_Event_Jet retjet(p,
                             type,
                             jet_resolution);
    return retjet;

} // Lepjets_Event_Jet JetTranslatorBase<CLHEP::HepLorentzVector>::operator()(const CLHEP::HepLorentzVector& j,int type)
template<>
const EtaDepResolution & hitfit::JetTranslatorBase< CLHEP::HepLorentzVector >::udscResolution ( ) const

Definition at line 180 of file CLHEPHitFitTranslator.cc.

{
    return udscResolution_;
}
template<>
const EtaDepResolution & hitfit::JetTranslatorBase< pat::Jet >::udscResolution ( ) const

Definition at line 156 of file PatJetHitFitTranslator.cc.

{
    return udscResolution_;
}
template<class AJet>
const EtaDepResolution& hitfit::JetTranslatorBase< AJet >::udscResolution ( ) const

Return the $ \eta- $ dependent resolution for $udsc$ jets.


Member Data Documentation

template<class AJet>
EtaDepResolution hitfit::JetTranslatorBase< AJet >::bResolution_ [private]

The $ \eta- $ dependent resolution for $b$ jets.

Definition at line 147 of file JetTranslatorBase.h.

template<class AJet>
double hitfit::JetTranslatorBase< AJet >::jes_ [private]

The jet energy scale.

Definition at line 157 of file JetTranslatorBase.h.

template<class AJet>
double hitfit::JetTranslatorBase< AJet >::jesB_ [private]

The b-jet energy scale.

Definition at line 162 of file JetTranslatorBase.h.

template<class AJet>
std::string hitfit::JetTranslatorBase< AJet >::jetCorrectionLevel_ [private]

The jet correction level.

Definition at line 152 of file JetTranslatorBase.h.

template<class AJet>
EtaDepResolution hitfit::JetTranslatorBase< AJet >::udscResolution_ [private]

The $ \eta- $ dependent resolution for $udsc$ jets.

Definition at line 142 of file JetTranslatorBase.h.