CMS 3D CMS Logo

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

Public Member Functions

bool fill () override
 
 JetResolutionSummary ()
 
- 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 144 of file JetResolution_PayloadInspector.cc.

Constructor & Destructor Documentation

◆ JetResolutionSummary()

JME::JetResolutionSummary::JetResolutionSummary ( )
inline

Member Function Documentation

◆ fill()

bool JME::JetResolutionSummary::fill ( )
inlineoverridevirtual

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

Definition at line 149 of file JetResolution_PayloadInspector.cc.

References svgfig::canvas(), f, mps_fire::i, heavyIonCSV_trainingSettings::idx, MAX_ETA, MAX_PT, MIN_ETA, MIN_PT, NBIN_ETA, NBIN_PT, jetsAK4_Puppi_cff::payload, AlCaHarvesting_cff::record, writedatasetfile::run, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, runGCPTkAlMap::title, and trigObjTnPSource_cfi::var.

149  {
150  TH1D* resol_eta = new TH1D("Jet Resolution vs #eta", "", NBIN_ETA, MIN_ETA, MAX_ETA);
151  TH1D* resol_pt = new TH1D("Jet Resolution vs p_T", "", NBIN_PT, MIN_PT, MAX_PT);
152  auto tag = PlotBase::getTag<0>();
153  auto iov = tag.iovs.front();
154  std::shared_ptr<JetResolutionObject> payload = fetchPayload(std::get<1>(iov));
155  unsigned int run = std::get<0>(iov);
156  std::string tagname = tag.name;
157 
158  if (payload.get()) {
159  if (!payload->getRecords().empty() && // No formula for SF
160  payload->getDefinition().getFormulaString().compare("") == 0)
161  return false;
162 
163  for (const auto& record : payload->getRecords()) {
164  // Check Pt & Rho
165  if (!record.getVariablesRange().empty() && payload->getDefinition().getVariableName(0) == "JetPt" &&
166  record.getVariablesRange()[0].is_inside(100.)) {
167  if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(1) == "Rho" &&
168  record.getBinsRange()[1].is_inside(20.)) {
169  if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta") {
170  reco::FormulaEvaluator f(payload->getDefinition().getFormulaString());
171 
172  for (size_t idx = 0; idx <= NBIN_ETA; idx++) {
173  double x_axis = (idx + 0.5) * (MAX_ETA - MIN_ETA) / NBIN_ETA + MIN_ETA;
174  if (record.getBinsRange()[0].is_inside(x_axis)) {
175  std::vector<double> var = {100.};
176  std::vector<double> param;
177  for (size_t i = 0; i < record.getParametersValues().size(); i++) {
178  double par = record.getParametersValues()[i];
179  param.push_back(par);
180  }
181  float res = f.evaluate(var, param);
182  resol_eta->SetBinContent(idx + 1, res);
183  }
184  }
185  }
186  }
187  }
188 
189  if (!record.getBinsRange().empty() && payload->getDefinition().getBinName(0) == "JetEta" &&
190  record.getBinsRange()[0].is_inside(2.30)) {
191  if (record.getBinsRange().size() > 1 && payload->getDefinition().getBinName(1) == "Rho" &&
192  record.getBinsRange()[1].is_inside(15.)) {
193  if (!record.getVariablesRange().empty() && payload->getDefinition().getVariableName(0) == "JetPt") {
194  reco::FormulaEvaluator f(payload->getDefinition().getFormulaString());
195 
196  for (size_t idx = 0; idx <= NBIN_PT + 2; idx++) {
197  double x_axis = (idx + 0.5) * (MAX_PT - MIN_PT) / NBIN_PT + MIN_PT;
198  if (record.getVariablesRange()[0].is_inside(x_axis)) {
199  std::vector<double> var = {x_axis};
200  std::vector<double> param;
201  for (size_t i = 0; i < record.getParametersValues().size(); i++) {
202  double par = record.getParametersValues()[i];
203  param.push_back(par);
204  }
205  float res = f.evaluate(var, param);
206  resol_pt->SetBinContent(idx + 1, res);
207  }
208  }
209  }
210  }
211  }
212  } // records
213 
214  gStyle->SetOptStat(0);
215  gStyle->SetLabelFont(42, "XYZ");
216  gStyle->SetLabelSize(0.05, "XYZ");
217  gStyle->SetFrameLineWidth(3);
218 
219  std::string title = Form("Summary Run %i", run);
220  TCanvas canvas("Jet Resolution Summary", title.c_str(), 800, 1200);
221  canvas.Divide(1, 2);
222 
223  canvas.cd(1);
224  resol_eta->SetTitle(tagname.c_str());
225  resol_eta->SetXTitle("#eta");
226  resol_eta->SetYTitle("Resolution");
227  resol_eta->SetLineWidth(3);
228  resol_eta->Draw("");
229 
230  canvas.cd(2);
231  resol_pt->SetXTitle("p_{T} [GeV]");
232  resol_pt->SetYTitle("Resolution");
233  resol_pt->SetLineWidth(3);
234  resol_pt->Draw("][");
235 
236  canvas.SaveAs(m_imageFileName.c_str());
237 
238  return true;
239  } else // no payload.get()
240  return false;
241  } // fill
Definition: Electron.h:6
double f[11][100]
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< JetResolutionObject > fetchPayload(const cond::Hash &payloadHash)