CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PATJetCorrExtractor.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_PatUtils_PATJetCorrExtractor_h
2 #define PhysicsTools_PatUtils_PATJetCorrExtractor_h
3 
23 
29 
30 #include <string>
31 #include <vector>
32 
33 namespace
34 {
35  std::string format_vstring(const std::vector<std::string>& v)
36  {
37  std::string retVal;
38 
39  retVal.append("{ ");
40 
41  unsigned numEntries = v.size();
42  for ( unsigned iEntry = 0; iEntry < numEntries; ++iEntry ) {
43  retVal.append(v[iEntry]);
44  if ( iEntry < (numEntries - 1) ) retVal.append(", ");
45  }
46 
47  retVal.append(" }");
48 
49  return retVal;
50  }
51 }
52 
54 {
55  public:
56 
57  reco::Candidate::LorentzVector operator()(const pat::Jet& jet, const std::string& jetCorrLabel,
58  const edm::Event* evt = 0, const edm::EventSetup* es = 0,
59  double jetCorrEtaMax = 9.9,
60  const reco::Candidate::LorentzVector* rawJetP4_specified = 0)
61  {
63 
64  try {
65  corrJetP4 = jet.correctedP4(jetCorrLabel);
66  } catch( cms::Exception e ) {
67  throw cms::Exception("InvalidRequest")
68  << "The JEC level " << jetCorrLabel << " does not exist !!\n"
69  << "Available levels = " << format_vstring(jet.availableJECLevels()) << ".\n";
70  }
71 
72  return corrJetP4;
73  }
74 };
75 
76 #endif
77 
78 
const std::vector< std::string > availableJECLevels(const int &set=0) const
Definition: Jet.cc:238
const LorentzVector & correctedP4(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Definition: Jet.h:144
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
std::string format_vstring(const std::vector< std::string > &vs)
Analysis-level calorimeter jet class.
Definition: Jet.h:72
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:38
reco::Candidate::LorentzVector operator()(const pat::Jet &jet, const std::string &jetCorrLabel, const edm::Event *evt=0, const edm::EventSetup *es=0, double jetCorrEtaMax=9.9, const reco::Candidate::LorentzVector *rawJetP4_specified=0)
mathSSE::Vec4< T > v