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 200 of file BeamSpotPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ DisplayParameters()

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

Definition at line 203 of file BeamSpotPayloadInspectorHelper.h.

206  public:
208  : cond::payloadInspector::PlotImage<PayloadType, cond::payloadInspector::SINGLE_IOV>(
209  "Display of BeamSpot parameters") {
210  if constexpr (std::is_same_v<PayloadType, BeamSpotOnlineObjects>) {
211  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 213 of file BeamSpotPayloadInspectorHelper.h.

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

◆ fillTheExtraHistogram()

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

Definition at line 360 of file BeamSpotPayloadInspectorHelper.h.

363 :
364  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 367 of file BeamSpotPayloadInspectorHelper.h.

371  {
372  switch (parameter) {
373  case X:
374  return "X [cm]";
375  case Y:
376  return "Y [cm]";
377  case Z:
378  return "Z [cm]";
379  case sigmaX:
380  return "#sigma_{X} [cm]";
381  case sigmaY:
382  return "#sigma_{Y} [cm]";
383  case sigmaZ:
384  return "#sigma_{Z} [cm]";
385  case dxdz:
386  return "#frac{dX}{dZ} [rad]";
387  case dydz:
388  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 364 of file BeamSpotPayloadInspectorHelper.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:367
svgfig.canvas
def canvas(*sub, **attr)
Definition: svgfig.py:482
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName
std::string m_imageFileName
Definition: PayloadInspector.h:868
BeamSpotPI::DisplayParameters::fillTheExtraHistogram
virtual std::shared_ptr< TH2F > fillTheExtraHistogram() const
Definition: BeamSpotPayloadInspectorHelper.h:360
BeamSpotPI::sigmaX
Definition: BeamSpotPayloadInspectorHelper.h:33
pfMETsysShiftCorrections_cfi.parameter
parameter
Definition: pfMETsysShiftCorrections_cfi.py:118
BeamSpotPI::X
Definition: BeamSpotPayloadInspectorHelper.h:30
BeamSpotPI::sigmaZ
Definition: BeamSpotPayloadInspectorHelper.h:35
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:855
BeamSpotPI::DisplayParameters::isOnline_
bool isOnline_
Definition: BeamSpotPayloadInspectorHelper.h:363
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
BeamSpotPI::DisplayParameters::getStringFromTypeEnum
virtual std::string getStringFromTypeEnum(const parameters &parameter) const
Definition: BeamSpotPayloadInspectorHelper.h:367
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
BeamSpotPI::dxdz
Definition: BeamSpotPayloadInspectorHelper.h:36
BeamSpotPI::sigmaY
Definition: BeamSpotPayloadInspectorHelper.h:34
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond
Definition: plugin.cc:23
BeamSpotPI::END_OF_TYPES
Definition: BeamSpotPayloadInspectorHelper.h:44
cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)
Definition: PayloadInspector.h:863
BeamSpotPI::DisplayParameters::DisplayParameters
DisplayParameters()
Definition: BeamSpotPayloadInspectorHelper.h:203
BeamSpotPI::dydz
Definition: BeamSpotPayloadInspectorHelper.h:37
BeamSpotPI::DisplayParameters::m_payload
std::shared_ptr< PayloadType > m_payload
Definition: BeamSpotPayloadInspectorHelper.h:364
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:22
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:31
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:32
cond::payloadInspector::SINGLE_IOV
Definition: PayloadInspector.h:289