CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType > Class Template Reference

#include <SiPixelAliPCLThresholdsPayloadInspectorHelper.h>

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

Public Member Functions

 AlignPCLThresholds_DisplayBase ()
 
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
 

Private Attributes

bool isHighGranularity_
 
std::string label_
 

Additional Inherited Members

- Public Types inherited from cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >
typedef PlotImpl< IOV_M, 0 > Base
 
- 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
 

Detailed Description

template<class PayloadType>
class AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType >

Definition at line 86 of file SiPixelAliPCLThresholdsPayloadInspectorHelper.h.

Constructor & Destructor Documentation

◆ AlignPCLThresholds_DisplayBase()

Member Function Documentation

◆ fill()

template<class PayloadType >
bool AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType >::fill ( )
inlineoverridevirtual

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

Definition at line 101 of file SiPixelAliPCLThresholdsPayloadInspectorHelper.h.

References cms::cuda::assert(), svgfig::canvas(), AlignPCLThresholdPlotHelper::DELTA, AlignPCLThresholdPlotHelper::END_OF_TYPES, AlignPCLThresholds::extra_DOF, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::fetchPayload(), MillePedeFileConverter_cfg::fileName, custom_jme_cff::foo, AlignPCLThresholdPlotHelper::FRACTION_CUT, AlignPCLThresholdPlotHelper::getStringFromCoordEnum(), AlignPCLThresholdPlotHelper::getStringFromTypeEnum(), AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType >::isHighGranularity_, cond::payloadInspector::PlotImage< PayloadType, cond::payloadInspector::SINGLE_IOV >::m_imageFileName, AlignPCLThresholdPlotHelper::MAXERR, AlignPCLThresholdPlotHelper::MAXMOVE, jetsAK4_Puppi_cff::payload, AlignPCLThresholdPlotHelper::replaceAll(), runTheMatrix::ret, AlignPCLThresholdPlotHelper::SIG, AlCaHLTBitMon_QueryRunRegistry::string, makeGlobalPositionRcd_cfg::tag, HLT_2023v12_cff::Thresholds, to_string(), X, photonAnalyzer_cfi::xBin, and photonAnalyzer_cfi::yBin.

101  {
102  // to be able to see zeros
103  gStyle->SetHistMinimumZero(kTRUE);
104 
105  auto tag = cond::payloadInspector::PlotBase::getTag<0>();
106  auto iov = tag.iovs.front();
107  std::shared_ptr<PayloadType> payload = this->fetchPayload(std::get<1>(iov));
108  auto alignables = payload->getAlignableList();
109 
110  TCanvas canvas("Alignment PCL thresholds summary", "Alignment PCL thresholds summary", 1500, 800);
111  canvas.cd();
112 
113  canvas.SetTopMargin(0.07);
114  canvas.SetBottomMargin(isHighGranularity_ ? 0.20 : 0.06);
115  canvas.SetLeftMargin(0.11);
116  canvas.SetRightMargin(0.05);
117  canvas.Modified();
118  canvas.SetGrid();
119 
120  // needed for the internal loop
121  const auto& local_end_of_types = isHighGranularity_ ? END_OF_TYPES : FRACTION_CUT;
122  const int N_Y_BINS = AlignPCLThresholds::extra_DOF * local_end_of_types;
123 
124  auto Thresholds =
125  std::make_unique<TH2F>("Thresholds", "", alignables.size(), 0, alignables.size(), N_Y_BINS, 0, N_Y_BINS);
126  Thresholds->SetStats(false);
127  Thresholds->GetXaxis()->SetLabelSize(0.028);
128 
129  std::function<float(types, std::string, AlignPCLThresholds::coordType)> cutFunctor =
130  [&payload](types my_type, std::string alignable, AlignPCLThresholds::coordType coord) {
131  float ret(-999.);
132  switch (my_type) {
133  case DELTA:
134  return payload->getCut(alignable, coord);
135  case SIG:
136  return payload->getSigCut(alignable, coord);
137  case MAXMOVE:
138  return payload->getMaxMoveCut(alignable, coord);
139  case MAXERR:
140  return payload->getMaxErrorCut(alignable, coord);
141  case FRACTION_CUT: {
142  if constexpr (std::is_same_v<PayloadType, AlignPCLThresholdsHG>) {
143  const AlignPCLThresholdsHG::param_map& floatMap = payload->getFloatMap();
144  if (floatMap.find(alignable) != floatMap.end()) {
145  return payload->getFractionCut(alignable, coord);
146  } else {
147  return 0.f;
148  }
149  } else {
150  assert(false); /* cannot be here */
151  }
152  }
153  case END_OF_TYPES:
154  return ret;
155  default:
156  return ret;
157  }
158  };
159 
160  unsigned int xBin = 0;
161  for (const auto& alignable : alignables) {
162  xBin++;
163  auto xLabel = replaceAll(replaceAll(alignable, "minus", "(-)"), "plus", "(+)");
164  Thresholds->GetXaxis()->SetBinLabel(xBin, (xLabel).c_str());
165  unsigned int yBin = N_Y_BINS;
166  for (int foo = PayloadType::X; foo != PayloadType::extra_DOF; foo++) {
168  for (int bar = DELTA; bar != local_end_of_types; bar++) {
169  types type = static_cast<types>(bar);
171  if (xBin == 1) {
172  Thresholds->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
173  }
174 
175  Thresholds->SetBinContent(xBin, yBin, cutFunctor(type, alignable, coord));
176 
177  yBin--;
178  } // loop on types
179  } // loop on coordinates
180  } // loop on alignables
181 
182  Thresholds->GetXaxis()->LabelsOption(isHighGranularity_ ? "v" : "h");
183  Thresholds->Draw("TEXT");
184 
185  auto ltx = TLatex();
186  ltx.SetTextFont(62);
187  //ltx.SetTextColor(kBlue);
188  ltx.SetTextSize(0.047);
189  ltx.SetTextAlign(11);
190  std::string ltxText =
191  fmt::sprintf("#color[4]{%s} IOV: #color[4]{%s}", tag.name, std::to_string(std::get<0>(iov)));
192  ltx.DrawLatexNDC(gPad->GetLeftMargin(), 1 - gPad->GetTopMargin() + 0.01, ltxText.c_str());
193 
195  canvas.SaveAs(fileName.c_str());
196 
197  return true;
198  }
std::unordered_map< std::string, std::vector< float > > param_map
const std::string getStringFromCoordEnum(const AlignPCLThresholds::coordType &coord)
ret
prodAgent to be discontinued
const std::string getStringFromTypeEnum(const types &type)
#define X(str)
Definition: MuonsGrabber.cc:38
assert(be >=bs)
static std::string to_string(const XMLCh *ch)
std::string replaceAll(const std::string &str, const std::string &from, const std::string &to)
def canvas(sub, attr)
Definition: svgfig.py:482
std::shared_ptr< PayloadType > fetchPayload(const cond::Hash &payloadHash)

Member Data Documentation

◆ isHighGranularity_

template<class PayloadType >
bool AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType >::isHighGranularity_
private

◆ label_

template<class PayloadType >
std::string AlignPCLThresholdPlotHelper::AlignPCLThresholds_DisplayBase< PayloadType >::label_
private