CMS 3D CMS Logo

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

#include <BeamSpotPayloadInspectorHelper.h>

Inheritance diagram for simBeamSpotHLLHCPI::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 simBeamSpotHLLHCPI::DisplayParameters< PayloadType >

Definition at line 1194 of file BeamSpotPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ DisplayParameters()

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

Member Function Documentation

◆ fill()

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

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

Definition at line 1200 of file BeamSpotPayloadInspectorHelper.h.

References simBeamSpotHLLHCPI::betaCrossingPlane, simBeamSpotHLLHCPI::betaSeparationPlane, simBeamSpotHLLHCPI::bunchLenght, svgfig::canvas(), simBeamSpotHLLHCPI::crabbingAngleCrossing, simBeamSpotHLLHCPI::crabbingAngleSeparation, simBeamSpotHLLHCPI::crabFrequency, simBeamSpotHLLHCPI::crossingAngle, END_OF_TYPES, simBeamSpotHLLHCPI::END_OF_TYPES, simBeamSpotHLLHCPI::eProton, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, custom_jme_cff::foo, simBeamSpotHLLHCPI::getStringFromParamEnum(), simBeamSpotHLLHCPI::horizontalEmittance, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, simBeamSpotHLLHCPI::DisplayParameters< PayloadType >::m_payload, simBeamSpotHLLHCPI::meanX, simBeamSpotHLLHCPI::meanY, simBeamSpotHLLHCPI::meanZ, runTheMatrix::ret, simBeamSpotHLLHCPI::rf800, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, createPayload::tagname, simBeamSpotHLLHCPI::timeOffset, to_string(), beamSpotPI::unpack(), simBeamSpotHLLHCPI::verticalEmittance, and photonAnalyzer_cfi::yBin.

