Go to the documentation of this file.00001
00016 #include <TopQuarkAnalysis/TopHitFit/interface/JetTranslatorBase.h>
00017 #include <DataFormats/PatCandidates/interface/Jet.h>
00018
00019 namespace hitfit {
00020
00021
00022 template<>
00023 JetTranslatorBase<pat::Jet>::JetTranslatorBase()
00024 {
00025
00026 std::string CMSSW_BASE(getenv("CMSSW_BASE"));
00027 std::string resolution_filename = CMSSW_BASE +
00028 std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
00029 udscResolution_ = EtaDepResolution(resolution_filename);
00030 bResolution_ = EtaDepResolution(resolution_filename);
00031 jetCorrectionLevel_ = "L7Parton";
00032 jes_ = 1.0;
00033 jesB_ = 1.0;
00034
00035 }
00036
00037
00038 template<>
00039 JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& udscFile,
00040 const std::string& bFile)
00041 {
00042
00043 std::string CMSSW_BASE(getenv("CMSSW_BASE"));
00044 std::string udscResolution_filename;
00045 std::string bResolution_filename;
00046
00047 if (udscFile.empty()) {
00048 udscResolution_filename = CMSSW_BASE +
00049 std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
00050 } else {
00051 udscResolution_filename = udscFile;
00052 }
00053
00054 if (bFile.empty()) {
00055 bResolution_filename = CMSSW_BASE +
00056 std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
00057 } else {
00058 bResolution_filename = bFile;
00059 }
00060
00061 udscResolution_ = EtaDepResolution(udscResolution_filename);
00062 bResolution_ = EtaDepResolution(bResolution_filename);
00063 jetCorrectionLevel_ = "L7Parton";
00064 jes_ = 1.0;
00065 jesB_ = 1.0;
00066
00067 }
00068
00069
00070 template<>
00071 JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& udscFile,
00072 const std::string& bFile,
00073 const std::string& jetCorrectionLevel,
00074 double jes,
00075 double jesB)
00076 {
00077
00078 std::string CMSSW_BASE(getenv("CMSSW_BASE"));
00079 std::string udscResolution_filename;
00080 std::string bResolution_filename;
00081
00082 if (udscFile.empty()) {
00083 udscResolution_filename = CMSSW_BASE +
00084 std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt");
00085 } else {
00086 udscResolution_filename = udscFile;
00087 }
00088
00089 if (bFile.empty()) {
00090 bResolution_filename = CMSSW_BASE +
00091 std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt");
00092 } else {
00093 bResolution_filename = bFile;
00094 }
00095
00096 udscResolution_ = EtaDepResolution(udscResolution_filename);
00097 bResolution_ = EtaDepResolution(bResolution_filename);
00098 jetCorrectionLevel_ = jetCorrectionLevel;
00099 jes_ = jes;
00100 jesB_ = jesB;
00101
00102 }
00103
00104
00105 template<>
00106 JetTranslatorBase<pat::Jet>::~JetTranslatorBase()
00107 {
00108 }
00109
00110
00111 template<>
00112 Lepjets_Event_Jet
00113 JetTranslatorBase<pat::Jet>::operator()(const pat::Jet& jet,
00114 int type ,
00115 bool useObjEmbRes )
00116 {
00117
00118 Fourvec p;
00119
00120 double jet_eta = jet.eta();
00121
00122 if (jet.isCaloJet()) {
00123 jet_eta = ((reco::CaloJet*) jet.originalObject())->detectorP4().eta();
00124 }
00125 if (jet.isPFJet()) {
00126
00127 }
00128
00129 Vector_Resolution jet_resolution;
00130
00131 if (type == hitfit::hadb_label || type == hitfit::lepb_label || type == hitfit::higgs_label) {
00132 jet_resolution = bResolution_.GetResolution(jet_eta);
00133 pat::Jet bPartonCorrJet(jet.correctedJet(jetCorrectionLevel_,"BOTTOM"));
00134 bPartonCorrJet.scaleEnergy(jesB_);
00135 p = Fourvec(bPartonCorrJet.px(),bPartonCorrJet.py(),bPartonCorrJet.pz(),bPartonCorrJet.energy());
00136
00137 } else {
00138 jet_resolution = udscResolution_.GetResolution(jet_eta);
00139 pat::Jet udsPartonCorrJet(jet.correctedJet(jetCorrectionLevel_,"UDS"));
00140 udsPartonCorrJet.scaleEnergy(jes_);
00141 p = Fourvec(udsPartonCorrJet.px(),udsPartonCorrJet.py(),udsPartonCorrJet.pz(),udsPartonCorrJet.energy());
00142 }
00143
00144
00145
00146 Lepjets_Event_Jet retjet(p,
00147 type,
00148 jet_resolution);
00149 return retjet;
00150
00151 }
00152
00153
00154 template<>
00155 const EtaDepResolution&
00156 JetTranslatorBase<pat::Jet>::udscResolution() const
00157 {
00158 return udscResolution_;
00159 }
00160
00161
00162 template<>
00163 const EtaDepResolution&
00164 JetTranslatorBase<pat::Jet>::bResolution() const
00165 {
00166 return bResolution_;
00167 }
00168
00169
00170 template<>
00171 bool
00172 JetTranslatorBase<pat::Jet>::CheckEta(const pat::Jet& jet) const
00173 {
00174 double jet_eta = jet.eta();
00175
00176 if (jet.isCaloJet()) {
00177 jet_eta = ((reco::CaloJet*) jet.originalObject())->detectorP4().eta();
00178 }
00179 if (jet.isPFJet()) {
00180
00181 }
00182 return bResolution_.CheckEta(jet_eta) && udscResolution_.CheckEta(jet_eta);
00183 }
00184
00185
00186
00187
00188 }