CMS 3D CMS Logo

List of all members | Public Member Functions
JME::JetResolutionVsPt Class Reference
Inheritance diagram for JME::JetResolutionVsPt:
cond::payloadInspector::Histogram1< AxisType, PayloadType, IOV_M > cond::payloadInspector::Plot2D< PayloadType, AxisType, AxisType, IOV_M, 1 > cond::payloadInspector::PlotImpl< IOV_M, NTAGS > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 JetResolutionVsPt ()
 
- Public Member Functions inherited from cond::payloadInspector::Histogram1< AxisType, PayloadType, IOV_M >
bool fill () override
 
void fillWithBinAndValue (size_t bin, AxisType weight=1)
 
void fillWithValue (AxisType value, AxisType weight=1)
 
virtual AxisType getFromPayload (PayloadType &payload)
 
 Histogram1 (const std::string &title, const std::string &xLabel, size_t nbins, float min, float max, const std::string &yLabel="entries")
 
void init () override
 
- Public Member Functions inherited from cond::payloadInspector::Plot2D< PayloadType, AxisType, AxisType, IOV_M, 1 >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
 Plot2D (const std::string &type, const std::string &title, const std::string xLabel, const std::string &yLabel)
 
std::string serializeData () override
 
 ~Plot2D () override=default
 
- Public Member Functions inherited from cond::payloadInspector::PlotImpl< IOV_M, NTAGS >
 PlotImpl (const std::string &type, const std::string &title)
 
std::string processData () override
 
 ~PlotImpl () override=default
 
- Public Member Functions inherited from cond::payloadInspector::PlotBase
void addInputParam (const std::string &paramName)
 
cond::persistency::Session dbSession ()
 
template<typename PayloadType >
std::shared_ptr< PayloadType > fetchPayload (const cond::Hash &payloadHash)
 
template<int index>
TagReference getTag ()
 
cond::Tag_t getTagInfo (const std::string &tag)
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
std::string title () const
 
std::string type () const
 
virtual ~PlotBase ()=default
 

Additional Inherited Members

- Public Types inherited from cond::payloadInspector::Histogram1< AxisType, PayloadType, IOV_M >
typedef Plot2D< PayloadType, AxisType, AxisType, IOV_M, 1 > Base
 
- Public Types inherited from cond::payloadInspector::Plot2D< PayloadType, AxisType, AxisType, IOV_M, 1 >
typedef PlotImpl< IOV_M, NTAGS > Base
 
- Protected Attributes inherited from cond::payloadInspector::Plot2D< PayloadType, AxisType, AxisType, IOV_M, 1 >
std::vector< std::tuple< AxisType, AxisType > > m_plotData
 
- Protected Attributes inherited from cond::payloadInspector::PlotBase
std::set< std::string > m_inputParams
 
std::map< std::string, std::string > m_inputParamValues
 
PlotAnnotations m_plotAnnotations
 
std::vector< std::pair< cond::Time_t, cond::Time_t > > m_tagBoundaries
 
std::vector< std::vector< std::tuple< cond::Time_t, cond::Hash > > > m_tagIovs
 
std::vector< std::string > m_tagNames
 

Detailed Description

Definition at line 116 of file JetResolution_PayloadInspector.cc.

Constructor & Destructor Documentation

◆ JetResolutionVsPt()

JME::JetResolutionVsPt::JetResolutionVsPt ( )
inline

Member Function Documentation

◆ fill()

bool JME::JetResolutionVsPt::fill ( )
inlineoverridevirtual

Implements cond::payloadInspector::PlotImpl< IOV_M, NTAGS >.

Definition at line 125 of file JetResolution_PayloadInspector.cc.

References f, mps_fire::i, heavyIonCSV_trainingSettings::idx, cond::payloadInspector::PlotBase::inputParamValues(), MAX_PT, MIN_PT, NBIN_PT, jetsAK4_Puppi_cff::payload, AlCaHarvesting_cff::record, makeGlobalPositionRcd_cfg::tag, and trigObjTnPSource_cfi::var.

125  {
126  double par_Pt = 100.;
127  double par_Eta = 1.;
128  double par_Rho = 20.;
129 
131  auto ip = paramValues.find("Jet_Eta");
132  if (ip != paramValues.end()) {
133  par_Eta = std::stod(ip->second);
134  edm::LogPrint("JER_PI") << "Jet Eta: " << par_Eta;
135  }
136  ip = paramValues.find("Jet_Rho");
137  if (ip != paramValues.end()) {
138  par_Rho = std::stod(ip->second);
139  edm::LogPrint("JER_PI") << "Jet Rho: " << par_Rho;
140  }
141 
142  auto tag = PlotBase::getTag<0>();
143  for (auto const& iov : tag.iovs) {
144  std::shared_ptr<JetResolutionObject> payload = Base::fetchPayload(std::get<1>(iov));
145  if (payload.get()) {
146  if (!payload->getRecords().empty() && // No formula for SF
147  payload->getDefinition().getFormulaString().compare("") == 0)
148  return false;
149 
150  for (const auto& record : payload->getRecords()) {
151  // Check Eta & Rho
152  if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta" &&
153  record.getBinsRange()[0].is_inside(par_Eta)) {
154  if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(1) == "Rho" &&
155  record.getBinsRange()[1].is_inside(par_Rho)) {
156  if (!record.getVariablesRange().empty() && payload->getDefinition().getVariableName(0) == "JetPt") {
157  reco::FormulaEvaluator f(payload->getDefinition().getFormulaString());
158 
159  for (size_t idx = 0; idx <= NBIN_PT; idx++) {
160  par_Pt = (idx + 0.5) * (MAX_PT - MIN_PT) / NBIN_PT + MIN_PT;
161  if (record.getVariablesRange()[0].is_inside(par_Pt)) {
162  std::vector<double> var = {par_Pt};
163  std::vector<double> param;
164  for (size_t i = 0; i < record.getParametersValues().size(); i++) {
165  double par = record.getParametersValues()[i];
166  param.push_back(par);
167  }
168  float res = f.evaluate(var, param);
170  }
171  }
172  }
173  }
174  }
175  }
176  return true;
177  }
178  }
179  return false;
180  }
Definition: Electron.h:6
double f[11][100]
Log< level::Warning, true > LogPrint
const std::map< std::string, std::string > & inputParamValues() const
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
void fillWithBinAndValue(size_t bin, AxisType weight=1)