CMS 3D CMS Logo

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

#include <BeamSpotPayloadInspectorHelper.h>

Inheritance diagram for simBeamSpotPI::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
 
- 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)
 
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
 

Protected Attributes

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
 

Static Private Attributes

static constexpr double cmToUm = 10000.f
 

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 simBeamSpotPI::DisplayParameters< PayloadType >

Definition at line 824 of file BeamSpotPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ DisplayParameters()

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

Member Function Documentation

◆ fill()

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

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

Definition at line 830 of file BeamSpotPayloadInspectorHelper.h.

References simBeamSpotPI::alpha, simBeamSpotPI::betaStar, svgfig::canvas(), simBeamSpotPI::DisplayParameters< PayloadType >::cmToUm, simBeamSpotPI::emittance, simBeamSpotPI::END_OF_TYPES, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, custom_jme_cff::foo, simBeamSpotPI::getStringFromParamEnum(), cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, simBeamSpotPI::DisplayParameters< PayloadType >::m_payload, simBeamSpotPI::meanX, simBeamSpotPI::meanY, simBeamSpotPI::meanZ, simBeamSpotPI::phi, runTheMatrix::ret, simBeamSpotPI::sigmaX, simBeamSpotPI::sigmaY, simBeamSpotPI::sigmaZ, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, simBeamSpotPI::timeOffset, to_string(), beamSpotPI::unpack(), X, simBeamSpotPI::X, simBeamSpotPI::Y, photonAnalyzer_cfi::yBin, and simBeamSpotPI::Z.

830  {
831  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
832  auto tagname = tag.name;
833  auto iov = tag.iovs.front();
834 
835  gStyle->SetHistMinimumZero(kTRUE);
836 
837  m_payload = this->fetchPayload(std::get<1>(iov));
838 
839  TCanvas canvas("Sim Beam Spot Parameters Summary", "Sim BeamSpot Parameters summary", 1000, 1000);
840  canvas.cd(1);
841  canvas.cd(1)->SetTopMargin(0.05);
842  canvas.cd(1)->SetBottomMargin(0.06);
843  canvas.cd(1)->SetLeftMargin(0.25);
844  canvas.cd(1)->SetRightMargin(0.01);
845  canvas.cd(1)->Modified();
846  canvas.cd(1)->SetGrid();
847 
848  auto h2_SimBSParameters = std::make_unique<TH2F>("Parameters", "", 1, 0.0, 1.0, END_OF_TYPES, 0, END_OF_TYPES);
849  h2_SimBSParameters->SetStats(false);
850 
851  std::function<double(parameters)> cutFunctor = [this](parameters my_param) {
852  double ret(-999.);
853  switch (my_param) {
854  case X:
855  return m_payload->x();
856  case Y:
857  return m_payload->y();
858  case Z:
859  return m_payload->z();
860  case meanX:
861  return m_payload->meanX();
862  case meanY:
863  return m_payload->meanY();
864  case meanZ:
865  return m_payload->meanZ();
866  case sigmaX:
867  return m_payload->sigmaX() * cmToUm;
868  case sigmaY:
869  return m_payload->sigmaY() * cmToUm;
870  case sigmaZ:
871  return m_payload->sigmaZ();
872  case betaStar:
873  return m_payload->betaStar();
874  case emittance:
875  return m_payload->emittance();
876  case phi:
877  return m_payload->phi();
878  case alpha:
879  return m_payload->alpha();
880  case timeOffset:
881  return m_payload->timeOffset();
882  case END_OF_TYPES:
883  return ret;
884  default:
885  return ret;
886  }
887  };
888 
889  h2_SimBSParameters->GetXaxis()->SetBinLabel(1, "Value");
890 
891  unsigned int yBin = END_OF_TYPES;
892  for (int foo = parameters::X; foo <= parameters::timeOffset; foo++) {
893  parameters param = static_cast<parameters>(foo);
894  std::string theLabel = getStringFromParamEnum(param, true);
895  h2_SimBSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
896  h2_SimBSParameters->SetBinContent(1, yBin, cutFunctor(param));
897  yBin--;
898  }
899 
900  h2_SimBSParameters->GetXaxis()->LabelsOption("h");
901  h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05);
902  h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05);
903  h2_SimBSParameters->SetMarkerSize(1.5);
904  h2_SimBSParameters->Draw("TEXT");
905 
906  auto ltx = TLatex();
907  ltx.SetTextFont(62);
908  ltx.SetTextSize(0.025);
909  //ltx.SetTextAlign(11);
910 
911  auto runLS = beamSpotPI::unpack(std::get<0>(iov));
912 
913  ltx.SetTextAlign(32); // Set text alignment to left (left-aligned)
914  ltx.DrawLatexNDC(1 - gPad->GetRightMargin(),
915  1 - gPad->GetTopMargin() + 0.01,
916  ("#color[2]{" + tagname + "} IOV: #color[4]{" + std::to_string(runLS.first) + "," +
917  std::to_string(runLS.second) + "}")
918  .c_str());
919 
921  canvas.SaveAs(fileName.c_str());
922 
923  return true;
924  }
ret
prodAgent to be discontinued
#define X(str)
Definition: MuonsGrabber.cc:38
static std::string to_string(const XMLCh *ch)
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
std::string getStringFromParamEnum(const parameters &parameter, const bool addUnits=false)
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ cmToUm

template<class PayloadType >
constexpr double simBeamSpotPI::DisplayParameters< PayloadType >::cmToUm = 10000.f
staticprivate

◆ m_payload

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