CMS 3D CMS Logo

List of all members | Public Member Functions
JME::JetScaleFactorSummary Class Reference
Inheritance diagram for JME::JetScaleFactorSummary:
cond::payloadInspector::PlotImage< JetResolutionObject, SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

bool fill () override
 
 JetScaleFactorSummary ()
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< JetResolutionObject, SINGLE_IOV >
std::shared_ptr< JetResolutionObject > fetchPayload (const cond::Hash &payloadHash)
 
 PlotImage (const std::string &title)
 
std::string serializeData () override
 
- Public Member Functions inherited from cond::payloadInspector::PlotImpl< IOV_M, 0 >
 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)
 
virtual void init ()
 
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::PlotImage< JetResolutionObject, SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< JetResolutionObject, SINGLE_IOV >
std::string m_imageFileName
 
- 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 287 of file JetResolution_PayloadInspector.cc.

Constructor & Destructor Documentation

◆ JetScaleFactorSummary()

JME::JetScaleFactorSummary::JetScaleFactorSummary ( )
inline

Member Function Documentation

◆ fill()

bool JME::JetScaleFactorSummary::fill ( )
inlineoverridevirtual

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

Definition at line 292 of file JetResolution_PayloadInspector.cc.

References svgfig::canvas(), MAX_ETA, MIN_ETA, NBIN_ETA, jetsAK4_Puppi_cff::payload, AlCaHarvesting_cff::record, writedatasetfile::run, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, and runGCPTkAlMap::title.

292  {
293  TH1D* sf_eta_norm = new TH1D("Jet SF vs #eta NORM", "", NBIN_ETA, MIN_ETA, MAX_ETA);
294  TH1D* sf_eta_down = new TH1D("Jet SF vs #eta DOWN", "", NBIN_ETA, MIN_ETA, MAX_ETA);
295  TH1D* sf_eta_up = new TH1D("Jet SF vs #eta UP", "", NBIN_ETA, MIN_ETA, MAX_ETA);
296 
297  auto tag = PlotBase::getTag<0>();
298  auto iov = tag.iovs.front();
299  std::shared_ptr<JetResolutionObject> payload = fetchPayload(std::get<1>(iov));
300  unsigned int run = std::get<0>(iov);
301  std::string tagname = tag.name;
302 
303  if (payload.get()) {
304  if (!payload->getRecords().empty() && // No formula for SF
305  payload->getDefinition().getFormulaString().compare("") != 0)
306  return false;
307 
308  for (const auto& record : payload->getRecords()) {
309  if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta" &&
310  record.getParametersValues().size() == 3) { // norm, down, up
311 
312  for (size_t it = 0; it <= NBIN_ETA; it++) {
313  double x_axis = (it + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA;
314  if (record.getBinsRange()[0].is_inside(x_axis)) {
315  sf_eta_norm->SetBinContent(it + 1, record.getParametersValues()[0]);
316  sf_eta_down->SetBinContent(it + 1, record.getParametersValues()[1]);
317  sf_eta_up->SetBinContent(it + 1, record.getParametersValues()[2]);
318  }
319  }
320  }
321  } // records
322 
323  gStyle->SetOptStat(0);
324  gStyle->SetLabelFont(42, "XYZ");
325  gStyle->SetLabelSize(0.05, "XYZ");
326  gStyle->SetFrameLineWidth(3);
327 
328  std::string title = Form("Summary Run %i", run);
329  TCanvas canvas("Jet ScaleFactor Summary", title.c_str(), 800, 600);
330 
331  canvas.cd();
332  sf_eta_up->SetTitle(tagname.c_str());
333  sf_eta_up->SetXTitle("#eta");
334  sf_eta_up->SetYTitle("Scale Factor");
335  sf_eta_up->SetLineStyle(7);
336  sf_eta_up->SetLineWidth(3);
337  sf_eta_up->SetFillColorAlpha(kGray, 0.5);
338  sf_eta_up->SetMinimum(0.);
339  sf_eta_up->Draw("][");
340 
341  sf_eta_down->SetLineStyle(7);
342  sf_eta_down->SetLineWidth(3);
343  sf_eta_down->SetFillColorAlpha(kWhite, 1);
344  sf_eta_down->Draw("][ same");
345 
346  sf_eta_norm->SetLineStyle(1);
347  sf_eta_norm->SetLineWidth(5);
348  sf_eta_norm->SetFillColor(0);
349  sf_eta_norm->Draw("][ same");
350  sf_eta_norm->Draw("axis same");
351 
352  canvas.SaveAs(m_imageFileName.c_str());
353 
354  return true;
355  } else // no payload.get()
356  return false;
357  } // fill
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< JetResolutionObject > fetchPayload(const cond::Hash &payloadHash)