CMS 3D CMS Logo

PatJetHitFitTranslator.cc
Go to the documentation of this file.
1 
17 
18 namespace hitfit {
19 
20  template <>
22  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
23  std::string resolution_filename =
24  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
25  udscResolution_ = EtaDepResolution(resolution_filename);
26  bResolution_ = EtaDepResolution(resolution_filename);
27  jetCorrectionLevel_ = "L7Parton";
28  jes_ = 1.0;
29  jesB_ = 1.0;
30 
31  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase()
32 
33  template <>
35  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
36  std::string udscResolution_filename;
37  std::string bResolution_filename;
38 
39  if (udscFile.empty()) {
40  udscResolution_filename =
41  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
42  } else {
43  udscResolution_filename = udscFile;
44  }
45 
46  if (bFile.empty()) {
47  bResolution_filename = CMSSW_BASE + std::string("/src/TopQuarkAnalysis/PatHitFit/data/exampleJetResolution.txt");
48  } else {
49  bResolution_filename = bFile;
50  }
51 
52  udscResolution_ = EtaDepResolution(udscResolution_filename);
53  bResolution_ = EtaDepResolution(bResolution_filename);
54  jetCorrectionLevel_ = "L7Parton";
55  jes_ = 1.0;
56  jesB_ = 1.0;
57 
58  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
59 
60  template <>
62  const std::string& bFile,
64  double jes,
65  double jesB) {
66  std::string CMSSW_BASE(std::getenv("CMSSW_BASE"));
67  std::string udscResolution_filename;
68  std::string bResolution_filename;
69 
70  if (udscFile.empty()) {
71  udscResolution_filename =
72  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafUdscJetResolution.txt");
73  } else {
74  udscResolution_filename = udscFile;
75  }
76 
77  if (bFile.empty()) {
78  bResolution_filename =
79  CMSSW_BASE + std::string("/src/TopQuarkAnalysis/TopHitFit/data/resolution/tqafBJetResolution.txt");
80  } else {
81  bResolution_filename = bFile;
82  }
83 
84  udscResolution_ = EtaDepResolution(udscResolution_filename);
85  bResolution_ = EtaDepResolution(bResolution_filename);
86  jetCorrectionLevel_ = jetCorrectionLevel;
87  jes_ = jes;
88  jesB_ = jesB;
89 
90  } // JetTranslatorBase<pat::Jet>::JetTranslatorBase(const std::string& ifile)
91 
92  template <>
93  JetTranslatorBase<pat::Jet>::~JetTranslatorBase() {} // JetTranslatorBase<pat::Jet>::~JetTranslatorBase()
94 
95  template <>
97  int type /*= hitfit::unknown_label */,
98  bool useObjEmbRes /* = false */) {
99  Fourvec p;
100 
101  double jet_eta = jet.eta();
102 
103  if (jet.isCaloJet()) {
104  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
105  }
106  if (jet.isPFJet()) {
107  // do nothing at the moment!
108  }
109 
110  Vector_Resolution jet_resolution;
111 
113  jet_resolution = bResolution_.GetResolution(jet_eta);
114  pat::Jet bPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "BOTTOM"));
115  bPartonCorrJet.scaleEnergy(jesB_);
116  p = Fourvec(bPartonCorrJet.px(), bPartonCorrJet.py(), bPartonCorrJet.pz(), bPartonCorrJet.energy());
117 
118  } else {
119  jet_resolution = udscResolution_.GetResolution(jet_eta);
120  pat::Jet udsPartonCorrJet(jet.correctedJet(jetCorrectionLevel_, "UDS"));
121  udsPartonCorrJet.scaleEnergy(jes_);
122  p = Fourvec(udsPartonCorrJet.px(), udsPartonCorrJet.py(), udsPartonCorrJet.pz(), udsPartonCorrJet.energy());
123  }
124 
125  Lepjets_Event_Jet retjet(p, type, jet_resolution);
126  return retjet;
127 
128  } // Lepjets_Event_Jet JetTranslatorBase<pat::Jet>::operator()(const pat::Jet& j,int type)
129 
130  template <>
132  return udscResolution_;
133  }
134 
135  template <>
137  return bResolution_;
138  }
139 
140  template <>
142  double jet_eta = jet.eta();
143 
144  if (jet.isCaloJet()) {
145  jet_eta = static_cast<const reco::CaloJet*>(jet.originalObject())->detectorP4().eta();
146  }
147  if (jet.isPFJet()) {
148  // do nothing at the moment!
149  }
150  return bResolution_.CheckEta(jet_eta) && udscResolution_.CheckEta(jet_eta);
151  }
152 
153  //
154 
155 } // namespace hitfit
TtSemiLepHitFitProducer_Electrons_cfi.jes
jes
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:48
hitfit
Definition: Base_Constrainer.h:43
hitfit::Fourvec
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
hitfit::hadb_label
Definition: Lepjets_Event_Jet.h:57
hitfit::lepb_label
Definition: Lepjets_Event_Jet.h:56
hitfit::Vector_Resolution
Definition: Vector_Resolution.h:89
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
hitfit::EtaDepResolution
Hold on to -dependent resolution. This class acts as a function object and returns Vector_Resolution ...
Definition: EtaDepResolution.h:86
TkMap_script_phase1.CMSSW_BASE
CMSSW_BASE
Definition: TkMap_script_phase1.py:158
pat::Jet
Analysis-level calorimeter jet class.
Definition: Jet.h:77
pat::Jet::scaleEnergy
void scaleEnergy(double fScale) override
Scale energy and correspondingly adjust raw jec factors.
Definition: Jet.h:177
hitfit::Lepjets_Event_Jet
A class to represent a jet in an instance of Lepjets_Event class. The class is derived from the Lepje...
Definition: Lepjets_Event_Jet.h:76
TtSemiLepHitFitProducer_Electrons_cfi.jetCorrectionLevel
jetCorrectionLevel
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:43
TtSemiLepHitFitProducer_Electrons_cfi.jesB
jesB
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:49
JetTranslatorBase.h
Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet objec...
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hitfit::JetTranslatorBase::JetTranslatorBase
JetTranslatorBase()
Default constructor.
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
Jet.h
hitfit::JetTranslatorBase
Template class of function object to translate jet physics object to HitFit's Lepjets_Event_Jet objec...
Definition: JetTranslatorBase.h:44
hitfit::higgs_label
Definition: Lepjets_Event_Jet.h:60
metsig::jet
Definition: SignAlgoResolutions.h:47
stringResolutions_etEtaPhi_cff.udscResolution
udscResolution
<— these resolutions do not exist yet —> tauResolution = stringResolution.clone(parametrization = 'Et...
Definition: stringResolutions_etEtaPhi_cff.py:173