CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
BeamSpotPI::DisplayParameters< PayloadType > Class Template Reference

#include <BeamSpotPayloadInspectorHelper.h>

Inheritance diagram for BeamSpotPI::DisplayParameters< PayloadType >:
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV > cond::payloadInspector::PlotImpl< IOV_M, 0 > cond::payloadInspector::PlotBase

Public Member Functions

 DisplayParameters ()
 
bool fill () override
 
virtual std::shared_ptr< TH2F > fillTheExtraHistogram () const
 
- Public Member Functions inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
std::shared_ptr< PayloadType > 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)
 
std::string data () const
 
cond::persistency::Session dbSession ()
 
bool exec_process (const std::string &connectionString, const std::vector< std::tuple< std::string, cond::Time_t, cond::Time_t >> &tagsWithTimeBoundaries)
 
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 ()
 
boost::python::list inputParams () const
 
const std::map< std::string, std::string > & inputParamValues () const
 
bool isSingleIov () const
 
bool isTwoTags () const
 
unsigned int ntags () const
 
std::string payloadType () const
 
 PlotBase ()
 
bool process (const std::string &connectionString, const boost::python::list &tagsWithTimeBoundaries)
 
void setInputParamValues (const boost::python::dict &values)
 
std::string title () const
 
std::string type () const
 
virtual ~PlotBase ()=default
 

Protected Member Functions

virtual std::string getStringFromTypeEnum (const parameters &parameter) const
 

Protected Attributes

bool isOnline_
 
std::shared_ptr< PayloadType > m_payload
 
- Protected Attributes inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::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
 

Additional Inherited Members

- Public Types inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 

Detailed Description

template<class PayloadType>
class BeamSpotPI::DisplayParameters< PayloadType >

Definition at line 201 of file BeamSpotPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ DisplayParameters()

template<class PayloadType >
BeamSpotPI::DisplayParameters< PayloadType >::DisplayParameters ( )
inline

Definition at line 204 of file BeamSpotPayloadInspectorHelper.h.

