CMS 3D CMS Logo

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

#include <JetResolution.h>

Public Types

using Token = edm::ESGetToken< JetResolutionObject, JetResolutionScaleFactorRcd >
 

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 Token &)
 

Private Attributes

std::shared_ptr< JetResolutionObjectm_object
 

Detailed Description

Definition at line 45 of file JetResolution.h.

Member Typedef Documentation

◆ Token

Definition at line 54 of file JetResolution.h.

Constructor & Destructor Documentation

◆ JetResolutionScaleFactor() [1/3]

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

Definition at line 36 of file JetResolution.cc.

References corrVsCorr::filename, and m_object.

36  {
37  m_object = std::make_shared<JetResolutionObject>(filename);
38  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:68

◆ JetResolutionScaleFactor() [2/3]

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

Definition at line 40 of file JetResolution.cc.

References m_object, and resolutioncreator_cfi::object.

40  {
41  m_object = std::make_shared<JetResolutionObject>(object);
42  }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:68

◆ JetResolutionScaleFactor() [3/3]

JME::JetResolutionScaleFactor::JetResolutionScaleFactor ( )
inline

Definition at line 49 of file JetResolution.h.

49  {
50  // Empty
51  }

Member Function Documentation

◆ dump()

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

Definition at line 62 of file JetResolution.h.

References m_object.

62 { m_object->dump(); }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:68

◆ get()

const JetResolutionScaleFactor JME::JetResolutionScaleFactor::get ( const edm::EventSetup setup,
const Token token 
)
static

◆ getResolutionObject()

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

Definition at line 65 of file JetResolution.h.

References m_object.

65 { return m_object.get(); }
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:68

◆ getScaleFactor()

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

Definition at line 50 of file JetResolution.cc.

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

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

52  {
54  if (!record)
55  return 1;
56 
57  const std::vector<float>& parameters_values = record->getParametersValues();
58  const std::vector<std::string>& parameter_names = m_object->getDefinition().getParametersName();
59  size_t parameter = static_cast<size_t>(variation);
60  if (!uncertaintySource.empty()) {
62  parameter =
63  std::distance(parameter_names.begin(),
64  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Down"));
65  else if (variation == Variation::UP)
66  parameter = std::distance(parameter_names.begin(),
67  std::find(parameter_names.begin(), parameter_names.end(), uncertaintySource + "Up"));
68  if (parameter >= parameter_names.size()) {
69  std::string s;
70  for (const auto& piece : parameter_names)
71  s += piece + " ";
72  throw cms::Exception("InvalidParameter")
73  << "Invalid value for 'uncertaintySource' parameter. Only " + s + " are supported.\n";
74  }
75  }
76  return parameters_values[parameter];
77  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::shared_ptr< JetResolutionObject > m_object
Definition: JetResolution.h:68

Member Data Documentation

◆ m_object

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