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

References simBeamSpotPI::alpha, simBeamSpotPI::betaStar, svgfig::canvas(), simBeamSpotPI::DisplayParameters< PayloadType >::cmToUm, simBeamSpotPI::emittance, simBeamSpotPI::END_OF_TYPES, simBeamSpotPI::expTransWidth, 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::phi, runTheMatrix::ret, simBeamSpotPI::sigmaZ, mathSSE::sqrt(), 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.

815  {
816  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
817  auto tagname = tag.name;
818  auto iov = tag.iovs.front();
819 
820  gStyle->SetHistMinimumZero(kTRUE);
821 
822  m_payload = this->fetchPayload(std::get<1>(iov));
823 
824  TCanvas canvas("Sim Beam Spot Parameters Summary", "Sim BeamSpot Parameters summary", 1000, 1000);
825  canvas.cd(1);
826  canvas.cd(1)->SetTopMargin(0.05);
827  canvas.cd(1)->SetBottomMargin(0.06);
828  canvas.cd(1)->SetLeftMargin(0.25);
829  canvas.cd(1)->SetRightMargin(0.01);
830  canvas.cd(1)->Modified();
831  canvas.cd(1)->SetGrid();
832 
833  auto h2_SimBSParameters = std::make_unique<TH2F>("Parameters", "", 1, 0.0, 1.0, END_OF_TYPES, 0, END_OF_TYPES);
834  h2_SimBSParameters->SetStats(false);
835 
836  std::function<double(parameters)> cutFunctor = [this](parameters my_param) {
837  double ret(-999.);
838  switch (my_param) {
839  case X:
840  return m_payload->x();
841  case Y:
842  return m_payload->y();
843  case Z:
844  return m_payload->z();
845  case sigmaZ:
846  return m_payload->sigmaZ();
847  case betaStar:
848  return m_payload->betaStar();
849  case emittance:
850  return m_payload->emittance();
851  case phi:
852  return m_payload->phi();
853  case alpha:
854  return m_payload->alpha();
855  case timeOffset:
856  return m_payload->timeOffset();
857  case expTransWidth:
858  return (1 / std::sqrt(2)) * std::sqrt(m_payload->emittance() * m_payload->betaStar()) * cmToUm;
859  case END_OF_TYPES:
860  return ret;
861  default:
862  return ret;
863  }
864  };
865 
866  h2_SimBSParameters->GetXaxis()->SetBinLabel(1, "Value");
867 
868  unsigned int yBin = END_OF_TYPES;
869  for (int foo = parameters::X; foo <= parameters::timeOffset; foo++) {
870  parameters param = static_cast<parameters>(foo);
871  std::string theLabel = getStringFromParamEnum(param, true);
872  h2_SimBSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
873  h2_SimBSParameters->SetBinContent(1, yBin, cutFunctor(param));
874  yBin--;
875  }
876 
877  h2_SimBSParameters->GetXaxis()->LabelsOption("h");
878  h2_SimBSParameters->GetYaxis()->SetLabelSize(0.05);
879  h2_SimBSParameters->GetXaxis()->SetLabelSize(0.05);
880  h2_SimBSParameters->SetMarkerSize(1.5);
881  h2_SimBSParameters->Draw("TEXT");
882 
883  auto ltx = TLatex();
884  ltx.SetTextFont(62);
885  ltx.SetTextSize(0.025);
886  //ltx.SetTextAlign(11);
887 
888  auto runLS = beamSpotPI::unpack(std::get<0>(iov));
889 
890  ltx.SetTextAlign(32); // Set text alignment to left (left-aligned)
891  ltx.DrawLatexNDC(1 - gPad->GetRightMargin(),
892  1 - gPad->GetTopMargin() + 0.01,
893  ("#color[2]{" + tagname + "} IOV: #color[4]{" + std::to_string(runLS.first) + "," +
894  std::to_string(runLS.second) + "}")
895  .c_str());
896 
898  canvas.SaveAs(fileName.c_str());
899 
900  return true;
901  }
ret
prodAgent to be discontinued
#define X(str)
Definition: MuonsGrabber.cc:38
static std::string to_string(const XMLCh *ch)
T sqrt(T t)
Definition: SSEVec.h:19
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