1200  {
1201  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
1202  auto tagname = tag.name;
1203  auto iov = tag.iovs.front();
1204 
1205  gStyle->SetHistMinimumZero(kTRUE);
1206 
1207  m_payload = this->fetchPayload(std::get<1>(iov));
1208 
1209  std::function<double(parameters)> cutFunctor = [this](parameters my_param) {
1210  double ret(-999.);
1211  switch (my_param) {
1212  case meanX:
1213  return m_payload->meanX();
1214  case meanY:
1215  return m_payload->meanY();
1216  case meanZ:
1217  return m_payload->meanZ();
1218  case eProton:
1219  return m_payload->eProton();
1220  case crabFrequency:
1221  return m_payload->crabFrequency();
1222  case rf800:
1223  return m_payload->rf800();
1224  case crossingAngle:
1225  return m_payload->crossingAngle();
1226  case crabbingAngleCrossing:
1227  return m_payload->crabbingAngleCrossing();
1229  return m_payload->crabbingAngleSeparation();
1230  case betaCrossingPlane:
1231  return m_payload->betaCrossingPlane();
1232  case betaSeparationPlane:
1233  return m_payload->betaSeparationPlane();
1234  case horizontalEmittance:
1235  return m_payload->horizontalEmittance();
1236  case verticalEmittance:
1237  return m_payload->verticalEmittance();
1238  case bunchLenght:
1239  return m_payload->bunchLenght();
1240  case timeOffset:
1241  return m_payload->timeOffset();
1242  case END_OF_TYPES:
1243  return ret;
1244  default:
1245  return ret;
1246  }
1247  };
1248 
1249  TCanvas canvas("Sim Beam Spot HL-LHC Parameters Summary", "Sim BeamSpot HL-LHC Parameters summary", 1500, 1000);
1250  canvas.Divide(2, 1);
1251 
1252  // Fill canvans (1,1) with first 9 parameters
1253  canvas.cd(1);
1254  canvas.cd(1)->SetTopMargin(0.05);
1255  canvas.cd(1)->SetBottomMargin(0.06);
1256  canvas.cd(1)->SetLeftMargin(0.35);
1257  canvas.cd(1)->SetRightMargin(0.01);
1258  canvas.cd(1)->Modified();
1259  canvas.cd(1)->SetGrid();
1260 
1261  auto h2_SimBSHLLHCParameters = std::make_unique<TH2F>(
1262  "Parameters", "", 1, 0.0, 1.0, parameters::crabbingAngleCrossing, 0, parameters::crabbingAngleCrossing);
1263  h2_SimBSHLLHCParameters->SetStats(false);
1264  h2_SimBSHLLHCParameters->GetXaxis()->SetBinLabel(1, "Value");
1265 
1266  unsigned int yBin = 8;
1268  parameters param = static_cast<parameters>(foo);
1269  std::string theLabel = getStringFromParamEnum(param, true);
1270  h2_SimBSHLLHCParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
1271  h2_SimBSHLLHCParameters->SetBinContent(1, yBin, cutFunctor(param));
1272  yBin--;
1273  }
1274 
1275  h2_SimBSHLLHCParameters->GetXaxis()->LabelsOption("h");
1276  h2_SimBSHLLHCParameters->GetYaxis()->SetLabelSize(0.05);
1277  h2_SimBSHLLHCParameters->GetXaxis()->SetLabelSize(0.05);
1278  h2_SimBSHLLHCParameters->SetMarkerSize(1.5);
1279  h2_SimBSHLLHCParameters->Draw("TEXT");
1280 
1281  auto ltx = TLatex();
1282  ltx.SetTextFont(62);
1283  ltx.SetTextSize(0.030);
1284  ltx.SetTextAlign(11);
1285 
1286  auto runLS = beamSpotPI::unpack(std::get<0>(iov));
1287 
1288  ltx.DrawLatexNDC(
1289  gPad->GetLeftMargin(),
1290  1 - gPad->GetTopMargin() + 0.01,
1291  (tagname + " IOV: #color[4]{" + std::to_string(runLS.first) + "," + std::to_string(runLS.second) + "}")
1292  .c_str());
1293 
1294  // Fill canvans (2,1) with second 9 parameters
1295  canvas.cd(2);
1296  canvas.cd(2)->SetTopMargin(0.05);
1297  canvas.cd(2)->SetBottomMargin(0.06);
1298  canvas.cd(2)->SetLeftMargin(0.35);
1299  canvas.cd(2)->SetRightMargin(0.01);
1300  canvas.cd(2)->Modified();
1301  canvas.cd(2)->SetGrid();
1302 
1304  auto h2_SimBSHLLHCParameters_Extras =
1305  std::make_unique<TH2F>("Parameters Extras", "", 1, 0.0, 1.0, span, 0, static_cast<float>(span));
1306  h2_SimBSHLLHCParameters_Extras->SetStats(false);
1307  h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetBinLabel(1, "Value");
1308 
1309  unsigned int yBin_Extras = span;
1311  parameters param = static_cast<parameters>(foo);
1312  std::string theLabel = getStringFromParamEnum(param, true);
1313  h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetBinLabel(yBin_Extras, theLabel.c_str());
1314  h2_SimBSHLLHCParameters_Extras->SetBinContent(1, yBin_Extras, cutFunctor(param));
1315  yBin_Extras--;
1316  }
1317 
1318  h2_SimBSHLLHCParameters_Extras->GetXaxis()->LabelsOption("h");
1319  h2_SimBSHLLHCParameters_Extras->GetYaxis()->SetLabelSize(0.05);
1320  h2_SimBSHLLHCParameters_Extras->GetXaxis()->SetLabelSize(0.05);
1321  h2_SimBSHLLHCParameters_Extras->SetMarkerSize(1.5);
1322  h2_SimBSHLLHCParameters_Extras->Draw("TEXT");
1323 
1324  ltx.DrawLatexNDC(
1325  gPad->GetLeftMargin(),
1326  1 - gPad->GetTopMargin() + 0.01,
1327  (tagname + " IOV: #color[4]{" + std::to_string(runLS.first) + "," + std::to_string(runLS.second) + "}")
1328  .c_str());
1329 
1331  canvas.SaveAs(fileName.c_str());
1332 
1333  return true;
1334  }
ret
prodAgent to be discontinued
static std::string to_string(const XMLCh *ch)
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
def canvas(sub, attr)
Definition: svgfig.py:482
std::string getStringFromParamEnum(const parameters &parameter, const bool addUnits=false)
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ cmToUm

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

Definition at line 1340 of file BeamSpotPayloadInspectorHelper.h.

◆ m_payload

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