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 (const std::string &filename)
 
 JetResolutionScaleFactor (const JetResolutionObject &object)
 
 JetResolutionScaleFactor ()
 

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 45 of file JetResolution.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file JetResolution.cc.

References corrVsCorr::filename, and JME::JetResolution::m_object.

39  {
40  m_object = std::make_shared<JetResolutionObject>(filename);
41  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:71
JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( const JetResolutionObject object)

Definition at line 43 of file JetResolution.cc.

References JME::JetResolution::m_object, and resolutioncreator_cfi::object.

43  {
44  m_object = std::make_shared<JetResolutionObject>(object);
45  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:71
JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( )
inline

Definition at line 49 of file JetResolution.h.

References NOMINAL, AlCaHLTBitMon_QueryRunRegistry::string, and patPFMETCorrections_cff::variation.

49  {
50  // Empty
51  }

Member Function Documentation

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

Definition at line 61 of file JetResolution.h.

61  {
62  m_object->dump();
63  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:71
const JetResolutionScaleFactor JME::JetResolutionScaleFactor::get ( const edm::EventSetup setup,
const std::string &  label 
)
static
const JetResolutionObject* JME::JetResolutionScaleFactor::getResolutionObject ( ) const
inline

Definition at line 66 of file JetResolution.h.

66  {
67  return m_object.get();
68  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:71
float JME::JetResolutionScaleFactor::getScaleFactor ( const JetParameters parameters,
Variation  variation = Variation::NOMINAL,
std::string  uncertaintySource = "" 
) const

Definition at line 56 of file JetResolution.cc.

References SoftLeptonByDistance_cfi::distance, DOWN, Exception, spr::find(), JME::JetResolutionObject::Record::getParametersValues(), JME::JetResolution::m_object, record, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, UP, and patPFMETCorrections_cff::variation.

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

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 = std::distance(parameter_names.begin(),
69  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Down"));
70  else if (variation == Variation::UP)
71  parameter = std::distance(parameter_names.begin(),
72  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Up"));
73  if (parameter >= parameter_names.size()) {
74  std::string s;
75  for (const auto& piece : parameter_names)
76  s += piece + " ";
77  throw cms::Exception("InvalidParameter") << "Invalid value for 'uncertaintySource' parameter. Only " + s + " are supported.\n";
78  }
79  }
80  return parameters_values[parameter];
81  }
JetCorrectorParameters::Record record
Definition: classes.h:7
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:71

Member Data Documentation

std::shared_ptr<JetResolutionObject> JME::JetResolutionScaleFactor::m_object
private

Definition at line 71 of file JetResolution.h.