CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
JME::JetResolutionScaleFactor Class Reference

#include <JetResolution.h>

Public Member Functions

void dump () const
 
const JetResolutionObjectgetResolutionObject () const
 
float getScaleFactor (const JetParameters &parameters, Variation variation=Variation::NOMINAL, std::string uncertaintySource="") const
 
 JetResolutionScaleFactor ()
 
 JetResolutionScaleFactor (const JetResolutionObject &object)
 
 JetResolutionScaleFactor (const std::string &filename)
 

Static Public Member Functions

static const JetResolutionScaleFactor get (const edm::EventSetup &, const std::string &)
 

Private Attributes

std::shared_ptr< JetResolutionObjectm_object
 

Detailed Description

Definition at line 40 of file JetResolution.h.

Constructor & Destructor Documentation

◆ JetResolutionScaleFactor() [1/3]

JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( const std::string &  filename)

Definition at line 39 of file JetResolution.cc.

39  {
40  m_object = std::make_shared<JetResolutionObject>(filename);
41  }

References corrVsCorr::filename, and m_object.

◆ JetResolutionScaleFactor() [2/3]

JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( const JetResolutionObject object)

Definition at line 43 of file JetResolution.cc.

43  {
44  m_object = std::make_shared<JetResolutionObject>(object);
45  }

References m_object.

◆ JetResolutionScaleFactor() [3/3]

JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( )
inline

Definition at line 44 of file JetResolution.h.

44  {
45  // Empty
46  }

Member Function Documentation

◆ dump()

void JME::JetResolutionScaleFactor::dump ( void  ) const
inline

Definition at line 56 of file JetResolution.h.

56 { m_object->dump(); }

References m_object.

◆ get()

const JetResolutionScaleFactor JME::JetResolutionScaleFactor::get ( const edm::EventSetup setup,
const std::string &  label 
)
static

◆ getResolutionObject()

const JetResolutionObject* JME::JetResolutionScaleFactor::getResolutionObject ( ) const
inline

Definition at line 59 of file JetResolution.h.

59 { return m_object.get(); }

References m_object.

◆ getScaleFactor()

float JME::JetResolutionScaleFactor::getScaleFactor ( const JetParameters parameters,
Variation  variation = Variation::NOMINAL,
std::string  uncertaintySource = "" 
) const

Definition at line 56 of file JetResolution.cc.

58  {
59  const JetResolutionObject::Record* record = m_object->getRecord(parameters);
60  if (!record)
61  return 1;
62 
63  const std::vector<float>& parameters_values = record->getParametersValues();
64  const std::vector<std::string>& parameter_names = m_object->getDefinition().getParametersName();
65  size_t parameter = static_cast<size_t>(variation);
66  if (!uncertaintySource.empty()) {
68  parameter =
69  std::distance(parameter_names.begin(),
70  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Down"));
71  else if (variation == Variation::UP)
72  parameter = std::distance(parameter_names.begin(),
73  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Up"));
74  if (parameter >= parameter_names.size()) {
75  std::string s;
76  for (const auto& piece : parameter_names)
77  s += piece + " ";
78  throw cms::Exception("InvalidParameter")
79  << "Invalid value for 'uncertaintySource' parameter. Only " + s + " are supported.\n";
80  }
81  }
82  return parameters_values[parameter];
83  }

References HLT_FULL_cff::distance, DOWN, Exception, spr::find(), m_object, pfMETsysShiftCorrections_cfi::parameter, GlobalPosition_Frontier_DevDB_cff::record, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, UP, and patPFMETCorrections_cff::variation.

Referenced by JetResolutionDemo::analyze(), and SmearedJetProducerT< T >::produce().

Member Data Documentation

◆ m_object

std::shared_ptr<JetResolutionObject> JME::JetResolutionScaleFactor::m_object
private
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
pfMETsysShiftCorrections_cfi.parameter
parameter
Definition: pfMETsysShiftCorrections_cfi.py:118
patZpeak.handle
handle
Definition: patZpeak.py:23
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
Variation::UP
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
JME::JetResolutionScaleFactor::m_object
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:62
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::ESHandle
Definition: DTSurvey.h:22
patPFMETCorrections_cff.variation
variation
Definition: patPFMETCorrections_cff.py:134
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
JME::JetResolutionScaleFactor::get
static const JetResolutionScaleFactor get(const edm::EventSetup &, const std::string &)
Definition: JetResolution.cc:48
Exception
Definition: hltDiff.cc:245
Variation::DOWN
JetResolutionScaleFactorRcd
Definition: JetResolutionScaleFactorRcd.h:9
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
label
const char * label
Definition: PFTauDecayModeTools.cc:11