207  public:
209  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
210  "Display of BeamSpot parameters") {
211  if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
212  isOnline_ = true;

References BeamSpotPI::DisplayParameters< PayloadType >::isOnline_.

Member Function Documentation

◆ fill()

template<class PayloadType >
bool BeamSpotPI::DisplayParameters< PayloadType >::fill ( )
inlineoverridevirtual

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

Definition at line 214 of file BeamSpotPayloadInspectorHelper.h.

218  {
219  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
220  auto tagname = tag.name;
221  auto iov = tag.iovs.front();
222 
223  gStyle->SetHistMinimumZero(kTRUE);
224 
225  m_payload = this->fetchPayload(std::get<1>(iov));
226 
227  TCanvas canvas("Beam Spot Parameters Summary", "BeamSpot Parameters summary", isOnline_ ? 1500 : 1000, 1000);
228  if (isOnline_) {
229  canvas.Divide(2, 1);
230  }
231  canvas.cd(1);
232 
233  canvas.cd(1)->SetTopMargin(0.05);
234  canvas.cd(1)->SetBottomMargin(0.06);
235  canvas.cd(1)->SetLeftMargin(0.15);
236  canvas.cd(1)->SetRightMargin(0.03);
237  canvas.cd(1)->Modified();
238  canvas.cd(1)->SetGrid();
239 
240  auto h2_BSParameters = std::unique_ptr<TH2F>(new TH2F("Parameters", "", 2, 0.0, 2.0, 8, 0, 8.));
241  h2_BSParameters->SetStats(false);
242 
243  std::function<double(parameters, bool)> cutFunctor = [this](parameters my_param, bool isError) {
244  double ret(-999.);
245  if (!isError) {
246  switch (my_param) {
247  case X:
248  return m_payload->GetX();
249  case Y:
250  return m_payload->GetY();
251  case Z:
252  return m_payload->GetZ();
253  case sigmaX:
254  return m_payload->GetBeamWidthX();
255  case sigmaY:
256  return m_payload->GetBeamWidthY();
257  case sigmaZ:
258  return m_payload->GetSigmaZ();
259  case dxdz:
260  return m_payload->Getdxdz();
261  case dydz:
262  return m_payload->Getdydz();
263  case END_OF_TYPES:
264  return ret;
265  default:
266  return ret;
267  }
268  } else {
269  switch (my_param) {
270  case X:
271  return m_payload->GetXError();
272  case Y:
273  return m_payload->GetYError();
274  case Z:
275  return m_payload->GetZError();
276  case sigmaX:
277  return m_payload->GetBeamWidthXError();
278  case sigmaY:
279  return m_payload->GetBeamWidthYError();
280  case sigmaZ:
281  return m_payload->GetSigmaZError();
282  case dxdz:
283  return m_payload->GetdxdzError();
284  case dydz:
285  return m_payload->GetdydzError();
286  case END_OF_TYPES:
287  return ret;
288  default:
289  return ret;
290  }
291  }
292  };
293 
294  h2_BSParameters->GetXaxis()->SetBinLabel(1, "Value");
295  h2_BSParameters->GetXaxis()->SetBinLabel(2, "Error");
296 
297  unsigned int yBin = 8;
298  for (int foo = parameters::X; foo <= parameters::dydz; foo++) {
299  parameters param = static_cast<parameters>(foo);
300  std::string theLabel = getStringFromTypeEnum(param);
301  h2_BSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
302  h2_BSParameters->SetBinContent(1, yBin, cutFunctor(param, false));
303  h2_BSParameters->SetBinContent(2, yBin, cutFunctor(param, true));
304  yBin--;
305  }
306 
307  h2_BSParameters->GetXaxis()->LabelsOption("h");
308  h2_BSParameters->GetYaxis()->SetLabelSize(0.05);
309  h2_BSParameters->GetXaxis()->SetLabelSize(0.05);
310  h2_BSParameters->SetMarkerSize(1.5);
311  h2_BSParameters->Draw("TEXT");
312 
313  auto ltx = TLatex();
314  ltx.SetTextFont(62);
315  if (isOnline_) {
316  ltx.SetTextSize(0.030);
317  } else {
318  ltx.SetTextSize(0.025);
319  }
320  ltx.SetTextAlign(11);
321 
322  auto runLS = BeamSpotPI::unpack(std::get<0>(iov));
323 
324  ltx.DrawLatexNDC(
325  gPad->GetLeftMargin(),
326  1 - gPad->GetTopMargin() + 0.01,
327  (tagname + " IOV: #color[4]{" + std::to_string(runLS.first) + "," + std::to_string(runLS.second) + "}")
328  .c_str());
329 
330  if (isOnline_) {
331  canvas.cd(2);
332  canvas.cd(2)->SetTopMargin(0.05);
333  canvas.cd(2)->SetBottomMargin(0.06);
334  canvas.cd(2)->SetLeftMargin(0.15);
335  canvas.cd(2)->SetRightMargin(0.03);
336  canvas.cd(2)->Modified();
337  canvas.cd(2)->SetGrid();
338 
339  auto extras = fillTheExtraHistogram();
340  if (extras) {
341  for (int bin = 1; bin <= extras->GetNbinsY(); bin++) {
342  edm::LogVerbatim("BeamSpotPayloadInspectorHelper")
343  << extras->GetYaxis()->GetBinLabel(bin) << ": " << extras->GetBinContent(1, bin) << "\n";
344  }
345  }
346  extras->Draw("TEXT");
347 
348  ltx.DrawLatexNDC(
349  gPad->GetLeftMargin(),
350  1 - gPad->GetTopMargin() + 0.01,
351  (tagname + " IOV: #color[4]{" + std::to_string(runLS.first) + "," + std::to_string(runLS.second) + "}")
352  .c_str());
353 
355  canvas.SaveAs(fileName.c_str());
356 
357  return true;
358  } else {
360  canvas.SaveAs(fileName.c_str());

◆ fillTheExtraHistogram()

template<class PayloadType >
virtual std::shared_ptr<TH2F> BeamSpotPI::DisplayParameters< PayloadType >::fillTheExtraHistogram ( ) const
inlinevirtual

Definition at line 363 of file BeamSpotPayloadInspectorHelper.h.

366 :
367  virtual std::shared_ptr<TH2F> fillTheExtraHistogram() const { return nullptr; }

◆ getStringFromTypeEnum()

template<class PayloadType >
virtual std::string BeamSpotPI::DisplayParameters< PayloadType >::getStringFromTypeEnum ( const parameters parameter) const
inlineprotectedvirtual

Definition at line 370 of file BeamSpotPayloadInspectorHelper.h.

374  {
375  switch (parameter) {
376  case X:
377  return "X [cm]";
378  case Y:
379  return "Y [cm]";
380  case Z:
381  return "Z [cm]";
382  case sigmaX:
383  return "#sigma_{X} [cm]";
384  case sigmaY:
385  return "#sigma_{Y} [cm]";
386  case sigmaZ:
387  return "#sigma_{Z} [cm]";
388  case dxdz:
389  return "#frac{dX}{dZ} [rad]";
390  case dydz:
391  return "#frac{dY}{dZ} [rad]";

References BeamSpotPI::dxdz, BeamSpotPI::dydz, pfMETsysShiftCorrections_cfi::parameter, BeamSpotPI::sigmaX, BeamSpotPI::sigmaY, BeamSpotPI::sigmaZ, BeamSpotPI::X, BeamSpotPI::Y, and BeamSpotPI::Z.

Member Data Documentation

◆ isOnline_

template<class PayloadType >
bool BeamSpotPI::DisplayParameters< PayloadType >::isOnline_
protected

◆ m_payload

template<class PayloadType >
std::shared_ptr<PayloadType> BeamSpotPI::DisplayParameters< PayloadType >::m_payload
protected

Definition at line 367 of file BeamSpotPayloadInspectorHelper.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:910
BeamSpotPI::DisplayParameters::fillTheExtraHistogram
virtual std::shared_ptr< TH2F > fillTheExtraHistogram() const
Definition: BeamSpotPayloadInspectorHelper.h:363
BeamSpotPI::sigmaX
Definition: BeamSpotPayloadInspectorHelper.h:34
pfMETsysShiftCorrections_cfi.parameter
parameter
Definition: pfMETsysShiftCorrections_cfi.py:118
BeamSpotPI::X
Definition: BeamSpotPayloadInspectorHelper.h:31
BeamSpotPI::sigmaZ
Definition: BeamSpotPayloadInspectorHelper.h:36
X
#define X(str)
Definition: MuonsGrabber.cc:38
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::PlotImage
PlotImage(const std::string &title)
Definition: PayloadInspector.h:897
BeamSpotPI::DisplayParameters::isOnline_
bool isOnline_
Definition: BeamSpotPayloadInspectorHelper.h:366
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
BeamSpotPI::DisplayParameters::getStringFromTypeEnum
virtual std::string getStringFromTypeEnum(const parameters &parameter) const
Definition: BeamSpotPayloadInspectorHelper.h:370
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
BeamSpotPI::dxdz
Definition: BeamSpotPayloadInspectorHelper.h:37
BeamSpotPI::sigmaY
Definition: BeamSpotPayloadInspectorHelper.h:35
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
BeamSpotPI::END_OF_TYPES
Definition: BeamSpotPayloadInspectorHelper.h:45
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:905
BeamSpotPI::DisplayParameters::DisplayParameters
DisplayParameters()
Definition: BeamSpotPayloadInspectorHelper.h:204
BeamSpotPI::dydz
Definition: BeamSpotPayloadInspectorHelper.h:38
BeamSpotPI::DisplayParameters::m_payload
std::shared_ptr< PayloadType > m_payload
Definition: BeamSpotPayloadInspectorHelper.h:367
createPayload.tagname
tagname
Definition: createPayload.py:183
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
BeamSpotPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: BeamSpotPayloadInspectorHelper.h:23
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:295